Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit c5f583f

Browse files
garryodcoretl
authored andcommitted
Moved config to pyproject.toml
1 parent fa99c26 commit c5f583f

File tree

4 files changed

+116
-134
lines changed

4 files changed

+116
-134
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"ms-vscode-remote.remote-containers",
44
"ms-python.vscode-pylance",
55
"ms-python.python",
6-
"ryanluker.vscode-coverage-gutters"
6+
"ryanluker.vscode-coverage-gutters",
7+
"tamasfe.even-better-toml"
78
]
89
}

pyproject.toml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,113 @@
22
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "python3-pip-skeleton"
7+
classifiers = [
8+
"Development Status :: 3 - Alpha",
9+
"License :: OSI Approved :: Apache Software License",
10+
"Programming Language :: Python :: 3.8",
11+
"Programming Language :: Python :: 3.9",
12+
"Programming Language :: Python :: 3.10",
13+
"Programming Language :: Python :: 3.11",
14+
]
15+
description = "One line description of your module"
16+
dependencies = [] # Add project dependencies here, e.g. ["click", "numpy"]
17+
dynamic = ["version"]
18+
license.file = "LICENSE"
19+
readme = "README.rst"
20+
requires-python = ">=3.8"
21+
22+
[project.optional-dependencies]
23+
dev = [
24+
"black",
25+
"isort",
26+
"mypy",
27+
"flake8",
28+
"flake8-isort",
29+
"Flake8-pyproject",
30+
"pipdeptree",
31+
"pre-commit",
32+
"pydata-sphinx-theme",
33+
"pytest-cov",
34+
"setuptools_scm[toml]>=6.2",
35+
"sphinx-autobuild",
36+
"sphinx-copybutton",
37+
"sphinx-design",
38+
"tox",
39+
"tox-direct",
40+
"types-mock",
41+
]
42+
43+
[project.scripts]
44+
python3-pip-skeleton = "python3_pip_skeleton.__main__:main"
45+
46+
[project.urls]
47+
GitHub = "https://github.com/DiamondLightSource/python3-pip-skeleton"
48+
49+
[[project.authors]] # Further authors may be added by duplicating this section
50+
51+
name = "Firstname Lastname"
52+
53+
554
[tool.setuptools_scm]
655
write_to = "src/python3_pip_skeleton/_version.py"
56+
57+
[tool.mypy]
58+
ignore_missing_imports = true # Ignore missing stubs in imported modules
59+
60+
[tool.isort]
61+
float_to_top = true
62+
profile = "black"
63+
64+
[tool.flake8]
65+
extend-ignore = [
66+
"E203", # See https://github.com/PyCQA/pycodestyle/issues/373
67+
"F811", # support typing.overload decorator
68+
"F722", # allow Annotated[typ, some_func("some string")]
69+
]
70+
max-line-length = 88 # Respect black's line length (default 88),
71+
exclude = [".tox", "venv"]
72+
73+
74+
[tool.pytest.ini_options]
75+
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
76+
addopts = """
77+
--tb=native -vv --doctest-modules --doctest-glob="*.rst"
78+
--cov=python3_pip_skeleton --cov-report term --cov-report xml:cov.xml
79+
"""
80+
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
81+
filterwarnings = "error"
82+
# Doctest python code in docs, python code in src docstrings, test functions in tests
83+
testpaths = "docs src tests"
84+
85+
[tool.coverage.run]
86+
data_file = "/tmp/python3_pip_skeleton.coverage"
87+
88+
[tool.coverage.paths]
89+
# Tests are run from installed location, map back to the src directory
90+
source = ["src", "**/site-packages/"]
91+
92+
# tox must currently be configured via an embedded ini string
93+
# See: https://github.com/tox-dev/tox/issues/999
94+
[tool.tox]
95+
legacy_tox_ini = """
96+
[tox]
97+
skipsdist=True
98+
99+
[testenv:{pre-commit,mypy,pytest,docs}]
100+
# Don't create a virtualenv for the command, requires tox-direct plugin
101+
direct = True
102+
passenv = *
103+
allowlist_externals =
104+
pytest
105+
pre-commit
106+
mypy
107+
sphinx-build
108+
sphinx-autobuild
109+
commands =
110+
pytest: pytest {posargs}
111+
mypy: mypy src tests {posargs}
112+
pre-commit: pre-commit run --all-files {posargs}
113+
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
114+
"""

setup.cfg

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

tests/test_boilerplate_removed.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This file checks that all the example boilerplate text has been removed.
33
It can be deleted when all the contained tests pass
44
"""
5-
import configparser
5+
from importlib.metadata import metadata
66
from pathlib import Path
77

88
ROOT = Path(__file__).parent.parent
@@ -24,14 +24,12 @@ def assert_not_contains_text(path: str, text: str, explanation: str):
2424
skeleton_check(text in contents, f"Please change ./{path} {explanation}")
2525

2626

27-
# setup.cfg
28-
def test_module_description():
29-
conf = configparser.ConfigParser()
30-
conf.read("setup.cfg")
31-
description = conf["metadata"]["description"]
27+
# pyproject.toml
28+
def test_module_summary():
29+
summary = metadata("python3-pip-skeleton")["summary"]
3230
skeleton_check(
33-
"One line description of your module" in description,
34-
"Please change description in ./setup.cfg "
31+
"One line description of your module" in summary,
32+
"Please change project.description in ./pyproject.toml "
3533
"to be a one line description of your module",
3634
)
3735

0 commit comments

Comments
 (0)