Skip to content

Modernize packaging and CI#150

Merged
constantinius merged 12 commits into
mainfrom
modernize-packaging
Jun 11, 2026
Merged

Modernize packaging and CI#150
constantinius merged 12 commits into
mainfrom
modernize-packaging

Conversation

@constantinius

Copy link
Copy Markdown
Contributor

Summary

Modernize the project's packaging, CI, and tooling — consolidating everything into a single pyproject.toml and removing legacy files.

Changes

Each change is its own commit:

  1. Pin actions/checkout to @v4@master is deprecated and a supply-chain risk
  2. Use python -m build — removes the --universal flag (Python 2 artifact) and switches to the modern build frontend
  3. Add py.typed marker — PEP 561 compliance so downstream consumers can use our type hints
  4. Enable pre-commit in CI — the linting step was commented out, meaning black/isort/flake8/mypy were configured but never enforced
  5. Fix docs version — was hardcoded to 0.0.3, now reads dynamically from pygeofilter.version
  6. Consolidate to PEP 621 pyproject.toml — replaces setup.py, setup.cfg, MANIFEST.in, and three requirements*.txt files with a single pyproject.toml. All metadata, dependencies, extras, and tool configs in one place.
  7. Replace black + isort + flake8 with Ruff — single tool, single config section, ~100x faster
  8. Add pytest-cov — coverage reporting on every test run

Files removed

  • setup.py, setup.cfg, MANIFEST.in
  • requirements-test.txt, requirements-dev.txt, docs/requirements.txt

Verified

  • python -m build produces a correct wheel with all .lark grammar files and py.typed included
  • Net: -174 lines removed, +135 added

Using @master is deprecated and a supply-chain risk — it tracks a
mutable branch. Pin to @v4 for both the build and publish workflows.
The --universal flag produces a py2.py3 wheel, which is wrong for a
Python 3-only package. Switch to the modern 'build' frontend which
respects pyproject.toml and produces the correct wheel tags.
Signals to type checkers (mypy, pyright) that pygeofilter ships
inline type annotations. Without this marker, downstream consumers
cannot use the package's type hints.
The pre-commit step was commented out, meaning black, isort, flake8,
and mypy were configured but never enforced. Uncomment it so linting
is actually validated on every push and PR. Also fixes the pip3 install
invocation (was using 'python -m pip3' which doesn't work).
The docs version was hardcoded to '0.0.3' and never updated. Import
__version__ from pygeofilter.version so it stays in sync with the
package automatically.
Replace the legacy setup.py + setup.cfg + MANIFEST.in + three
requirements*.txt files with a single pyproject.toml using PEP 621
project metadata.

Changes:
- All project metadata, dependencies, and extras now in pyproject.toml
- Dev/test/docs dependencies declared as optional-dependency groups
- CI workflow uses 'pip install .[test,dev,...]' instead of requirements files
- ReadTheDocs config uses 'pip install .[docs]' with pinned Python 3.12
- Package data (*.lark, py.typed) declared via [tool.setuptools.package-data]
- Tool configs (isort, flake8, mypy, pytest) moved to pyproject.toml
- Dropped Python 3.8 from classifiers (not tested in CI)

Removed:
- setup.py, setup.cfg, MANIFEST.in
- requirements-test.txt, requirements-dev.txt, docs/requirements.txt
Ruff is a single tool that replaces all three linters/formatters,
runs ~100x faster, and is configured in one place in pyproject.toml.

Updates both the pre-commit config and the dev dependencies.
Adds pytest-cov to test dependencies and configures pytest to
automatically report coverage with missing lines on every run.
W503 is a flake8-specific rule (line break before binary operator)
that doesn't exist in Ruff. Ruff follows Black's formatting which
already handles this correctly.
Fix 6 type errors that were hidden by the mypy<=1.10.0 pin:

- ast.Like.pattern: narrow type from ScalarAstType to str (it's always
  a string — patterns can't be numeric)
- solr/evaluate.py: convert Version to str before re-wrapping
- cli.py: use dict[str, Any] for PARSERS to satisfy variance checks

Remove the mypy version pin (was <=1.10.0, now unpinned) and update
the pre-commit mirror from v1.15.0 to v2.1.0. All 56 source files
now pass mypy cleanly.
Remove 3.9 from CI matrix, classifiers, requires-python, and ruff
target-version. Minimum supported version is now Python 3.10.
@constantinius constantinius requested a review from a team June 9, 2026 13:54
@constantinius constantinius merged commit 0856db9 into main Jun 11, 2026
8 checks passed
@constantinius constantinius deleted the modernize-packaging branch June 11, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants