From c40249e597dfc605e521e7f8b4dfe0e60e7bfec8 Mon Sep 17 00:00:00 2001 From: vanolucas <10572472+vanolucas@users.noreply.github.com> Date: Mon, 18 Nov 2024 00:09:42 +0100 Subject: [PATCH] Update from upstream Superlinear cookiecutter template (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: prefer mypy daemon (#245) * fix: remove deprecated ruff imports feature (#246) * feat: add GitHub Codespaces badge (#247) * docs: update ruff hyperlink (#248) docs: update Ruff hyperlink * feat: increase minimum Python version to 3.10 (#249) * feat: add ipython to dev dependencies * feat: increase minimum Python version to 3.10 * fix: update ruff log level (#250) * fix: conflicting dependencies between ipython and commitizen (#252) * chore: replace Radix with Superlinear (#251) Co-authored-by: Xavier Goás Aguililla <xavier@radix.ai> * feat: remove CI/CD, add PostgreSQL + Adminer options (#1) * feat: removed CI/CD, added PostgreSQL and Adminer options * fix(LICENSE): typo in name * chore: documented new cookiecutter options * chore: add `poetry install` instruction in README * chore: add poe lint/test instructions to README * feat: add Streamlit app option to cookiecutter (#2) * feat: add with_streamlit cookiecutter option * chore: rename with_streamlit cookiecutter var * feat: add VSCode debug launch config * chore: update LICENSE date * chore(README): fixed syntax * refactor(docker-compose): remove version (deprecated) * feat: removed GitHub test flow --------- Co-authored-by: Laurent Sorber <laurent.sorber@gmail.com> Co-authored-by: r-dh <14875684+r-dh@users.noreply.github.com> Co-authored-by: Xavier Goás Aguililla <xavier@goasaguililla.net> Co-authored-by: Xavier Goás Aguililla <xavier@radix.ai> --- .github/workflows/test.yml | 68 ------------------- .../.devcontainer/devcontainer.json | 3 +- .../pyproject.toml | 4 +- 3 files changed, 4 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 5f19acc..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Test - -on: - push: - branches: - - main - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python-version: ["3.9", "3.12"] - project-type: ["app", "package"] - - name: Python ${{ matrix.python-version }} ${{ matrix.project-type }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - path: template - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Scaffold Python project - run: | - pip install --no-input cruft - cruft create --no-input --extra-context '{"project_type": "${{ matrix.project-type }}", "project_name": "My Project", "python_version": "3.9", "__docker_image":"radixai/python-gpu:$PYTHON_VERSION-cuda11.8", "with_fastapi_api": "1", "with_typer_cli": "1"}' ./template/ - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 21 - - - name: Install @devcontainers/cli - run: npm install --location=global @devcontainers/cli@0.58.0 - - - name: Start Dev Container with Python ${{ matrix.python-version }} - run: | - git config --global init.defaultBranch main - git init - git checkout -b test - git add . - PYTHON_VERSION=${{ matrix.python-version }} devcontainer up --workspace-folder . - working-directory: ./my-project/ - - - name: Lint project - run: devcontainer exec --workspace-folder my-project poe lint - - - name: Test project - run: devcontainer exec --workspace-folder my-project poe test - - - name: Build app Docker image - if: ${{ matrix.project-type == 'app' }} - uses: docker/build-push-action@v5 - with: - build-args: | - SOURCE_BRANCH=${{ env.GITHUB_REF }} - SOURCE_COMMIT=${{ env.GITHUB_SHA }} - context: ./my-project/ - target: app diff --git a/{{ cookiecutter.__project_name_kebab_case }}/.devcontainer/devcontainer.json b/{{ cookiecutter.__project_name_kebab_case }}/.devcontainer/devcontainer.json index 46946ee..bc86cfa 100644 --- a/{{ cookiecutter.__project_name_kebab_case }}/.devcontainer/devcontainer.json +++ b/{{ cookiecutter.__project_name_kebab_case }}/.devcontainer/devcontainer.json @@ -45,6 +45,7 @@ "/usr/local/bin/python" ], "mypy-type-checker.importStrategy": "fromEnvironment", + "mypy-type-checker.preferDaemon": true, "notebook.codeActionsOnSave": { "notebook.source.fixAll": "explicit", "notebook.source.organizeImports": "explicit" @@ -55,7 +56,7 @@ "python.testing.pytestEnabled": true, "ruff.importStrategy": "fromEnvironment", {%- if cookiecutter.development_environment == "strict" %} - "ruff.logLevel": "warn", + "ruff.logLevel": "warning", {%- endif %} "terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.profiles.linux": { diff --git a/{{ cookiecutter.__project_name_kebab_case }}/pyproject.toml b/{{ cookiecutter.__project_name_kebab_case }}/pyproject.toml index 0c33f33..e72047c 100644 --- a/{{ cookiecutter.__project_name_kebab_case }}/pyproject.toml +++ b/{{ cookiecutter.__project_name_kebab_case }}/pyproject.toml @@ -56,7 +56,7 @@ pre-commit = ">=3.7.0" pytest = ">=8.1.1" pytest-mock = ">=3.14.0" pytest-xdist = ">=3.5.0" -ruff = ">=0.3.5" +ruff = ">=0.5.7" {%- if cookiecutter.development_environment == "strict" %} safety = ">=3.1.0" shellcheck-py = ">=0.10.0.1" @@ -66,6 +66,7 @@ typeguard = ">=4.2.1" [tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/ cruft = ">=2.15.0" ipykernel = ">=6.29.4" +ipython = ">=8.18.0" ipywidgets = ">=8.1.2" pdoc = ">=14.4.0" {%- if cookiecutter.private_package_repository_name %} @@ -137,7 +138,6 @@ src = ["src", "tests"] target-version = "py{{ cookiecutter.python_version.split('.')[:2]|join }}" [tool.ruff.lint] -ignore-init-module-imports = true {%- if cookiecutter.development_environment == "strict" %} select = ["A", "ASYNC", "B", "BLE", "C4", "C90", "D", "DTZ", "E", "EM", "ERA", "F", "FBT", "FLY", "FURB", "G", "I", "ICN", "INP", "INT", "ISC", "LOG", "N", "NPY", "PERF", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "Q", "RET", "RSE", "RUF", "S", "SIM", "SLF", "SLOT", "T10", "T20", "TCH", "TID", "TRY", "UP", "W", "YTT"] ignore = ["D203", "D213", "E501", "RET504", "S101", "S307"]