From e4d2c6cc9543d735fdebf9892c7378d14923da8d Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sat, 1 Jun 2024 14:10:42 -0400 Subject: [PATCH] cleanup --- .gitignore | 2 - MANIFEST.in | 7 -- pyproject.toml | 216 ++++++++++++++++++++++++------------------------- 3 files changed, 108 insertions(+), 117 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.gitignore b/.gitignore index f798a9f06..d2fb67df1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,3 @@ /build /dist /site - -/src/coincurve/_version.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 341646d59..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include src/coincurve/py.typed -include CMakeLists.txt -recursive-include cmake * -recursive-include cm_library_c_binding * -recursive-include cm_library_cffi_headers * -recursive-include cm_vendored_library * -recursive-include cm_python_bindings * diff --git a/pyproject.toml b/pyproject.toml index f59f38499..6ba593b09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,172 +1,172 @@ [build-system] requires = [ - 'scikit-build-core>=0.9.0', - 'hatchling', - 'setuptools>=42.0.0', - 'cffi>=1.3.0', - 'pypkgconf; sys_platform == "win32"', + "scikit-build-core>=0.9.0", + "hatchling", + "setuptools>=42.0.0", + "cffi>=1.3.0", + "pypkgconf; sys_platform == 'win32'", ] -build-backend = 'hatchling.build' +build-backend = "hatchling.build" [project] -name = 'coincurve' +name = "coincurve" authors = [ - { name='Ofek Lev', email='oss@ofek.dev' }, + { name = "Ofek Lev", email = "oss@ofek.dev" }, ] -description = 'Cross-platform Python CFFI bindings for libsecp256k1' -keywords = ['secp256k1', 'crypto', 'elliptic curves', 'bitcoin', 'ethereum', 'cryptocurrency'] -readme = {"file" = "README.md", "content-type" = "text/markdown"} -requires-python = '>=3.8' +description = "Cross-platform Python CFFI bindings for libsecp256k1" +keywords = ["secp256k1", "crypto", "elliptic curves", "bitcoin", "ethereum", "cryptocurrency"] +readme = "README.md" +requires-python = ">=3.8" dependencies = [ - 'asn1crypto', - 'cffi>=1.3.0', + "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', + "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'] +dynamic = ["version"] [project.optional-dependencies] dev = [ - 'coverage', - 'pytest', - 'pytest-benchmark' + "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' +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" # --- hatch --- [tool.hatch.version] -path = 'src/coincurve/__about__.py' +path = "src/coincurve/__about__.py" [tool.hatch.build.targets.sdist] ignore-vcs = true include = [ - 'src', - 'tests', - 'README.md', - 'LICENSE', - 'CHANGELOG.md', - 'CMakeLists.txt', - 'pyproject.toml', - 'setup.cfg', - 'setup.py', - 'MANIFEST.in', - 'cmake', + "src", + "tests", + "README.md", + "LICENSE", + "CHANGELOG.md", + "CMakeLists.txt", + "pyproject.toml", + "setup.cfg", + "setup.py", + "MANIFEST.in", + "cmake", "cm_*", ] exclude = [ - '/.benchmarks', - '/.conda', - '/.github', - '/.git*', - '/.idea', - '/.tox', - '/.eggs', + "/.benchmarks", + "/.conda", + "/.github", + "/.git*", + "/.idea", + "/.tox", + "/.eggs", ] [tool.hatch.build.targets.wheel.hooks.scikit-build] experimental = true cmake.verbose = true -cmake.build-type = 'Release' -cmake.source-dir = '.' -wheel.py-api = '' +cmake.build-type = "Release" +cmake.source-dir = "." +wheel.py-api = "" wheel.packages = [] # wheel.install-dir = "hatchling_example" # --- scikit-build-core --- [tool.scikit-build.cmake.define] -CMAKE_BUILD_TYPE = 'Release' +CMAKE_BUILD_TYPE = "Release" # Coincurve build options - This may be better extracted from the ENV by the CMake directly? -PROJECT_IGNORE_SYSTEM_LIB = {env='COINCURVE_IGNORE_SYSTEM_LIB', default='ON'} -PROJECT_CROSS_COMPILE_TARGET = {env='COINCURVE_CROSS_HOST', default=''} +PROJECT_IGNORE_SYSTEM_LIB = { env = "COINCURVE_IGNORE_SYSTEM_LIB", default = "ON" } +PROJECT_CROSS_COMPILE_TARGET = { env = "COINCURVE_CROSS_HOST", default = "" } # Vendored library: SECP256K1 -VENDORED_LIBRARY_CMAKE_TARGET = 'secp256k1' -VENDORED_LIBRARY_PKG_CONFIG = 'libsecp256k1' -VENDORED_LIBRARY_PKG_CONFIG_VERSION = '0.4.1' -VENDORED_UPSTREAM_URL = 'https://github.com/bitcoin-core/secp256k1/archive/' -VENDORED_UPSTREAM_REF = {env='COINCURVE_UPSTREAM_REF', default='1ad5185cd42c0636104129fcc9f6a4bf9c67cc40'} -VENDORED_UPSTREAM_SHA = {env='COINCURVE_UPSTREAM_SHA', default='ba34be4319f505c5766aa80b99cfa696cbb2993bfecf7d7eb8696106c493cb8c'} +VENDORED_LIBRARY_CMAKE_TARGET = "secp256k1" +VENDORED_LIBRARY_PKG_CONFIG = "libsecp256k1" +VENDORED_LIBRARY_PKG_CONFIG_VERSION = "0.4.1" +VENDORED_UPSTREAM_URL = "https://github.com/bitcoin-core/secp256k1/archive/" +VENDORED_UPSTREAM_REF = { env = "COINCURVE_UPSTREAM_REF", default = "1ad5185cd42c0636104129fcc9f6a4bf9c67cc40" } +VENDORED_UPSTREAM_SHA = { env = "COINCURVE_UPSTREAM_SHA", default = "ba34be4319f505c5766aa80b99cfa696cbb2993bfecf7d7eb8696106c493cb8c" } # SECP256K1 library specific build options # `VENDORED_OPTION` is reserved prefix for vendored library build options -VENDORED_LIBRARY_OPTION_PREFIX = 'SECP256K1' -VENDORED_OPTION_DISABLE_SHARED = {env='COINCURVE_SECP256K1_STATIC', default='ON'} -VENDORED_OPTION_BUILD_BENCHMARK='OFF' -VENDORED_OPTION_BUILD_TESTS='OFF' -VENDORED_OPTION_BUILD_CTIME_TESTS='OFF' -VENDORED_OPTION_BUILD_EXHAUSTIVE_TESTS='OFF' -VENDORED_OPTION_BUILD_EXAMPLES='OFF' -VENDORED_OPTION_ENABLE_MODULE_ECDH='ON' -VENDORED_OPTION_ENABLE_MODULE_RECOVERY='ON' -VENDORED_OPTION_ENABLE_MODULE_SCHNORRSIG='ON' -VENDORED_OPTION_ENABLE_MODULE_EXTRAKEYS='ON' -VENDORED_OPTION_EXPERIMENTAL='ON' +VENDORED_LIBRARY_OPTION_PREFIX = "SECP256K1" +VENDORED_OPTION_DISABLE_SHARED = { env = "COINCURVE_SECP256K1_STATIC", default = "ON" } +VENDORED_OPTION_BUILD_BENCHMARK = "OFF" +VENDORED_OPTION_BUILD_TESTS = "OFF" +VENDORED_OPTION_BUILD_CTIME_TESTS = "OFF" +VENDORED_OPTION_BUILD_EXHAUSTIVE_TESTS = "OFF" +VENDORED_OPTION_BUILD_EXAMPLES = "OFF" +VENDORED_OPTION_ENABLE_MODULE_ECDH = "ON" +VENDORED_OPTION_ENABLE_MODULE_RECOVERY = "ON" +VENDORED_OPTION_ENABLE_MODULE_SCHNORRSIG = "ON" +VENDORED_OPTION_ENABLE_MODULE_EXTRAKEYS = "ON" +VENDORED_OPTION_EXPERIMENTAL = "ON" # Vendored library build options (cmake, compiler, linker, etc.) # VENDORED_CMAKE is reserved prefix for vendored library cmake options # VENDORED_CMAKE__ = -VENDORED_LIBRARY_STATIC_BUILD = {env='COINCURVE_SECP256K1_STATIC', default='ON'} +VENDORED_LIBRARY_STATIC_BUILD = { env = "COINCURVE_SECP256K1_STATIC", default = "ON" } # --- Coverage --- [tool.coverage.run] branch = true source = [ - 'src/coincurve', - 'tests', + "src/coincurve", + "tests", ] omit = [ - '*/_version.py', - '*/test_bench.py', + "*/_version.py", + "*/test_bench.py", ] [tool.coverage.report] exclude_lines =[ - 'no cov', - 'no qa', + "no cov", + "no qa", # Ignore missing debug-only code - 'def __repr__', - 'if self\.debug', + "def __repr__", + "if self\\.debug", # Ignore non-runnable code - 'if __name__ == .__main__.:', + "if __name__ == .__main__.:", ] [tool.coverage.paths] source = [ - 'src/coincurve', - '.tox/*/lib/python*/site-packages/coincurve', - '.tox/pypy*/site-packages/coincurve', + "src/coincurve", + ".tox/*/lib/python*/site-packages/coincurve", + ".tox/pypy*/site-packages/coincurve", ] # --- Pytest --- [tool.pytest.ini_options] addopts = [ - '--import-mode=importlib', + "--import-mode=importlib", ] # --- Black --- [tool.black] -target-version = ['py38'] +target-version = ["py38"] line-length = 120 skip-string-normalization = true exclude = ''' @@ -184,32 +184,32 @@ exclude = ''' # --- Ruff --- [tool.ruff] -target-version = 'py38' +target-version = "py38" line-length = 120 -lint.select = ['A', 'B', 'C', 'E', 'F', 'I', 'M', 'N', 'Q', 'RUF', 'S', 'T', 'U', 'W', 'YTT'] +lint.select = ["A", "B", "C", "E", "F", "I", "M", "N", "Q", "RUF", "S", "T", "U", "W", "YTT"] lint.ignore = [ # Allow non-abstract empty methods in abstract base classes - 'B027', + "B027", # Ignore McCabe complexity - 'C901', + "C901", # Allow boolean positional values in function calls, like `dict.get(... True)` - 'FBT003', + "FBT003", # Ignore checks for possible passwords - 'S105', 'S106', 'S107', + "S105", "S106", "S107", ] lint.unfixable = [ # Don't touch unused imports - 'F401', + "F401", ] extend-exclude = [ - 'tests/conftest.py', + "tests/conftest.py", ] [tool.ruff.lint.isort] -known-first-party = ['coincurve'] +known-first-party = ["coincurve"] [tool.ruff.lint.flake8-quotes] -inline-quotes = 'single' +inline-quotes = "single" [tool.ruff.lint.per-file-ignores] # Tests can use assertions @@ -219,7 +219,7 @@ inline-quotes = 'single' # --- Mypy --- [tool.mypy] disallow_untyped_defs = false -follow_imports = 'normal' +follow_imports = "normal" ignore_missing_imports = true pretty = true show_column_numbers = true