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
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]
Comment thread
TimeToBuildBob marked this conversation as resolved.
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 = "*"
Comment thread
TimeToBuildBob marked this conversation as resolved.
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