From 98b5d4579ae312538522d8099e93276fb8fdfd26 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:30:17 +0200 Subject: [PATCH] MAINT: update developer environment (#30) * MAINT: autoupdate pre-commit hooks --- .cspell.json | 3 +- .envrc | 11 ++++++- .gitattributes | 1 + .github/workflows/cd.yml | 2 +- .github/workflows/clean-caches.yml | 2 +- .github/workflows/release-drafter.yml | 2 +- .gitignore | 1 + .pre-commit-config.yaml | 45 +++++++++++++-------------- .vscode/extensions.json | 1 + .vscode/settings.json | 4 +-- environment.yml | 4 +-- pyproject.toml | 26 ++++++++++++++-- 12 files changed, 65 insertions(+), 37 deletions(-) create mode 100644 .gitattributes diff --git a/.cspell.json b/.cspell.json index c650773..bcc34ed 100644 --- a/.cspell.json +++ b/.cspell.json @@ -16,8 +16,9 @@ "ignorePaths": [ "**/*.rst_t", "**/.cspell.json", - "*.rst_t", ".editorconfig", + ".envrc", + ".gitattributes", ".gitignore", ".pre-commit-config.yaml", ".prettierignore", diff --git a/.envrc b/.envrc index cce3aa5..e1d415a 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,10 @@ -layout anaconda +if [ -e .venv ]; then + source .venv/bin/activate +elif [ -e venv ]; then + source venv/bin/activate +elif [ -e .pixi ]; then + watch_file pixi.lock + eval "$(pixi shell-hook)" +else + layout anaconda +fi diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..18f6c7e --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +pixi.lock linguist-language=YAML linguist-generated=true diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 54ae3bc..2f66c9a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,7 +22,7 @@ jobs: - package-name permissions: id-token: write - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: ComPWA/actions/build-pypi-distribution@v1 - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/clean-caches.yml b/.github/workflows/clean-caches.yml index a66c407..939e136 100644 --- a/.github/workflows/clean-caches.yml +++ b/.github/workflows/clean-caches.yml @@ -14,7 +14,7 @@ on: jobs: cleanup: name: Remove caches - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: ComPWA/actions/clean-caches@v1 with: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5234093..32c6579 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -9,7 +9,7 @@ on: jobs: update_release_draft: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: release-drafter/release-drafter@v6 env: diff --git a/.gitignore b/.gitignore index 03171f1..12d1db6 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ prof/ # Virtual environments *venv/ +.pixi/ .tox/ pyvenv*/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 193dd6e..bb8f92c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,7 @@ ci: autoupdate_schedule: quarterly # already done by requirements-cron.yml skip: - mypy - - prettier - pyright - - taplo repos: - repo: meta @@ -13,15 +11,25 @@ repos: - id: check-hooks-apply - id: check-useless-excludes + - repo: https://github.com/ComPWA/policy + rev: 0.4.2 + hooks: + - id: check-dev-files + args: + - --no-notebooks + - --no-prettierrc + - --repo-name=sphinx-api-relink + - --repo-title=sphinx-api-relink + - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.9 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-ast - id: check-case-conflict @@ -41,15 +49,15 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 + - repo: https://github.com/ComPWA/prettier-pre-commit + rev: v3.3.3 hooks: - id: prettier - - repo: https://github.com/ComPWA/mirrors-taplo - rev: v0.8.1 + - repo: https://github.com/ComPWA/taplo-pre-commit + rev: v0.9.3 hooks: - - id: taplo + - id: taplo-format - repo: https://github.com/pappasam/toml-sort rev: v0.23.1 @@ -58,24 +66,13 @@ repos: args: - --in-place - - repo: https://github.com/ComPWA/policy - rev: 0.3.18 - hooks: - - id: check-dev-files - args: - - --no-gitpod - - --no-notebooks - - --no-prettierrc - - --repo-name=sphinx-api-relink - - --repo-title=sphinx-api-relink - - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.13.1 + rev: v8.15.1 hooks: - id: cspell - repo: https://github.com/editorconfig-checker/editorconfig-checker.python - rev: 2.7.3 + rev: 3.0.3 hooks: - id: editorconfig-checker name: editorconfig @@ -94,7 +91,7 @@ repos: types: - python - - repo: https://github.com/ComPWA/mirrors-pyright - rev: v1.1.374 + - repo: https://github.com/ComPWA/pyright-pre-commit + rev: v1.1.384 hooks: - id: pyright diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a06347c..9d7d2ce 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,6 +6,7 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "github.vscode-github-actions", + "mhutchie.git-graph", "ms-python.mypy-type-checker", "ms-python.python", "ms-python.vscode-pylance", diff --git a/.vscode/settings.json b/.vscode/settings.json index 798d611..2224708 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,14 +29,15 @@ "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "cSpell.enabled": true, "coverage-gutters.coverageFileNames": ["coverage.xml"], "coverage-gutters.coverageReportFileName": "**/htmlcov/index.html", "coverage-gutters.showGutterCoverage": false, "coverage-gutters.showLineCoverage": true, - "cSpell.enabled": true, "diffEditor.experimental.showMoves": true, "editor.formatOnSave": true, "files.associations": { + "**/pixi.lock": "yaml", "*.rst_t": "jinja" }, "files.watcherExclude": { @@ -57,7 +58,6 @@ }, "notebook.formatOnSave.enabled": true, "python.analysis.autoImportCompletions": false, - "python.analysis.typeCheckingMode": "strict", "python.terminal.activateEnvironment": false, "python.testing.unittestEnabled": false, "redhat.telemetry.enabled": false, diff --git a/environment.yml b/environment.yml index d04dc49..64ddb5f 100644 --- a/environment.yml +++ b/environment.yml @@ -2,9 +2,7 @@ name: sphinx-api-relink channels: - defaults dependencies: - - python==3.9.* + - python==3.12.* - pip - pip: - -e .[dev] -variables: - PRETTIER_LEGACY_CLI: "1" diff --git a/pyproject.toml b/pyproject.toml index b0aa96c..b77b038 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ requires-python = ">=3.9" dev = ["sphinx-api-relink[sty]"] sty = [ "mypy", - "pre-commit", + "pre-commit-uv", "ruff", "sphinx-api-relink[types]", ] @@ -80,6 +80,8 @@ namespaces = false where = ["src"] [tool.setuptools_scm] +local_scheme = "no-local-version" +version_scheme = "post-release" write_to = "src/version.py" [tool.coverage.run] @@ -96,6 +98,26 @@ files = [ show_error_codes = true warn_unused_configs = true +[tool.pixi.project] +channels = ["conda-forge"] +platforms = ["linux-64"] + +[tool.pixi.activation.env] +PRETTIER_LEGACY_CLI = "1" + +[tool.pixi.dependencies] +python = "3.12.*" + +[tool.pixi.environments] +default = {features = [ + "dev", + "sty", + "types", +]} + +[tool.pixi.pypi-dependencies] +sphinx-api-relink = {path = ".", editable = true} + [tool.pyright] exclude = [ "**/.git", @@ -126,7 +148,6 @@ typeCheckingMode = "strict" preview = true show-fixes = true src = ["src"] -target-version = "py39" [tool.ruff.format] docstring-code-format = true @@ -193,6 +214,5 @@ sort_first = [ "tool.setuptools", "tool.setuptools_scm", ] -sort_table_keys = true spaces_indent_inline_array = 4 trailing_comma_inline_array = true