diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 469af0c..0000000 --- a/.coveragerc +++ /dev/null @@ -1,15 +0,0 @@ -[run] -source = spyrmsd -omit = - spyrmsd/_version.py - spyrmsd/due.py - -[report] -exclude_lines = - # 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__.: diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..68f5e51 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = E203, E266, E501, W503 +max-line-length = 88 +max-complexity = 18 +select = B,C,E,F,W,T4 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 3d139b2..9a1bb19 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -28,7 +28,7 @@ jobs: python -m pip install flake8 - name: Install package run: | - python setup.py develop --no-deps + python -m pip install -e . --no-deps - name: Lint with flake8 run: | flake8 . --count --show-source --statistics diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 2083038..c2780b9 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -31,7 +31,7 @@ jobs: python -m pip install types-requests - name: Install package run: | - python setup.py develop --no-deps + python -m pip install -e . --no-deps - name: Lint with mypy run: | mypy diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d3518..f78f3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,17 @@ Contributors: @RMeli ### Added * Python `3.13` and `3.14` in CI [PR #147 | @RMeli] +* Optional dependencies for testing (`test`), development (`dev`), and parallelization (`parallel`) in `pyproject.toml` [PR #152 | @copilot] + +### Changed + +* Migrated all package configuration from `setup.cfg` and `setup.py` to `pyproject.toml` [PR #152 | @copilot] ### Removed * support for Open Babel [PR #151 | @RMeli] * Python `3.9` and `3.10` from CI [PR #147 | @RMeli] +* `setup.cfg` and `setup.py` in favour of `pyproject.toml` [PR #152 | @copilot] ## Version 0.9.0 diff --git a/pyproject.toml b/pyproject.toml index 9f9c372..0de711d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,15 +2,84 @@ requires = ["flit_core >=2,<4"] build-backend = "flit_core.buildapi" -[tool.flit.metadata] -module = "spyrmsd" -dist-name = "spyrmsd" -description-file = "README.md" -author = "Rocco Meli" -author-email = "rocco.meli@cscs.ch" -home-page = "https://spyrmsd.readthedocs.io" +[project] +name = "spyrmsd" +version = "0.10.0-dev" +description = "Python tool for symmetry-corrected RMSD" +readme = "README.md" +license = {text = "MIT"} +authors = [ + {name = "Rocco Meli", email = "r.meli@bluemail.ch"} +] classifiers = [ "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3",] + "Programming Language :: Python :: 3", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Operating System :: POSIX", + "Operating System :: Microsoft :: Windows", +] requires-python = ">=3.9" -requires = ["numpy", "scipy", "rustworkx"] +dependencies = ["numpy", "scipy", "rustworkx"] + +[project.urls] +Homepage = "https://spyrmsd.readthedocs.io" + +[project.optional-dependencies] +bib = ["duecredit"] +rdkit = ["rdkit"] +networkx = ["networkx"] +parallel = ["pebble"] +test = [ + "pytest", + "pytest-cov", + "pytest-benchmark", + "requests", +] +dev = [ + "mypy", + "types-requests", + "flake8", + "black", + "isort", + "pre-commit", +] + +[tool.flit.module] +name = "spyrmsd" + +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = "--strict-markers" +markers = [ + "slow", +] + +[tool.coverage.run] +source = ["spyrmsd"] +omit = [ + "spyrmsd/_version.py", + "spyrmsd/due.py", + "*/tests/*", +] + +[tool.coverage.report] +exclude_lines = [ + "# 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__.:", +] + +[tool.mypy] +files = ["spyrmsd", "tests"] +ignore_missing_imports = true + +[tool.isort] +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +line_length = 88 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 680226d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Helper file to handle all configs - -[flake8] -ignore = E203, E266, E501, W503 -max-line-length = 88 -max-complexity = 18 -select = B,C,E,F,W,T4 - -[mypy] -files=spyrmsd, tests -ignore_missing_imports=True - -[isort] -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length=88 - -[aliases] -test = pytest - -[tool:pytest] -testpaths=tests -addopts = --strict-markers -markers = - slow - -[coverage:run] -# .coveragerc to control coverage.py and pytest-cov -omit = - # Omit the tests - */tests/* diff --git a/setup.py b/setup.py deleted file mode 100644 index 95ac21f..0000000 --- a/setup.py +++ /dev/null @@ -1,39 +0,0 @@ -""" -spyrmsd - -Python tool for symmetry-corrected RMSD -""" - -from setuptools import find_packages, setup - -short_description = __doc__.split("\n") - -try: - with open("README.md", "r") as handle: - long_description = handle.read() -except Exception: - long_description = "\n".join(short_description[2:]) - - -setup( - # Self-descriptive entries which should always be present - name="spyrmsd", - author="Rocco Meli", - author_email="rocco.meli@cscs.ch", - description=short_description[0], - long_description=long_description, - long_description_content_type="text/markdown", - version="0.10.0-dev", - license="MIT", - packages=find_packages(), - include_package_data=True, - url="https://spyrmsd.readthedocs.io", - install_requires=["numpy", "scipy", "rustworkx"], - extras_require={ - "bib": ["duecredit"], - "rdkit": ["rdkit"], - "networkx": ["networkx"], - }, - platforms=["Linux", "Mac OS-X", "Unix", "Windows"], - python_requires=">=3.9", -) diff --git a/tests/test_graph.py b/tests/test_graph.py index 373071d..861c17f 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -123,9 +123,10 @@ def test_match_graphs_not_isomorphic_lattice(n) -> None: G1 = graph.lattice(n, n) G2 = graph.lattice(n + 1, n) - with pytest.raises( - NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs - ), pytest.warns(UserWarning, match=gc.warn_no_atomic_properties): + with ( + pytest.raises(NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs), + pytest.warns(UserWarning, match=gc.warn_no_atomic_properties), + ): graph.match_graphs(G1, G2) @@ -134,9 +135,10 @@ def test_match_graphs_not_isomorphic_cycle(n) -> None: G1 = graph.cycle(n) G2 = graph.cycle(n + 1) - with pytest.raises( - NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs - ), pytest.warns(UserWarning, match=gc.warn_no_atomic_properties): + with ( + pytest.raises(NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs), + pytest.warns(UserWarning, match=gc.warn_no_atomic_properties), + ): graph.match_graphs(G1, G2)