Skip to content

Commit 48420a4

Browse files
CopilotRMeli
andauthored
Consolidate package configuration in pyproject.toml (#152)
Co-authored-by: RMeli <11348981+RMeli@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RMeli <11348981+RMeli@users.noreply.github.com> Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
1 parent db19a30 commit 48420a4

9 files changed

Lines changed: 99 additions & 104 deletions

File tree

.coveragerc

Lines changed: 0 additions & 15 deletions
This file was deleted.

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503
3+
max-line-length = 88
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4

.github/workflows/flake8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python -m pip install flake8
2929
- name: Install package
3030
run: |
31-
python setup.py develop --no-deps
31+
python -m pip install -e . --no-deps
3232
- name: Lint with flake8
3333
run: |
3434
flake8 . --count --show-source --statistics

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
python -m pip install types-requests
3232
- name: Install package
3333
run: |
34-
python setup.py develop --no-deps
34+
python -m pip install -e . --no-deps
3535
- name: Lint with mypy
3636
run: |
3737
mypy

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ Contributors: @RMeli
1111
### Added
1212

1313
* Python `3.13` and `3.14` in CI [PR #147 | @RMeli]
14+
* Optional dependencies for testing (`test`), development (`dev`), and parallelization (`parallel`) in `pyproject.toml` [PR #152 | @copilot]
15+
16+
### Changed
17+
18+
* Migrated all package configuration from `setup.cfg` and `setup.py` to `pyproject.toml` [PR #152 | @copilot]
1419

1520
### Removed
1621

1722
* support for Open Babel [PR #151 | @RMeli]
1823
* Python `3.9` and `3.10` from CI [PR #147 | @RMeli]
24+
* `setup.cfg` and `setup.py` in favour of `pyproject.toml` [PR #152 | @copilot]
1925

2026
## Version 0.9.0
2127

pyproject.toml

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,84 @@
22
requires = ["flit_core >=2,<4"]
33
build-backend = "flit_core.buildapi"
44

5-
[tool.flit.metadata]
6-
module = "spyrmsd"
7-
dist-name = "spyrmsd"
8-
description-file = "README.md"
9-
author = "Rocco Meli"
10-
author-email = "rocco.meli@cscs.ch"
11-
home-page = "https://spyrmsd.readthedocs.io"
5+
[project]
6+
name = "spyrmsd"
7+
version = "0.10.0-dev"
8+
description = "Python tool for symmetry-corrected RMSD"
9+
readme = "README.md"
10+
license = {text = "MIT"}
11+
authors = [
12+
{name = "Rocco Meli", email = "r.meli@bluemail.ch"}
13+
]
1214
classifiers = [
1315
"License :: OSI Approved :: MIT License",
14-
"Programming Language :: Python :: 3",]
16+
"Programming Language :: Python :: 3",
17+
"Operating System :: POSIX :: Linux",
18+
"Operating System :: MacOS",
19+
"Operating System :: POSIX",
20+
"Operating System :: Microsoft :: Windows",
21+
]
1522
requires-python = ">=3.9"
16-
requires = ["numpy", "scipy", "rustworkx"]
23+
dependencies = ["numpy", "scipy", "rustworkx"]
24+
25+
[project.urls]
26+
Homepage = "https://spyrmsd.readthedocs.io"
27+
28+
[project.optional-dependencies]
29+
bib = ["duecredit"]
30+
rdkit = ["rdkit"]
31+
networkx = ["networkx"]
32+
parallel = ["pebble"]
33+
test = [
34+
"pytest",
35+
"pytest-cov",
36+
"pytest-benchmark",
37+
"requests",
38+
]
39+
dev = [
40+
"mypy",
41+
"types-requests",
42+
"flake8",
43+
"black",
44+
"isort",
45+
"pre-commit",
46+
]
47+
48+
[tool.flit.module]
49+
name = "spyrmsd"
50+
51+
[tool.pytest.ini_options]
52+
testpaths = ["tests"]
53+
addopts = "--strict-markers"
54+
markers = [
55+
"slow",
56+
]
57+
58+
[tool.coverage.run]
59+
source = ["spyrmsd"]
60+
omit = [
61+
"spyrmsd/_version.py",
62+
"spyrmsd/due.py",
63+
"*/tests/*",
64+
]
65+
66+
[tool.coverage.report]
67+
exclude_lines = [
68+
"# Don't complain if tests don't hit defensive assertion code:",
69+
"raise AssertionError",
70+
"raise NotImplementedError",
71+
"# Don't complain if non-runnable code isn't run:",
72+
"if 0:",
73+
"if __name__ == .__main__.:",
74+
]
75+
76+
[tool.mypy]
77+
files = ["spyrmsd", "tests"]
78+
ignore_missing_imports = true
79+
80+
[tool.isort]
81+
multi_line_output = 3
82+
include_trailing_comma = true
83+
force_grid_wrap = 0
84+
use_parentheses = true
85+
line_length = 88

setup.cfg

Lines changed: 0 additions & 33 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/test_graph.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ def test_match_graphs_not_isomorphic_lattice(n) -> None:
123123
G1 = graph.lattice(n, n)
124124
G2 = graph.lattice(n + 1, n)
125125

126-
with pytest.raises(
127-
NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs
128-
), pytest.warns(UserWarning, match=gc.warn_no_atomic_properties):
126+
with (
127+
pytest.raises(NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs),
128+
pytest.warns(UserWarning, match=gc.warn_no_atomic_properties),
129+
):
129130
graph.match_graphs(G1, G2)
130131

131132

@@ -134,9 +135,10 @@ def test_match_graphs_not_isomorphic_cycle(n) -> None:
134135
G1 = graph.cycle(n)
135136
G2 = graph.cycle(n + 1)
136137

137-
with pytest.raises(
138-
NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs
139-
), pytest.warns(UserWarning, match=gc.warn_no_atomic_properties):
138+
with (
139+
pytest.raises(NonIsomorphicGraphs, match=gc.error_non_isomorphic_graphs),
140+
pytest.warns(UserWarning, match=gc.warn_no_atomic_properties),
141+
):
140142
graph.match_graphs(G1, G2)
141143

142144

0 commit comments

Comments
 (0)