Skip to content

build(deps): bump minimum Python to 3.12, update deps, drop typed_ast - #473

Merged
ErikBjare merged 7 commits into
uniswap-python:masterfrom
TimeToBuildBob:dev/python312-dep-updates
Jul 29, 2026
Merged

build(deps): bump minimum Python to 3.12, update deps, drop typed_ast#473
ErikBjare merged 7 commits into
uniswap-python:masterfrom
TimeToBuildBob:dev/python312-dep-updates

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Builds on the intent of #410 but targets Python 3.12 (as requested) instead of 3.9.

Changes

Python floor: ^3.7.2^3.12

Removed dependencies:

  • typing-extensions: Concatenate and ParamSpec are stdlib since Python 3.10; no longer needed at 3.12
  • black: superseded by ruff formatter (already in .pre-commit-config.yaml)
  • flake8: superseded by ruff linter (already in .pre-commit-config.yaml)

Updated dependencies:

  • pytest: ^6.0^8 (9.1.1 available, requires Python 3.10+)
  • Sphinx: *^9 (9.1.0 now requires Python 3.12, fits the new floor perfectly)
  • pydata-sphinx-theme: unpinned from 0.13.1executablebooks/sphinx-book-theme#711 was resolved long ago; latest is 0.20.0
  • click: loosened ^8.0.3^8
  • web3: dropped allow-prereleases = true — stable 6.x (currently 6.20.4) is sufficient

Code:

  • decorators.py: migrate from typing_extensions import Concatenate, ParamSpec → stdlib typing
  • decorators.py: rename unused token_two_token_two (second-token approval was never wired up; now surfaced by ruff replacing flake8)

Config:

  • [tool.ruff][tool.ruff.lint] (deprecation fix for ruff 0.15+)
  • Build backend: poetry.masonry.apipoetry.core.masonry.api
  • CI: both test and typecheck jobs now use Python 3.12

Lock file regenerated with Poetry 2.3.2 / Python 3.12.3.

Deferred

  • web3 7.x upgrade: web3 7 is an async-first rewrite with breaking API changes throughout. Left at ^6.5.0 (resolves to 6.20.4). Upgrade warrants its own PR once the call sites are audited.

…nters

