Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4c42f1f
V4 support (#418)
liquid-8 Jul 28, 2026
4542f83
docs: update README with v4 support — remove stale CTA, add to Suppor…
TimeToBuildBob Jul 28, 2026
de275ed
docs: v4 narrative guide, v2/v3 examples, and runnable example tests …
TimeToBuildBob Jul 28, 2026
2ef33e2
refactor(tests): replace ganache with anvil for v1–v3 tests (#472)
TimeToBuildBob Jul 28, 2026
e771a29
fix: avoid duplicate WETH in swap path when input/output is WETH (clo…
botbikamordehai2-sketch Jul 29, 2026
dee6a77
build(deps): bump minimum Python to 3.12, update deps, drop typed_ast…
TimeToBuildBob Jul 29, 2026
dc31cca
Merge branch 'master' of https://github.com/uniswap-python/uniswap-py…
liquid-8 Jul 30, 2026
bdd2dfd
Merge pull request #2 from liquid-8/uniswap-python-master
liquid-8 Jul 30, 2026
8a52b4c
Merge branch 'uniswap4_RC' into master_sync
liquid-8 Jul 30, 2026
c6cd59c
Merge pull request #3 from liquid-8/master_sync
liquid-8 Jul 30, 2026
56ba3eb
docs: disclose project funding history in README (#476)
ErikBjare Aug 5, 2026
bc8fdf4
fix(deps): bump lru-dict to 1.2.0 in lockfile for Python 3.13 (#475)
ErikBjare Aug 5, 2026
c95bf09
Merge branch 'uni_v4_final' of https://github.com/liquid-8/uniswap-py…
liquid-8 Sep 2, 2026
e178519
Deps: web3py bump to 8.0.0; codebase migration;
liquid-8 Sep 28, 2026
2837957
Review fixes; check_approval support dropped.
liquid-8 Oct 1, 2026
2bfdece
v2 multihop fix
liquid-8 Oct 1, 2026
36f1fcc
missed part
liquid-8 Oct 1, 2026
84476b5
contructor fix
liquid-8 Oct 1, 2026
abf554c
sync version constructor fix
liquid-8 Oct 2, 2026
c91a37a
Migration fixes
liquid-8 Oct 2, 2026
a3542d3
v4 test_get_position_info() fix
liquid-8 Oct 2, 2026
3154149
Drop v1 tests; adds v2-v3 manual approve tests; multihop logic fix
liquid-8 Oct 2, 2026
743752f
Some more migration fix
liquid-8 Oct 2, 2026
90ee9a2
Adds async tests; async pool discovery
liquid-8 Oct 5, 2026
05105bd
Update dependencies
liquid-8 Oct 5, 2026
2728fb3
fix
liquid-8 Oct 5, 2026
0952b7c
review fix
liquid-8 Oct 5, 2026
f9c2e6c
async _build_and_send() migration fix
liquid-8 Oct 5, 2026
4783ea8
Fix async get_minted_token_id()
liquid-8 Oct 5, 2026
b5e0ce5
fix test.yml ; fix balance condition in make_swap() tests
liquid-8 Oct 5, 2026
6617a1f
fix async make_trade()/make_trade_output() routing
liquid-8 Oct 5, 2026
7a54246
Add async pools discovery export; restote pool discovery tests;
liquid-8 Oct 6, 2026
dda8f9a
fix missed parameterization
liquid-8 Oct 6, 2026
5c7affb
test params optimization; async pools discovery logs fetching fix
liquid-8 Oct 6, 2026
76374d4
fixes v3 multihop ETH swaps
liquid-8 Oct 6, 2026
403bd96
v2 mutihop ETH fix
liquid-8 Oct 6, 2026
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
Prev Previous commit
Next Next commit
build(deps): bump minimum Python to 3.12, update deps, drop typed_ast (…
…#473)

* build(deps): bump Python to 3.12, drop typed_ast and ruff-replaced linters

- 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).

* ci: fix Poetry 2.x compat and bump docs to Python 3.12

- 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)

* fix(makefile): replace flake8/black with ruff lint/format targets

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.

* fix(deps): add explicit floors for Python 3.12-incompatible Cython packages

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.

* fix(deps): add aiohttp floor to unblock Python 3.12 CI

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).

* fix(deps): pin setuptools<82 and bump doc theme versions for Python 3.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.

* fix(deps): add ruff as explicit dev dependency

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.
  • Loading branch information
TimeToBuildBob authored Jul 29, 2026
commit dee6a778ccac19c8231792aa81612068dfbadc54
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry
poetry config installer.modern-installation false
poetry install
- name: Docs
run: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'
# Set up poetry cache, from https://github.com/python-poetry/poetry/blob/45a9b8f20384591d0a33ae876bcf23656f928ec0/.github/workflows/main.yml
- name: Get full python version
id: full-python-version
Expand All @@ -51,7 +51,6 @@ jobs:
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.in-project true
poetry config installer.modern-installation false

- name: Set up cache
uses: actions/cache@v4
Expand Down Expand Up @@ -94,7 +93,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.12'

# Set up poetry cache, from https://github.com/python-poetry/poetry/blob/45a9b8f20384591d0a33ae876bcf23656f928ec0/.github/workflows/main.yml
- name: Get full python version
Expand All @@ -107,7 +106,6 @@ jobs:
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.in-project true
poetry config installer.modern-installation false

- name: Set up cache
uses: actions/cache@v4
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ typecheck:
poetry run mypy --pretty

lint:
poetry run flake8
poetry run ruff check uniswap

format:
black uniswap
poetry run ruff format uniswap

format-abis:
npx prettier --write --parser=json uniswap/assets/*/*.abi
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

extlinks = {
"issue": ("https://github.com/shanefontaine/uniswap-python/issues/%s", "issue #"),
"issue": ("https://github.com/shanefontaine/uniswap-python/issues/%s", "issue #%s"),
}


Expand Down
2,006 changes: 1,063 additions & 943 deletions poetry.lock

Large diffs are not rendered by default.

34 changes: 21 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,40 @@ classifiers = [
unipy = "uniswap:main"

[tool.poetry.dependencies]
python = "^3.7.2"
web3 = { version = "^6.5.0", allow-prereleases = true }
click = "^8.0.3"
python = "^3.12"
web3 = ">=6.20.0,<7"
cytoolz = ">=0.12.3"
frozenlist = ">=1.5.0"
multidict = ">=6.0.5"
yarl = ">=1.10.0"
click = "^8"
python-dotenv = "*"
typing-extensions = "*"
aiohttp = ">=3.9.0"
typing-extensions = ">=4.12.0"
# eth-keyfile (via web3->eth-account) imports pkg_resources, which setuptools
# dropped in 82.0.0 (last shipped in 81.0.0). Pin below that until web3 7.x
# (which pulls in a pkg_resources-free eth-keyfile) is adopted.
setuptools = "<82"

[tool.poetry.dev-dependencies]
mypy = "*"
black = "*"
pre-commit = "*"
pytest = "^6.0"
pytest = "^8"
pytest-cov = "*"
pytest-dotenv = "*"
flake8 = "*"
Sphinx = "*"
sphinx-book-theme = "*"
ruff = ">=0.9"
Sphinx = "^9"
sphinx-book-theme = "^1.1"
sphinx-click = "*"
pydata-sphinx-theme = "0.13.1" # due to: https://github.com/executablebooks/sphinx-book-theme/issues/711
pydata-sphinx-theme = "*"

[tool.pytest.ini_options]
log_cli = false # to print logs during tests, set to true
#log_level = "NOTSET"

[tool.ruff]
[tool.ruff.lint]
ignore = ["E402", "E501"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0"]
build-backend = "poetry.core.masonry.api"
16 changes: 7 additions & 9 deletions uniswap/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from typing import (
TYPE_CHECKING,
Callable,
Concatenate,
List,
Optional,
ParamSpec,
TypeVar,
)

from typing_extensions import Concatenate, ParamSpec

from .constants import ETH_ADDRESS
from .types import AddressLike

Expand All @@ -21,7 +21,7 @@


def check_approval(
method: Callable[Concatenate["Uniswap", P], T]
method: Callable[Concatenate["Uniswap", P], T],
) -> Callable[Concatenate["Uniswap", P], T]:
"""Decorator to check if user is approved for a token. It approves them if they
need to be approved."""
Expand All @@ -30,11 +30,11 @@ def check_approval(
def approved(self: "Uniswap", *args: P.args, **kwargs: P.kwargs) -> T:
# Check to see if the first token is actually ETH
token: Optional[AddressLike] = args[0] if args[0] != ETH_ADDRESS else None # type: ignore
token_two = None
_token_two = None

# Check second token, if needed
if method.__name__ == "make_trade" or method.__name__ == "make_trade_output":
token_two = args[1] if args[1] != ETH_ADDRESS else None
_token_two = args[1] if args[1] != ETH_ADDRESS else None

# Approve both tokens, if needed
if token:
Expand All @@ -53,15 +53,13 @@ def supports(
[Callable[Concatenate["Uniswap", P], T]], Callable[Concatenate["Uniswap", P], T]
]:
def g(
f: Callable[Concatenate["Uniswap", P], T]
f: Callable[Concatenate["Uniswap", P], T],
) -> Callable[Concatenate["Uniswap", P], T]:
if f.__doc__ is None:
f.__doc__ = ""
f.__doc__ += """\n\n
Supports Uniswap
""" + ", ".join(
"v" + str(ver) for ver in versions
)
""" + ", ".join("v" + str(ver) for ver in versions)

@functools.wraps(f)
def check_version(self: "Uniswap", *args: P.args, **kwargs: P.kwargs) -> T:
Expand Down
Loading