Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into use-0.1398.0
Browse files Browse the repository at this point in the history
Signed-off-by: Yu Ishikawa <yu-iskw@users.noreply.github.com>
  • Loading branch information
yu-iskw committed Dec 6, 2024
2 parents 59e4be3 + e321b83 commit 6088b93
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 26 deletions.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 yu-iskw
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
2 changes: 1 addition & 1 deletion .github/workflows/contributors-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
name: A job to automate contrib in readme
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.3.6
uses: akhilmhdh/contributors-readme-action@v2.3.10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 10 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ repos:
rev: v1.7.1
hooks:
- id: actionlint-docker
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
- id: ruff
always_run: true
# SEE https://docs.astral.sh/ruff/formatter/#sorting-imports
args: [--select, I, --fix, --config=ruff.toml]
- id: ruff-format
always_run: true
args: [--config=ruff.toml]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setup: setup-python setup-pre-commit

.PHONE: setup-python
setup-python:
pip install -U pip==23.1.0
pip install -U pip==24.3.1
bash ./dev/setup.sh

.PHONE: setup-pre-commit
Expand Down
19 changes: 12 additions & 7 deletions dev/generate_clients.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Constants
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
PROJECT_DIR="$(dirname "${SCRIPT_DIR}")"

# Arguments
schema_json="${PROJECT_DIR}/dev/schemas/rebuilt-swagger.json"
Expand All @@ -46,22 +46,27 @@ while (($# > 0)); do
done

options=()
if [[ "${skip_validate_spec:?}" == "1" ]]; then
options+=("--skip-validate-spec")
fi

# Generate the client in the temporary directory.
temp_dir="$(mktemp -d -t openapi-python-client-XXXXXXXXXX)"
cd "${temp_dir:?}" || exit 1
openapi-python-client generate \
--path "${schema_json:?}" \
--config "${config_yaml:?}" \
--meta "${meta:?}"
--meta "${meta:?}" \
"${options[@]}"

ls -la "${temp_dir:?}/lightdash-client-python"
# Check the generated project
generated_project_dir="${temp_dir:?}/lightdash-client-python"
ls -la "${generated_project_dir:?}"

# Replace the default auth method from Bearer to ApiKey
sed -i -e "s/Bearer/ApiKey/" "${generated_project_dir:?}/lightdash_client/client.py"

# Copy the files
cp -apR "${temp_dir:?}/lightdash-client-python/"* "${output_dir:?}"
rsync -a -r --delete-after "${generated_project_dir:?}/lightdash_client/models/" "${output_dir:?}/lightdash_client/models/"
rsync -a -r --delete-after "${generated_project_dir:?}/lightdash_client/api/" "${output_dir:?}/lightdash_client/api/"
rsync -a -r --delete-after "${generated_project_dir:?}/lightdash_client/client.py" "${output_dir:?}/lightdash_client/client.py"

# Remove the temporary directory
rm -fr "${temp_dir:?}"
6 changes: 5 additions & 1 deletion dev/generate_openapi_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@


@click.command()
@click.option("--reference", type=str, default="https://raw.githubusercontent.com/lightdash/lightdash/main/packages/backend/src/generated/swagger.json")
@click.option(
"--reference",
type=str,
default="https://raw.githubusercontent.com/lightdash/lightdash/main/packages/backend/src/generated/swagger.json",
)
# @click.option("--output", type=str, required=True)
def main(reference: str):
print(f"Reference URL: {reference}")
Expand Down
6 changes: 5 additions & 1 deletion dev/openapi-python-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ project_name_override: lightdash-client-python

package_name_override: lightdash_client

package_version_override: "0.2.0"
package_version_override: 0.2.0

http_timeout: 30

# Format code using the pre-commit hooks of ruff
# SEE https://github.com/openapi-generators/openapi-python-client
post_hooks: []
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exclude = [
".github/",
".gitignore",
".pre-commit-config.yaml",
".style.yapf",
"ruff.toml",
".pylintrc",
".pypirc",
"Makefile",
Expand All @@ -24,7 +24,7 @@ name = "lightdash-client-python"
authors = [{name = "yu-iskw"}]
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.8.0,<4"
requires-python = ">=3.9,<3.13"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Information Technology",
Expand All @@ -36,10 +36,10 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Typing :: Typed",
]
dynamic = ["version", "description"]
Expand All @@ -54,18 +54,17 @@ Home = "https://github.com/yu-iskw/lightdash-client-python"

[project.optional-dependencies]
test = [
"pytest >=6.2.4,<7.0.0",
"pytest >=8.0,<9.0",
]
dev = [
"pylint >=2.12.0",
"mypy >=0.910,<1.0",
"flake8 >=3.8.3,<4.0.0",
"mypy >=0.910,<1.0",
"black >=20.0",
"isort >=5.0.6,<6.0.0",
"yapf >=0.29.0",
]
dev = [
"flit ==3.7.1",
"flit ==3.10.1",
"build ==0.7.0",
"yapf >=0.29.0",
"ruff >=0.8,<1.0",
"pyyaml >=5.3",
"pdoc3 >=0.9.2",
"pre-commit >=2.15.0",
Expand Down
6 changes: 6 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Start of Selection
line-length = 120
indent-width = 4

[format]
quote-style = "double"

0 comments on commit 6088b93

Please sign in to comment.