diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a7ba00..89ddb1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,10 @@ on: types: - published +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + name: release permissions: {} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf6d7b6..04cf703 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,6 +15,20 @@ concurrency: cancel-in-progress: true jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2 + + - run: make lint + tests: name: "Python ${{ matrix.python-version }} ${{ matrix.os }}" runs-on: "${{ matrix.os }}" @@ -30,15 +44,10 @@ jobs: with: persist-credentials: false - - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 - with: - python-version: "${{ matrix.python-version }}" - allow-prereleases: true - - name: Install the latest version of uv uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2 - name: Run tests for ${{ matrix.python-version }} - run: | - make bootstrap - make test + run: make test + env: + UV_PYTHON: "${{ matrix.python-version }}" diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index 2063170..6316193 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -6,6 +6,10 @@ on: pull_request: branches: ["**"] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: {} jobs: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4630561..4e95957 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,9 +47,6 @@ You can run the unit tests locally with: ```bash # run the test suite in the current environment make test - -# OPTIONAL: use `tox` to fan out across multiple interpreters -make test-all ``` ### Documentation @@ -70,8 +67,8 @@ Releases of `CacheControl` are managed by GitHub Actions. To perform a release: -1. Update `CacheControl`'s `__version__` attribute. It can be found under - `cachecontrol/__init__.py`. +1. Update `CacheControl`'s `version` attribute. It can be found + in the `pyproject.toml` file, under the `[project]` section. 1. Create a new tag corresponding to your new version, with a `v` prefix. For example: diff --git a/Makefile b/Makefile index ab7ac60..a76ea9a 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ VENV=.venv ACTIVATE = $(VENV)/bin/activate bootstrap: - uv sync --extra dev + uv sync --dev lint: - uv run ruff check - uv run mypy cachecontrol + uv run --dev ruff check + uv run --dev mypy cachecontrol format: uv run codespell @@ -40,10 +40,10 @@ clean-test: rm -fr htmlcov/ test: - uv run py.test + uv run --dev py.test coverage: - uv run py.test --cov cachecontrol + uv run --dev py.test --cov cachecontrol dist: clean uv build diff --git a/pyproject.toml b/pyproject.toml index dc58d07..92834a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,11 +40,7 @@ Homepage = "https://pypi.org/project/CacheControl/" Issues = "https://github.com/psf/cachecontrol/issues" Source = "https://github.com/psf/cachecontrol" -[project.optional-dependencies] -# End-user extras. -filecache = ["filelock >= 3.8.0"] -redis = ["redis>=2.10.5"] - +[dependency-groups] # Development extras. dev = [ "CacheControl[filecache,redis]", @@ -64,6 +60,12 @@ dev = [ "types-requests", ] +[project.optional-dependencies] +# End-user extras. +filecache = ["filelock >= 3.8.0"] +redis = ["redis>=2.10.5"] + + [project.scripts] doesitcache = "cachecontrol._cmd:main" diff --git a/uv.lock b/uv.lock index b44a1c2..efaf724 100644 --- a/uv.lock +++ b/uv.lock @@ -86,16 +86,23 @@ dependencies = [ ] [package.optional-dependencies] +filecache = [ + { name = "filelock" }, +] +redis = [ + { name = "redis" }, +] + +[package.dev-dependencies] dev = [ + { name = "cachecontrol", extra = ["filecache", "redis"] }, { name = "cheroot" }, { name = "cherrypy" }, { name = "codespell" }, - { name = "filelock" }, { name = "furo" }, { name = "mypy" }, { name = "pytest" }, { name = "pytest-cov" }, - { name = "redis" }, { name = "ruff" }, { name = "sphinx", version = "8.1.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "sphinx", version = "8.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, @@ -103,34 +110,32 @@ dev = [ { name = "types-redis" }, { name = "types-requests" }, ] -filecache = [ - { name = "filelock" }, -] -redis = [ - { name = "redis" }, -] [package.metadata] requires-dist = [ - { name = "cachecontrol", extras = ["filecache", "redis"], marker = "extra == 'dev'" }, - { name = "cheroot", marker = "extra == 'dev'", specifier = ">=11.1.2" }, - { name = "cherrypy", marker = "extra == 'dev'" }, - { name = "codespell", marker = "extra == 'dev'" }, { name = "filelock", marker = "extra == 'filecache'", specifier = ">=3.8.0" }, - { name = "furo", marker = "extra == 'dev'" }, { name = "msgpack", specifier = ">=0.5.2,<2.0.0" }, - { name = "mypy", marker = "extra == 'dev'" }, - { name = "pytest", marker = "extra == 'dev'" }, - { name = "pytest-cov", marker = "extra == 'dev'" }, { name = "redis", marker = "extra == 'redis'", specifier = ">=2.10.5" }, { name = "requests", specifier = ">=2.16.0" }, - { name = "ruff", marker = "extra == 'dev'" }, - { name = "sphinx", marker = "extra == 'dev'" }, - { name = "sphinx-copybutton", marker = "extra == 'dev'" }, - { name = "types-redis", marker = "extra == 'dev'" }, - { name = "types-requests", marker = "extra == 'dev'" }, ] -provides-extras = ["filecache", "redis", "dev"] +provides-extras = ["filecache", "redis"] + +[package.metadata.requires-dev] +dev = [ + { name = "cachecontrol", extras = ["filecache", "redis"] }, + { name = "cheroot", specifier = ">=11.1.2" }, + { name = "cherrypy" }, + { name = "codespell" }, + { name = "furo" }, + { name = "mypy" }, + { name = "pytest" }, + { name = "pytest-cov" }, + { name = "ruff" }, + { name = "sphinx" }, + { name = "sphinx-copybutton" }, + { name = "types-redis" }, + { name = "types-requests" }, +] [[package]] name = "certifi"