From 03dad96927ea29ae6d8066ebe8a498de4bc09d9a Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:51:29 +0200 Subject: [PATCH] DX: migrate to `uv` environment --- .cspell.json | 5 +++- .envrc | 3 ++- .github/workflows/cd.yml | 4 +-- .github/workflows/ci.yml | 34 ----------------------- .github/workflows/clean-caches.yml | 4 +-- .github/workflows/pr-linting.yml | 2 +- .gitignore | 1 + .pre-commit-config.yaml | 43 +++++++++++++++++------------- .python-version | 1 + .taplo.toml | 12 +++++++++ .vscode/extensions.json | 8 ++++-- .vscode/settings.json | 3 +++ README.md | 1 + environment.yml | 7 ----- pyproject.toml | 21 +++++++++++++++ 15 files changed, 81 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .python-version create mode 100644 .taplo.toml delete mode 100644 environment.yml create mode 100644 pyproject.toml diff --git a/.cspell.json b/.cspell.json index 37be13e..acbd007 100644 --- a/.cspell.json +++ b/.cspell.json @@ -21,9 +21,11 @@ ], "ignorePaths": [ "**/.cspell.json", + ".envrc", ".gitignore", ".pre-commit-config.yaml", - ".vscode/*" + ".vscode/*", + "pyproject.toml" ], "language": "en-US", "words": ["ampform", "compwa", "qrules", "tensorwaves", "Zenodo"], @@ -34,6 +36,7 @@ "PYTHONHASHSEED", "bdist", "commitlint", + "nodefaults", "noreply", "prereleased", "rtfd", diff --git a/.envrc b/.envrc index cce3aa5..41fd2ca 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ -layout anaconda +uv sync --all-extras --quiet +source .venv/bin/activate diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 678aa9b..bd8afb8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,8 +9,8 @@ on: jobs: milestone: if: startsWith(github.ref, 'refs/tags') - uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1 + uses: ComPWA/actions/.github/workflows/close-milestone.yml@v2 push: if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease secrets: inherit - uses: ComPWA/actions/.github/workflows/push-to-version-branches.yml@v1 + uses: ComPWA/actions/.github/workflows/push-to-version-branches.yml@v2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b0163c6..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: |- - ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }} - -env: - PYTHONHASHSEED: "0" - -on: - push: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - pull_request: - branches: - - main - - epic/* - - "[0-9]+.[0-9]+.x" - workflow_dispatch: - inputs: - specific-pip-packages: - description: Run CI with specific pip packages - required: false - type: string - -jobs: - style: - if: inputs.specific-pip-packages == '' - secrets: - token: ${{ secrets.PAT }} - uses: ComPWA/actions/.github/workflows/pre-commit.yml@v1 diff --git a/.github/workflows/clean-caches.yml b/.github/workflows/clean-caches.yml index a66c407..7986e0c 100644 --- a/.github/workflows/clean-caches.yml +++ b/.github/workflows/clean-caches.yml @@ -14,9 +14,9 @@ on: jobs: cleanup: name: Remove caches - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: ComPWA/actions/clean-caches@v1 + - uses: ComPWA/actions/clean-caches@v2 with: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} ref: ${{ inputs.ref }} diff --git a/.github/workflows/pr-linting.yml b/.github/workflows/pr-linting.yml index 0fab841..44dc9e4 100644 --- a/.github/workflows/pr-linting.yml +++ b/.github/workflows/pr-linting.yml @@ -11,4 +11,4 @@ on: jobs: lint-pr: - uses: ComPWA/actions/.github/workflows/pr-linting.yml@v1 + uses: ComPWA/actions/.github/workflows/pr-linting.yml@v2 diff --git a/.gitignore b/.gitignore index c2658d7..0d53f4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +uv.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6b829e9..eeae0d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,6 @@ ci: - autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks" + autoupdate_commit_msg: "MAINT: update lock files" autoupdate_schedule: quarterly - skip: - - prettier repos: - repo: meta @@ -10,8 +8,19 @@ repos: - id: check-hooks-apply - id: check-useless-excludes + - repo: https://github.com/ComPWA/policy + rev: 0.5.0rc2 + hooks: + - id: check-dev-files + args: + - --keep-issue-templates + - --no-python + - --no-pypi + - --repo-name=.github + - --repo-title=Public ComPWA GitHub profile + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-case-conflict - id: check-merge-conflict @@ -21,25 +30,23 @@ 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/policy - rev: 0.3.18 + - repo: https://github.com/ComPWA/taplo-pre-commit + rev: v0.9.3 hooks: - - id: check-dev-files - args: - - --keep-issue-templates - - --no-gitpod - - --no-notebook - - --no-prettierrc - - --no-python - - --repo-name=compwa-github - - --repo-title=Public ComPWA GitHub profile + - id: taplo-format + + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort + args: [--in-place] - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v8.13.1 + rev: v8.15.1 hooks: - id: cspell diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..e4fba21 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..0db1df7 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,12 @@ +[formatting] +align_comments = false +align_entries = false +allowed_blank_lines = 1 +array_auto_collapse = false +array_auto_expand = true +array_trailing_comma = true +column_width = 88 +compact_inline_tables = true +indent_string = " " +reorder_arrays = true +reorder_keys = true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1674cd7..18d0b52 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,12 +1,16 @@ { "recommendations": [ + "eamodio.gitlens", "esbenp.prettier-vscode", "github.vscode-github-actions", - "Soulcode.vscode-unwanted-extensions", + "mhutchie.git-graph", + "soulcode.vscode-unwanted-extensions", "stkb.rewrap", - "streetsidesoftware.code-spell-checker" + "streetsidesoftware.code-spell-checker", + "tamasfe.even-better-toml" ], "unwantedRecommendations": [ + "bungcip.better-toml", "davidanson.vscode-markdownlint", "garaioag.garaio-vscode-unwanted-recommendations", "ms-python.flake8", diff --git a/.vscode/settings.json b/.vscode/settings.json index f6fc0a7..576381d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,5 +14,8 @@ "python.terminal.activateEnvironment": false, "redhat.telemetry.enabled": false, "rewrap.wrappingColumn": 88, + "search.exclude": { + "**/uv.lock": true + }, "telemetry.telemetryLevel": "off" } diff --git a/README.md b/README.md index 7ffe7a6..3b692b7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ComPWA/.github/main.svg)](https://results.pre-commit.ci/latest/github/ComPWA/.github/main) [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) This repository manages the GitHub profile and repository templates for the [ComPWA Organization](https://github.com/ComPWA). diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 6b3d5aa..0000000 --- a/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: pre-commit -channels: - - defaults -dependencies: - - pre-commit -variables: - PRETTIER_LEGACY_CLI: 1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0d3a632 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[project] +name = "compwa-github-page" +version = "0.0.0" + +[project.optional-dependencies] +dev = [ + "pre-commit-uv", +] + +[tool.tomlsort] +all = false +ignore_case = true +in_place = true +sort_first = [ + "build-system", + "project", + "tool.setuptools", + "tool.setuptools_scm", +] +spaces_indent_inline_array = 4 +trailing_comma_inline_array = true