Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from setuptools to hatch #1085

Merged
merged 7 commits into from
Jun 10, 2024
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/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,7 +93,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
- name: Deploy Package
run: |
python -m pip install --upgrade build twine
Expand Down
1 change: 1 addition & 0 deletions gnosis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "6.0.0b30"
2 changes: 1 addition & 1 deletion gnosis/eth/contracts/contract_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(
address: ChecksumAddress,
ethereum_client: "EthereumClient", # noqa F821
*args,
**kwargs
**kwargs,
):
self.address = address
self.ethereum_client = ethereum_client
Expand Down
2 changes: 1 addition & 1 deletion gnosis/eth/django/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
133 changes: 133 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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}"

[tool.coverage.run]
include = ["gnosis/*"]
# source_pkgs = ["gnosis", "tests"]
branch = true
parallel = true
omit = [
"*__init__.py*",
"*tests*",
"*/migrations/*",
]

#[tool.coverage.paths]
#prueba = ["src/gnosis", "*/gnosis/src/gnosis"]
#tests = ["tests", "*/gnosis/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"
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-r requirements-test.txt
flake8
gitpython
hatch
ipdb
ipython
isort
Expand Down
105 changes: 0 additions & 105 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/*
4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

Loading