From de117208c85cb7eb37daabb4f4968bf2cc031017 Mon Sep 17 00:00:00 2001 From: Daniel Bast <2790401+dbast@users.noreply.github.com> Date: Tue, 16 Apr 2024 12:06:39 +0200 Subject: [PATCH] Migrate to pyproject.toml --- .coveragerc | 40 --------------------- .github/workflows/tests.yml | 2 +- MANIFEST.in | 1 - pyproject.toml | 69 +++++++++++++++++++++++++++++++++++++ pytest.ini | 2 -- setup.py | 27 --------------- 6 files changed, 70 insertions(+), 71 deletions(-) delete mode 100644 .coveragerc delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 setup.py diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 73637522f..000000000 --- a/.coveragerc +++ /dev/null @@ -1,40 +0,0 @@ -[run] -branch = True - -[report] -skip_empty = True -skip_covered = True - -# Omit; need a different approach to test modules with hardware dependencies -omit = - */__init__.py - */tests/* - */pyzbar/* - */gui/* - -# Regexes for lines to exclude from consideration -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain about missing debug-only code: - def __repr__ - def __str__ - if self\.debug - - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - - # Don't complain if non-runnable code isn't run: - if 0: - if __name__ == .__main__.: - - # Don't complain about abstract methods, they aren't run: - @(abc\.)?abstractmethod - - -[html] -directory = coverage_html_report -skip_empty = True -skip_covered = False diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cb7c05755..e7f730c2d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: sudo apt-get install libzbar0 python -m pip install --upgrade pip pip install -r requirements.txt -r tests/requirements.txt - python setup.py install + pip install . - name: Test with pytest run: | mkdir artifacts diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 4b597e4ef..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -recursive-include src/seedsigner/resources * diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..626fa0fd4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools", "wheel"] + +[project] +authors = [{name = "SeedSigner", email = "author@example.com"}] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent" +] +description = "Build an offline, airgapped Bitcoin signing device for less than $50!" +name = "seedsigner" +readme = "README.md" +requires-python = ">=3.10" +version = "0.7.0" + +[project.urls] +"Bug Tracker" = "https://github.com/SeedSigner/seedsigner/issues" +Homepage = "https://seedsigner.com/" +Repository = "https://github.com/SeedSigner/seedsigner" + +[tool.coverage.html] +directory = "coverage_html_report" +skip_covered = false +skip_empty = true + +[tool.coverage.report] +# Regexes for lines to exclude from consideration +exclude_lines = [ + # Have to re-enable the standard pragma + "pragma: no cover", + # Don't complain about missing debug-only code: + "def __repr__", + "def __str__", + "if self\\.debug", + # Don't complain if tests don't hit defensive assertion code: + "raise AssertionError", + "raise NotImplementedError", + # Don't complain if non-runnable code isn't run: + "if 0:", + "if __name__ == .__main__.:", + # Don't complain about abstract methods, they aren't run: + "@(abc\\.)?abstractmethod" +] +# Omit; need a different approach to test modules with hardware dependencies +omit = [ + "*/__init__.py", + "*/tests/*", + "*/pyzbar/*", + "*/gui/*" +] +skip_covered = true +skip_empty = true + +[tool.coverage.run] +branch = true + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.package-data] +"seedsigner.resources" = ["*"] + +[tool.setuptools.packages.find] +where = ["src"] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index de19c9f0b..000000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -testpaths = tests \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index deb7c594d..000000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -import setuptools - -with open("README.md", "r", encoding="utf-8") as fh: - long_description = fh.read() - -setuptools.setup( - name="seedsigner", - version="0.7.0", - author="SeedSigner", - author_email="author@example.com", - description="Build an offline, airgapped Bitcoin signing device for less than $50!", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/SeedSigner/seedsigner", - project_urls={ - "Bug Tracker": "https://github.com/SeedSigner/seedsigner/issues", - }, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - package_dir={"": "src"}, - packages=setuptools.find_packages(where="src"), - include_package_data=True, - python_requires=">=3.10", -)