From 22decc1656762a3d62fd165fd6a9c69fed96f06f Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 9 Jan 2025 10:26:45 -0600 Subject: [PATCH] refactor: migrate ape-config.yaml to pyproject.toml (#117) Co-authored-by: antazoey --- .gitignore | 1 + ape-config.yaml | 42 --------------- bots/example.py | 4 +- pyproject.toml | 104 ++++++++++++++++++++++++++---------- sdk/py/apepay/exceptions.py | 2 +- 5 files changed, 79 insertions(+), 74 deletions(-) delete mode 100644 ape-config.yaml diff --git a/.gitignore b/.gitignore index 89c2c95..3c59a92 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ sdk/py/apepay/version.py __pycache__ .hypothesis dist/ +*.egg-info # Javascript node_modules/ diff --git a/ape-config.yaml b/ape-config.yaml deleted file mode 100644 index 875fb12..0000000 --- a/ape-config.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: ApePay - -plugins: - - name: arbitrum - - name: optimism - - name: foundry - - name: vyper - -compile: - output_extra: - - ABI # Output individial ABIs for the frontend. - -ethereum: - local: - default_provider: foundry - -deployments: - ethereum: - sepolia: &releases - - contract_type: StreamFactory - address: 0x92823EB2DB42b8df354EDB5A1FB3668057e2935D - salt: "ApePay v0.3" - - - contract_type: StreamManager - address: 0x6A1aa538ebB85Fd98655eCEe5EaB7D9cb3cbCD2B - salt: "ApePay v0.3" - blueprint: true - - arbitrum: - mainnet: *releases - optimism: - mainnet: *releases - -test: - gas: - exclude: &exclude-mocks - - contract_name: Test* - coverage: - exclude: *exclude-mocks - reports: - terminal: - verbose: true diff --git a/bots/example.py b/bots/example.py index dd33469..bd4c79b 100644 --- a/bots/example.py +++ b/bots/example.py @@ -23,7 +23,7 @@ async def load_db(_): @sm.on_stream_created(app) async def grant_product(stream): db[stream.id] = stream - print(f"provisioning products: {stream.products}") + print(f"provisioning products: {stream.products}") # noqa: T001 return stream.time_left @@ -37,6 +37,6 @@ async def update_product_funding(stream): @sm.on_stream_cancelled(app) async def revoke_product(stream): - print(f"unprovisioning product for {stream.creator}") + print(f"unprovisioning product for {stream.creator}") # noqa: T001 db[stream.id] = None return stream.time_left diff --git a/pyproject.toml b/pyproject.toml index 986e8b9..ad2d8c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,56 +1,102 @@ [build-system] -requires = [ "setuptools>=64", "setuptools_scm>=8" ] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] name = "apepay" -dynamic = [ "version" ] +dynamic = ["version"] description = "Python SDK for ApePay" -authors = [ - {name = "ApeWorX LTD", email = "admin@apeworx.io"}, -] +authors = [{ name = "ApeWorX LTD", email = "admin@apeworx.io" }] license = { text = "Apache 2.0" } readme = "README.md" requires-python = ">=3.10,<4" -dependencies = [ - "eth-ape>=0.8,<1", - "pydantic>=2.7,<3", - # NOTE: Pinning issue w/ Ape - "eth-typing<5", -] +dependencies = ["eth-ape>=0.8.24,<1", "pydantic>=2.7,<3"] [project.optional-dependencies] -bot = [ - "silverback>=0.5,<1", -] +bot = ["silverback>=0.5,<1"] lint = [ - "flake8", - "black", - "isort", - "mypy", - # NOTE: Be able to lint our silverback add-ons - "apepay[bot]" -] -test = [ - "ape-foundry", -] -dev = [ - "apepay[bot,lint,test]" + "flake8", + "black", + "isort", + "mypy", + # NOTE: Be able to lint our silverback add-ons + "apepay[bot]", ] +test = ["ape-foundry"] +dev = ["apepay[bot,lint,test]"] [tool.setuptools.packages.find] -where = [ "sdk/py" ] +where = ["sdk/py"] [tool.setuptools.package-data] -apepay = [ "manifest.json", "py.typed" ] +apepay = ["manifest.json", "py.typed"] [tool.setuptools_scm] # NOTE: Config entry needed for this plugin to function +[tool.ape] +name = "ApePay" + +plugins = [ + { name = "arbitrum" }, + { name = "optimism" }, + { name = "foundry" }, + { name = "vyper" }, +] + +[tool.ape.compile] +output_extra = ["ABI"] + +[tool.ape.ethereum.local] +default_provider = "foundry" + +[tool.ape.deployments.ethereum] +[[tool.ape.deployments.ethereum.sepolia]] +contract_type = "StreamFactory" +address = "0x92823EB2DB42b8df354EDB5A1FB3668057e2935D" +salt = "ApePay v0.3" + +[[tool.ape.deployments.ethereum.sepolia]] +contract_type = "StreamManager" +address = "0x6A1aa538ebB85Fd98655eCEe5EaB7D9cb3cbCD2B" +salt = "ApePay v0.3" +blueprint = true + +[[tool.ape.deployments.arbitrum.mainnet]] +contract_type = "StreamFactory" +address = "0x92823EB2DB42b8df354EDB5A1FB3668057e2935D" +salt = "ApePay v0.3" + +[[tool.ape.deployments.arbitrum.mainnet]] +contract_type = "StreamManager" +address = "0x6A1aa538ebB85Fd98655eCEe5EaB7D9cb3cbCD2B" +salt = "ApePay v0.3" +blueprint = true + +[[tool.ape.deployments.optimism.mainnet]] +contract_type = "StreamFactory" +address = "0x92823EB2DB42b8df354EDB5A1FB3668057e2935D" +salt = "ApePay v0.3" + +[[tool.ape.deployments.optimism.mainnet]] +contract_type = "StreamManager" +address = "0x6A1aa538ebB85Fd98655eCEe5EaB7D9cb3cbCD2B" +salt = "ApePay v0.3" +blueprint = true + +[[tool.ape.test.gas.exclude]] +contract_name = "Test*" + +[[tool.ape.test.coverage.exclude]] +contract_name = "Test*" + +[tool.ape.test.coverage.reports.terminal] +verbose = true + [tool.black] line-length = 100 -target-version = [ "py311" ] +target-version = ["py311"] include = '\.pyi?$' exclude = 'node_modules|migrations|build/|buck-out/|dist/|_build/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/' diff --git a/sdk/py/apepay/exceptions.py b/sdk/py/apepay/exceptions.py index b91c4ff..937a8b7 100644 --- a/sdk/py/apepay/exceptions.py +++ b/sdk/py/apepay/exceptions.py @@ -33,7 +33,7 @@ def __init__(self): class NotEnoughAllowance(ApePayException, ValueError): def __init__(self, manager: AddressType): - super().__init__(f"Not enough allownace, please approve {manager}") + super().__init__(f"Not enough allowance, please approve {manager}") class StreamLifeInsufficient(ApePayException, ValueError):