From 1d45fc7070586b1254c2cf742860c7cafb5b87b0 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 23 Sep 2024 13:34:03 -0700 Subject: [PATCH] Update dependency groups; use newer uv features --- .github/workflows/check-requirements.yml | 64 ------------------- .github/workflows/publish.yml | 4 +- .github/workflows/regen-examples-and-docs.yml | 8 ++- .github/workflows/test-website.yml | 8 ++- .github/workflows/test.yml | 16 ++--- .github/workflows/typecheck.yml | 12 ++-- pyproject.toml | 19 +----- 7 files changed, 28 insertions(+), 103 deletions(-) delete mode 100644 .github/workflows/check-requirements.yml diff --git a/.github/workflows/check-requirements.yml b/.github/workflows/check-requirements.yml deleted file mode 100644 index c6b2814a..00000000 --- a/.github/workflows/check-requirements.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Check requirements - -on: - push: - branches: main - paths: - - ".github/workflows/check-requirements.yml" - - "pyproject.toml" - pull_request: - paths: - - ".github/workflows/check-requirements.yml" - - "pyproject.toml" - workflow_dispatch: - schedule: - - cron: "0 0 * * *" - -permissions: - contents: read - -env: - FORCE_COLOR: 1 # Request colored output from CLI tools supporting it - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - check-requirements: - name: Check requirements can all be installed together - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Check requirements can all be installed together - run: uv pip install -e '.[dev]' --system - - create-issue-on-failure: - name: Create an issue if daily requirements check failed - runs-on: ubuntu-latest - needs: check-requirements - if: >- - ${{ - github.repository == 'AlexWaygood/typeshed-stats' - && always() - && github.event_name == 'schedule' - && needs.check-requirements.result == 'failure' - }} - permissions: - issues: write - steps: - - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.rest.issues.create({ - owner: "AlexWaygood", - repo: "typeshed-stats", - title: `Daily requirements check failed on ${new Date().toDateString()}`, - body: "Runs are listed here: https://github.com/AlexWaygood/typeshed-stats/actions/workflows/check-requirements.yml", - }) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b5db7f08..dac9faa5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -31,7 +31,9 @@ jobs: with: python-version: "3.12" - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v1 + with: + version: "latest" - run: uv pip install build --system - run: uv pip freeze - if: ${{ github.event_name != 'push' }} diff --git a/.github/workflows/regen-examples-and-docs.yml b/.github/workflows/regen-examples-and-docs.yml index 554f83c0..e01bcf2a 100644 --- a/.github/workflows/regen-examples-and-docs.yml +++ b/.github/workflows/regen-examples-and-docs.yml @@ -25,9 +25,11 @@ jobs: git config --global user.email '' - uses: actions/setup-python@v5 with: - python-version: "3.11" - - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - run: uv pip install -e .[docs] --system + python-version: "3.12" + - uses: astral-sh/setup-uv@v1 + with: + version: "latest" + - run: uv pip install -e .[dev] --system - run: uv pip freeze - name: Regenerate examples and docs id: regen diff --git a/.github/workflows/test-website.yml b/.github/workflows/test-website.yml index ff67e2c7..e2a52159 100644 --- a/.github/workflows/test-website.yml +++ b/.github/workflows/test-website.yml @@ -21,9 +21,11 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.11" - - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - run: uv pip install -e .[docs] --system + python-version: "3.12" + - uses: astral-sh/setup-uv@v1 + with: + version: "latest" + - run: uv pip install -e .[dev] --system - run: uv pip freeze - name: Regenerate examples and docs run: python scripts/regenerate.py --download-typeshed diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15a5299d..1c69201c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,20 +51,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} - uses: actions/setup-python@v5 + - name: Set up uv + uses: astral-sh/setup-uv@v1 with: - python-version: ${{ matrix.python-version }} - allow-prereleases: true - - uses: hynek/setup-cached-uv@v2 - - name: Install dependencies - run: uv pip install -e ".[pytest]" --system - - run: uv pip freeze + version: "latest" - name: Run tests under coverage shell: bash run: | - coverage run -m pytest --doctest-modules - coverage report --no-skip-covered + uv python pin ${{ matrix.python-version }} + uv run --extra=dev coverage run -m pytest --doctest-modules + uv run --extra=dev coverage report --no-skip-covered create-issue-on-failure: name: Create an issue if daily test failed diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index bc50ba0e..04cc5ef3 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -35,8 +35,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - run: uv run --python=3.11 --extra=typecheck mypy + - uses: astral-sh/setup-uv@v1 + with: + version: "latest" + - run: uv run --python=3.11 --extra=dev mypy pyright: name: Run pyright on the codebase @@ -46,8 +48,10 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.10" - - uses: hynek/setup-cached-uv@v2 - - run: uv pip install -e ".[typecheck]" --system + - uses: astral-sh/setup-uv@v1 + with: + version: "latest" + - run: uv pip install -e ".[dev]" --system - run: uv pip freeze - name: Run pyright uses: jakebailey/pyright-action@v2 diff --git a/pyproject.toml b/pyproject.toml index 901b9b1f..ad02f4ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,9 +51,7 @@ typeshed-stats = "typeshed_stats._cli:main" [project.optional-dependencies] rich = ["rich", "rich-argparse>=1"] -# Include the [rich] extra in the [docs] extra -# so the CLI docs generated from --help are consistent -docs = [ +dev = [ "typeshed-stats[rich]", "MarkDown==3.7", "mkdocs==1.6.0", @@ -61,9 +59,6 @@ docs = [ "mkdocs-material==9.5.31", "mkdocstrings==0.25.2", "mkdocstrings-python==1.10.8", -] -pytest = [ - "typeshed-stats[rich]", "beautifulsoup4>=4,<5", "covdefaults==2.3.0", "coverage==7.6.1", @@ -74,22 +69,10 @@ pytest = [ "pytest-dependency==0.6.0", "pytest-mock==3.14.0", "pytest-subtests==0.13.1", -] -typecheck = [ - "typeshed-stats[rich,docs,pytest]", "mypy==1.11.1", "types-beautifulsoup4==4.12.0.20240511", "types-Markdown==3.6.0.20240316", ] -# All of these must match .pre-commit-config.yaml -# -# Note that not all of the dependencies in the pre-commit config file are listed here. -# That's deliberate (it's not necessary to run them all locally). -# This file just lists the ones which it's convenient to have around locally. -misc-lint = [ - "ruff==0.6.1", -] -dev = ["typeshed-stats[rich,docs,typecheck,pytest,misc-lint]"] [tool.hatch.version] source = "vcs"