diff --git a/pyproject.toml b/pyproject.toml index f343a3a8a..18fb92446 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,65 @@ [build-system] -requires = ["setuptools>=61", "cffi>=1.3.0", "requests"] +requires = ["setuptools>=61", "cffi>=1.3.0", "requests", "setuptools-scm", 'asn1crypto'] build-backend = "setuptools.build_meta" +[project] +name = "coincurve" +authors = [ + { name="Ofek Lev", email="oss@ofek.dev" }, +] +description = "Cross-platform Python CFFI bindings for libsecp256k1" +keywords = ["secp256k1", "crypto", "elliptic curves", "bitcoin", "ethereum", "cryptocurrency"] +requires-python = ">=3.8" +dependencies = [ + "asn1crypto", + "cffi>=1.3.0" +] +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + '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', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries', + 'Topic :: Security :: Cryptography', +] +dynamic = ['version', 'readme'] + +[project.optional-dependencies] +dev = [ + "coverage", + "pytest", + "pytest-benchmark" +] + +[project.urls] +Homepage = "https://github.com/ofek/coincurve" +Documentation = "https://ofek.dev/coincurve/" +Repository = "https://github.com/ofek/coincurve" +"Bug Tracker" = "https://github.com/ofek/coincurve/issues" + +# --- setuptools --- +[tool.setuptools] +packages = ['coincurve'] +package-dir = {'' = 'src'} +package-data = {'coincurve' = ['py.typed']} + +[tool.setuptools.dynamic] +version = {attr = "coincurve._version.__version__"} +readme = {content-type = "text/markdown", file = "README.md"} + +# --- hatch --- + [tool.pytest.ini_options] addopts = [ "--import-mode=importlib", diff --git a/setup.py b/setup.py index a6961a0f7..e8be50b66 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from os.path import join from sys import path as PATH -from setuptools import Distribution as _Distribution, setup, __version__ as setuptools_version +from setuptools import Distribution as _Distribution, setup from setuptools.extension import Extension # Define the package root directory and add it to the system path @@ -25,18 +25,6 @@ LIB_TARBALL_URL = f'https://github.com/bitcoin-core/secp256k1/archive/{UPSTREAM_REF}.tar.gz' -globals_ = {} -with open(join(COINCURVE_ROOT_DIR, 'src', 'coincurve', '_version.py')) as fp: - exec(fp.read(), globals_) # noqa S102 - __version__ = globals_['__version__'] - -# We require setuptools >= 3.3 -if [int(i) for i in setuptools_version.split('.', 2)[:2]] < [3, 3]: - raise SystemExit( - f'Your setuptools version ({setuptools_version}) is too old to correctly install this package. Please upgrade ' - f'to a newer version (>= 3.3).' - ) - LIB_NAME = 'libsecp256k1' PKG_NAME = 'coincurve' @@ -82,55 +70,8 @@ def main(): ) setup( - name='coincurve', - version=__version__, - - description='Cross-platform Python CFFI bindings for libsecp256k1', - long_description=open('README.md', 'r').read(), - long_description_content_type='text/markdown', - author_email='Ofek Lev ', - license='MIT OR Apache-2.0', - - python_requires='>=3.8', - install_requires=['asn1crypto', 'cffi>=1.3.0'], - - packages=['coincurve'], - package_dir={'coincurve': 'src/coincurve'}, - distclass=Distribution, zip_safe=False, - - project_urls={ - 'Documentation': 'https://ofek.dev/coincurve/', - 'Issues': 'https://github.com/ofek/coincurve/issues', - 'Source': 'https://github.com/ofek/coincurve', - }, - keywords=[ - 'secp256k1', - 'crypto', - 'elliptic curves', - 'bitcoin', - 'ethereum', - 'cryptocurrency', - ], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - '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', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries', - 'Topic :: Security :: Cryptography', - ], **setup_kwargs )