Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bumper.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ search = 'version = "{current_version}"'
[[tool.bumper.files]]
file = "./README.md"
search = "rev: v{current_version}"

[[tool.bumper.files]]
file = "./pre_commit_python_eol/__init__.py"
search = '__version__ = "{current_version}"'
6 changes: 1 addition & 5 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[flake8]
max-line-length=100
import-order-style=pycharm
application-import-names=pre_commit_python_eol,tests
extend-ignore=
# pycodestyle
E203,E226,E701
E,F,W,
# flake8-annotations
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206,
extend-exclude=
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/bump_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Check Cached Release Cycle

on:
workflow_dispatch:
schedule:
- cron: "0 9 1 1,4,7,10 *"

jobs:
bump-cache:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write

steps:
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.x"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Bump Cache
id: bump
env:
PUBLIC_PAT: ${{ secrets.PUBLIC_PAT }}
run: |
uv sync --no-dev --extra gha
uv run ./pre_commit_python_eol/bump_cache.py
{
echo 'RES<<EOF'
git diff ./cached_release_cycle.json
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Open Issue If Bumped
if: ${{ steps.bump.outputs.RES != ''}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
today=$(date +"%Y-%m-%d")
gh issue create \
--title "($today) Release Cycle Cache Outdated" \
--body '\`\`\`diff\n${{ steps.report.outputs.RES }}\n\`\`\`'
50 changes: 28 additions & 22 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.x"
version: "0.8.x"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- name: Install dependencies
run: uv sync --all-extras --dev

Expand All @@ -38,21 +38,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13", "3.14-dev"]
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.x"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Get Non-Hyphenated Python Version
id: get-pyver
run: |
echo "PYVER=$(cut -d '-' -f 1 <<< ${{ matrix.python-version }})" >> $GITHUB_OUTPUT

- name: Set up (release) Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
if: "!endsWith(matrix.python-version, '-dev')"
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -63,13 +61,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.x"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: |
uv venv
uv pip install tox-gh-actions tox-uv
uv venv --python ${{ steps.get-pyver.outputs.PYVER }}
uv pip install tox-uv

- name: Run tests w/tox
run: uv run tox
run: |
uv run tox -e ${{ steps.get-pyver.outputs.PYVER }}

- name: Cache coverage for ${{ matrix.python-version }}
uses: actions/upload-artifact@v4
Expand All @@ -84,15 +90,15 @@ jobs:
needs: test

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

- name: Pull coverage workflow artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
path: cov_cache/

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.7.x"
version: "0.8.x"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ repos:
- id: flake8
additional_dependencies:
- flake8-annotations
- flake8-define-class-attributes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -35,6 +36,6 @@ repos:
- id: python-check-blanket-type-ignore
- id: python-use-type-annotations
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.13.0
hooks:
- id: ruff-check
9 changes: 2 additions & 7 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"D", # pydocstyle/flake8-docstrings
"E", # pycodestyle
"F", # Pyflakes
"FIX", # flake8-fixme
"N", # pep8-naming
"W", # pycodestyle
]

ignore = [
Expand Down Expand Up @@ -55,10 +57,3 @@ ignore = [
"D101",
"D103",
]

[lint.flake8-bugbear]
extend-immutable-calls = [
# Typer CLI
"typer.Option",
"typer.Argument",
]
2 changes: 2 additions & 0 deletions pre_commit_python_eol/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__version__ = "2025.5.0"
__url__ = "https://github.com/sco1/pre-commit-check-eol"
40 changes: 40 additions & 0 deletions pre_commit_python_eol/bump_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import json
import platform
from pathlib import Path

from pre_commit_python_eol import __url__, __version__

try:
import httpx
except ImportError:
raise RuntimeError(
"httpx was not installed, please install the 'gha' dependency group"
) from None

USER_AGENT = (
f"pre-commit-check-eol/{__version__} ({__url__}) "
f"httpx/{httpx.__version__} "
f"{platform.python_implementation()}/{platform.python_version()}"
)

CACHE_SOURCE = (
"https://raw.githubusercontent.com/python/devguide/refs/heads/main/include/release-cycle.json"
)
LOCAL_CACHE = Path("./cached_release_cycle.json")


def bump_cache() -> None:
"""Update the cached release cycle JSON from the source repository."""
with httpx.Client(headers={"User-Agent": USER_AGENT}) as client:
r = client.get(CACHE_SOURCE)
r.raise_for_status()

rj = r.json()

with LOCAL_CACHE.open("w", encoding="utf8") as f:
json.dump(rj, f, indent=2, ensure_ascii=False)
f.write("\n") # Add in trailing newline


if __name__ == "__main__":
bump_cache()
24 changes: 18 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]

Expand All @@ -35,24 +36,30 @@ Changelog = "https://github.com/sco1/pre-commit-python-eol/blob/main/CHANGELOG.m
[project.scripts]
checkeol = "pre_commit_python_eol.check_eol:main"

[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"black~=25.0",
"flake8~=7.1",
"flake8-annotations~=3.1",
"flake8-define-class-attributes~=0.2",
"isort~=6.0",
"mypy~=1.14",
"pre-commit~=4.0",
"pytest~=8.3",
"pytest-cov~=6.0",
"pytest-randomly~=3.16",
"pytest-cov~=7.0",
"pytest-randomly~=4.0",
"ruff~=0.9",
"sco1-bumper~=2.0",
"time-machine~=2.16",
"tox~=4.23",
"tox-uv~=1.17",
]

[project.optional-dependencies]
gha = [
"httpx~=0.28",
]

[tool.black]
line-length = 100

Expand All @@ -69,6 +76,7 @@ disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
enable_error_code = "exhaustive-match"
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
Expand All @@ -77,6 +85,10 @@ warn_return_any = true
warn_unused_configs = true
warn_unused_ignores = true

[tool.uv.build-backend]
module-name = "pre_commit_python_eol"
module-root = ""

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
requires = ["uv_build"]
build-backend = "uv_build"
13 changes: 4 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ exclude_also =
if __name__ == "__main__":

[tox]
envlist = clean,py{311,312,313}
skip_missing_interpreters = True
minversion = 3.14.0
envlist = clean,py{3.11,3.12,3.13,3.14}
isolated_build = True
skip_missing_interpreters = True
requires =
tox >= 4.0

[testenv]
commands = python -m pytest
Expand All @@ -32,9 +33,3 @@ deps =
deps = coverage
skip_install = true
commands = coverage erase

[gh-actions] # For tox GHA
python =
3.11: py311
3.12: py312
3.13: py313
Loading