- Require Python ^3.12 (from ^3.7.2)
- Drop typing-extensions: Concatenate/ParamSpec now in stdlib typing (3.10+)
- Drop black and flake8: superseded by ruff (already in pre-commit config)
- Bump pytest ^6 → ^8, Sphinx * → ^9 (requires Python 3.12)
- Unpin pydata-sphinx-theme (sphinx-book-theme#711 long resolved)
- Drop allow-prereleases on web3 (stable 6.x line is sufficient)
- Loosen click ^8.0.3 → ^8
- Update build backend: poetry.masonry.api → poetry.core.masonry.api
- CI: test and typecheck jobs now use Python 3.12
- Move [tool.ruff] → [tool.ruff.lint] (deprecation fix)
- Silence unused _token_two variable (second-token approval was never wired up)

Note: web3 7.x upgrade deferred (major async-first rewrite, breaking API changes).
Comment thread pyproject.toml
Comment thread pyproject.toml
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR raises the minimum supported Python version and modernizes development, documentation, and dependency tooling.

  • Updates documentation, test, and type-check workflows to Python 3.12.
  • Replaces Black and Flake8 Make targets with Poetry-managed Ruff commands.
  • Refreshes runtime and development dependency constraints and regenerates the lock file.
  • Moves typing helpers to the standard library and updates Sphinx configuration.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
pyproject.toml Raises the Python floor to 3.12, updates dependency constraints, adopts Ruff configuration, and switches to the poetry-core build backend.
poetry.lock Regenerates the dependency graph for the new Python floor and updated package constraints.
.github/workflows/docs.yml Correctly updates the documentation workflow to Python 3.12, resolving the previously reported interpreter mismatch.
.github/workflows/test.yml Updates test and type-check jobs to use Python 3.12 and removes obsolete Poetry installer configuration.
Makefile Correctly migrates linting and formatting targets from removed tools to Ruff.
uniswap/decorators.py Uses standard-library typing helpers and applies formatting and unused-variable cleanup without changing decorator behavior.
docs/conf.py Updates the extlinks caption template for current Sphinx requirements.

Reviews (3): Last reviewed commit: "fix(deps): add ruff as explicit dev depe..." | Re-trigger Greptile

- Remove deprecated 'installer.modern-installation' setting (removed in Poetry 2.0)
- Bump docs.yml from Python 3.8 to 3.12 to match the new package floor
  (Python 3.8 + cytoolz 0.12.1 failed to build via Cython under PEP 517)
flake8 and black were removed as direct dependencies in the Python 3.12 dep bump;
the Makefile still referenced them. Ruff already handles both roles.
…ckages

cytoolz 0.12.1, frozenlist 1.3.3, yarl 1.8.2, and multidict 6.0.4 all
declare python-versions=>=3.6 but have no pre-built cp312 wheels, causing
Cython compilation failures when installing under Python 3.12.

Add explicit minimum constraints in pyproject.toml so poetry resolves to
versions that ship cp312 wheels:
- cytoolz >=0.12.3  (locked to 1.1.0)
- frozenlist >=1.5.0  (locked to 1.8.0)
- multidict >=6.0.5  (locked to 6.7.1)
- yarl >=1.10.0  (locked to 1.24.5)

propcache 0.5.2 added as a new transitive dep from yarl 1.24.5.
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI was failing because several transitive Cython packages (cytoolz, frozenlist, yarl, multidict) declared python-versions >= 3.6 in their metadata but shipped no pre-built cp312 wheels. Under Python 3.12 poetry resolved to old versions that then failed to compile from source.

Fixed by adding explicit minimum floors in pyproject.toml so poetry resolves to cp312-wheel-shipping versions:

  • cytoolz >= 0.12.3 → locked to 1.1.0
  • frozenlist >= 1.5.0 → locked to 1.8.0
  • multidict >= 6.0.5 → locked to 6.7.1
  • yarl >= 1.10.0 → locked to 1.24.5 (pulls in propcache 0.5.2 as a new transitive dep)

Lock file regenerated and pushed. CI re-running now.

aiohttp 3.8.4 (transitive via web3) has no cp312 wheels and fails
to build from source on Python 3.12 — PyLongObject.ob_digit was
removed in 3.12. Added aiohttp = ">=3.9.0" (first release with
cp312 wheels) as a direct dependency constraint; poetry re-locked
to 3.14.3 which ships cp312 wheels.

This fixes all 6 failing CI jobs (build + 4 test matrix + typecheck).
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

All Greptile P1 findings now addressed:

Docs workflow Python version — fixed in ed6a6bd: .github/workflows/docs.yml uses Python 3.12 (Sphinx 9 requires it).

Makefile lint/format targets — fixed in cf5d3fe: lint and format targets now invoke ruff instead of the removed black/flake8.

Transitive Cython packages without cp312 wheels — fixed across two commits:

  • 4919e01: added floors for cytoolz ≥0.12.3, frozenlist ≥1.5.0, multidict ≥6.0.5, yarl ≥1.10.0
  • c52ab87: added floor for aiohttp ≥3.9.0 (web3's transitive dep that was locking to 3.8.4, which has no cp312 wheels and fails to compile on Python 3.12 due to the removed PyLongObject.ob_digit field)

Lock file re-generated; CI running now.

….12 CI

Two independent CI failures after the Python 3.12 bump:

- Test/typecheck jobs: eth-keyfile (pulled in via web3->eth-account) still
  imports pkg_resources, which setuptools dropped starting in 82.0.0 (last
  shipped in 81.0.0). eth-account>=0.12 fixes this upstream but requires
  hexbytes>=1.2.0, which conflicts with web3 6.x's hexbytes<0.4.0 pin — that
  needs the (deliberately deferred) web3 7.x migration. Pin setuptools<82 as
  a stopgap; also floor typing-extensions>=4.12.0, since 4.5.0 crashes under
  Python 3.12.13's stricter TypeVar base-class check (docs build failure).

- Docs build: sphinx-book-theme was resolving to 0.0.11 (a 2020-era release,
  incompatible with Sphinx 9's theme API — missing 'get_edit_url'). Floor it
  to ^1.1, which also pulls a compatible pydata-sphinx-theme (0.20.0).
  Along the way, Sphinx 9 hard-fails on the old implicit-%s extlinks caption
  format ("issue #" -> "issue #%s").

Verified locally: full install, docs build (make html), pytest collection
(250 tests), and mypy --pretty all pass in an isolated poetry venv.
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

CI was still failing after the aiohttp fix, from two separate causes:

  1. Test + typecheck jobs: eth-keyfile (pulled in via web3eth-account) still imports pkg_resources, which setuptools dropped starting in 82.0.0 (present through 81.0.0). eth-account>=0.12 fixes this upstream, but it requires hexbytes>=1.2.0, which conflicts with web3 6.x's hexbytes<0.4.0 pin — bridging that needs the (deliberately deferred) web3 7.x migration. Pinned setuptools<82 as a stopgap; also floored typing-extensions>=4.12.0 since 4.5.0 crashes under Python 3.12.13's stricter TypeVar base-class check.

  2. Docs build: sphinx-book-theme was resolving to 0.0.11 (a 2020-era release, incompatible with Sphinx 9's theme API — missing get_edit_url). Floored it to ^1.1, which also pulls a compatible pydata-sphinx-theme (0.20.0). That surfaced one more issue: Sphinx 9 hard-fails on the old implicit-%s extlinks caption format ("issue #""issue #%s").

Verified locally in an isolated poetry venv: full install, make html docs build, pytest collection (250 tests), and mypy --pretty all pass.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.23%. Comparing base (2ef33e2) to head (c9337eb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #473      +/-   ##
==========================================
+ Coverage   73.19%   73.23%   +0.04%     
==========================================
  Files          12       12              
  Lines        2309     2313       +4     
==========================================
+ Hits         1690     1694       +4     
  Misses        619      619              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Makefile lint/format targets call `poetry run ruff` but ruff was
absent from [tool.poetry.dev-dependencies]. A fresh `poetry install`
would succeed without it, making `make lint` fail immediately.

Lock file regenerated with Poetry 2.3.2 / Python 3.12.3.
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Greptile round 2 correctly flagged that ruff was missing from [tool.poetry.dev-dependencies] — the Makefile calls poetry run ruff check and poetry run ruff format, but a fresh poetry install would not pull in ruff, so those targets would fail immediately.

Fixed in c9337eb: added ruff = ">=0.9" to [tool.poetry.dev-dependencies] and regenerated the lock file. CI is running on that head now.

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

@greptileai review

@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Ready to merge — Greptile round 3 returned 5/5 ("The PR appears safe to merge") on head c9337eb. All 6 CI jobs pass (build, test v1–v4 mainnet, typecheck).

What was fixed across the review rounds:

Round Finding Fix
P1 (round 1) Docs workflow used Python 3.8 Bumped to 3.12 (ed6a6bd)
P1 (round 1) Makefile called removed black/flake8 Migrated to ruff check/ruff format (cf5d3fe)
CI post-round-1 Transitive pkg_resources import crash under setuptools ≥82 Pinned setuptools<82, floored typing-extensions>=4.12.0 (dbe07bf)
CI post-round-1 sphinx-book-theme resolved to 2020-era release incompatible with Sphinx 9 Floored to ^1.1 (dbe07bf)
P1 (round 2) ruff invoked by Makefile but absent from dev dependencies Added ruff = ">=0.9" to dev deps (c9337eb)

No blocking findings remain. Deferred item still in scope: web3 7.x upgrade (async-first rewrite, deliberately left for a separate PR per the original description).

@ErikBjare
ErikBjare merged commit dee6a77 into uniswap-python:master Jul 29, 2026
7 checks passed
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