diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8d8f58ea3..23e200c51 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -61,8 +61,7 @@ jobs: cache: 'pip' cache-dependency-path: 'requirements*.txt' - name: Install dependencies - run: | - pip install wheel setuptools + run: pip install -r requirements-test.txt coveralls env: PIP_USE_MIRRORS: true diff --git a/gnosis/__init__.py b/gnosis/__init__.py index e69de29bb..5870d77af 100644 --- a/gnosis/__init__.py +++ b/gnosis/__init__.py @@ -0,0 +1 @@ +VERSION = "6.0.0b30" diff --git a/gnosis/eth/contracts/contract_base.py b/gnosis/eth/contracts/contract_base.py index 084c21a36..c5ce5ccb3 100644 --- a/gnosis/eth/contracts/contract_base.py +++ b/gnosis/eth/contracts/contract_base.py @@ -16,7 +16,7 @@ def __init__( address: ChecksumAddress, ethereum_client: "EthereumClient", # noqa F821 *args, - **kwargs + **kwargs, ): self.address = address self.ethereum_client = ethereum_client diff --git a/gnosis/eth/django/serializers.py b/gnosis/eth/django/serializers.py index d24ce250c..b85256bd3 100644 --- a/gnosis/eth/django/serializers.py +++ b/gnosis/eth/django/serializers.py @@ -32,7 +32,7 @@ def __init__( self, allow_zero_address: bool = False, allow_sentinel_address: bool = False, - **kwargs + **kwargs, ): self.allow_zero_address = allow_zero_address self.allow_sentinel_address = allow_sentinel_address diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..2453b0f76 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,133 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "safe-eth-py" +dynamic = ["version"] +description = "Safe Ecosystem Foundation utilities for Ethereum projects" +readme = "README.rst" +license = "MIT" +requires-python = ">=3.9" +authors = [ + { name = "Uxío", email = "uxio@safe.global" }, +] +keywords = [ + "cowswap", + "django", + "ethereum", + "gnosis", + "safe", + "web3", +] +classifiers = [ + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 2.0", + "Framework :: Django :: 3.0", + "Framework :: Django :: 4.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: Dynamic Content", +] +dependencies = [ + "packaging", + "py-evm>=0.7.0a1", + "requests>=2", + "safe-pysha3>=1.0.0", + "web3>=6.2.0", +] + +[project.optional-dependencies] +django = [ + "django-filter>=2", + "django>=2", + "djangorestframework>=2", +] + +[project.urls] +Documentation = "https://safe-eth-py.readthedocs.io/en/latest/" +Homepage = "https://github.com/safe-global/safe-eth-py" +Source = "https://github.com/safe-global/safe-eth-py" +Tracker = "https://github.com/safe-global/safe-eth-py/issues" + +[tool.hatch.version] +path = "gnosis/__init__.py" + +[tool.hatch.envs.types] +extra-dependencies = [ + "mypy>=1.0.0", +] + +[tool.hatch.envs.types.scripts] +check = "mypy --install-types --non-interactive {args:gnosis tests}" + +[tool.coverage.run] +include = ["gnosis/*"] +# source_pkgs = ["prueba", "tests"] +branch = true +parallel = true +omit = [ + "*__init__.py*", + "*tests*", + "*/migrations/*", +] + +#[tool.coverage.paths] +#prueba = ["src/prueba", "*/prueba/src/prueba"] +#tests = ["tests", "*/prueba/tests"] + +[tool.coverage.report] +exclude_lines = [ + "no cov", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", + "if settings.DEBUG", + "raise NotImplementedError", + "pass", +] + +[tool.hatch.build.targets.sdist] +include = [ + "/gnosis", +] + +[tool.hatch.build.targets.wheel] +packages = [ + "/gnosis", +] + +[tool.isort] +profile = "black" +default_section = "THIRDPARTY" +known_first_party = "gnosis" +known_safe_foundation = "py_eth_sig_utils" +known_django = "django" +sections = [ + "FUTURE", + "STDLIB", + "DJANGO", + "THIRDPARTY", + "SAFE_FOUNDATION", + "FIRSTPARTY", + "LOCALFOLDER", +] + +[tool.mypy] +python_version = "3.12" +check_untyped_defs = true +ignore_missing_imports = true +warn_unused_ignores = true +warn_redundant_casts = true +warn_unused_configs = true + +[tool.pytest_env] +DJANGO_SETTINGS_MODULE = "config.settings.test" diff --git a/requirements-dev.txt b/requirements-dev.txt index 1047b1070..727660a00 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,7 @@ -r requirements-test.txt flake8 gitpython +hatch ipdb ipython isort diff --git a/setup.cfg b/setup.cfg index 1100b99b5..a391c7063 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,66 +1,3 @@ -[metadata] -name = safe-eth-py -version = 6.0.0b30 -description = Safe Ecosystem Foundation utilities for Ethereum projects -long_description = file: README.rst -long_description_content_type = text/x-rst; charset=UTF-8 -keywords = - ethereum - web3 - django - safe - cowswap - gnosis -url = https://github.com/safe-global/safe-eth-py -author = Uxío -author_email = uxio@safe.global -license = MIT License -license_files = - LICENSE -classifiers = - Environment :: Web Environment - Framework :: Django - Framework :: Django :: 2.0 - Framework :: Django :: 3.0 - Framework :: Django :: 4.0 - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Internet :: WWW/HTTP - Topic :: Internet :: WWW/HTTP :: Dynamic Content -project_urls = - Documentation = https://safe-eth-py.readthedocs.io/en/latest/ - Source = https://github.com/safe-global/safe-eth-py - Tracker = https://github.com/safe-global/safe-eth-py/issues - -[options] -packages = find: -platforms = any -include_package_data = True -install_requires = - packaging - py-evm>=0.7.0a1 - safe-pysha3>=1.0.0 - requests>=2 - web3>=6.2.0 -python_requires = >=3.9 - -[options.package_data] -gnosis = - py.typed - *.json - -[options.extras_require] -django = - django>=2 - django-filter>=2 - djangorestframework>=2 - [flake8] max-line-length = 88 select = C,E,F,W,B,B950 @@ -70,45 +7,3 @@ exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv [pycodestyle] max-line-length = 120 exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv - -[isort] -profile = black -default_section = THIRDPARTY -known_first_party = gnosis -known_gnosis = py_eth_sig_utils -known_django = django -sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,GNOSIS,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -env = - DJANGO_SETTINGS_MODULE=config.settings.test - -[mypy] -python_version = 3.10 -check_untyped_defs = True -ignore_missing_imports = True -warn_unused_ignores = True -warn_redundant_casts = True -warn_unused_configs = True - -[coverage:report] -exclude_lines = -# Have to re-enable the standard pragma - pragma: no cover - - # Don't complain if tests don't hit defensive assertion code: - raise NotImplementedError - - # Don't complain if non-runnable code isn't run: - if __name__ == .__main__.: - if settings.DEBUG - - # Ignore pass lines - pass - -[coverage:run] -include = safe_transaction_service/* -omit = - *__init__.py* - *tests* - */migrations/* diff --git a/setup.py b/setup.py deleted file mode 100644 index 1abbd068c..000000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -import setuptools - -if __name__ == "__main__": - setuptools.setup()