Skip to content

Commit 0693206

Browse files
authored
🔧 Use flit/uv (#110)
- Restricted to Python 3.9 - Cleaned noxfile - Added CONTRIBUTING.md
1 parent aba899b commit 0693206

File tree

9 files changed

+84
-61
lines changed

9 files changed

+84
-61
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ _build
1919
.venv
2020
.vscode
2121
.VSCodeCounter
22+
23+
uv.lock

‎.readthedocs.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ sphinx:
2525

2626
python:
2727
install:
28-
- requirements: doc-requirements.txt
2928
- method: pip
3029
path: .
30+
extra_requirements:
31+
- docs

‎CONTRIBUTING.md‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributing
2+
3+
## Formatting and linting
4+
5+
The easiest way to run the formatting and linting is to use the [pre-commit] tool.
6+
Install it, then run:
7+
8+
```bash
9+
pre-commit run --all
10+
```
11+
12+
This will run formatting and linting on all files in the repository (principally using [ruff]).
13+
14+
To install as a pre-commit hook:
15+
16+
```bash
17+
pre-commit install
18+
```
19+
20+
## Managing the Python code
21+
22+
The pyproject.toml follows the [PEP621] standard.
23+
To install all dependencies for local development you may use [uv]:
24+
25+
```bash
26+
uv sync --all-groups --all-extras
27+
```
28+
29+
A Makefile exits to execute common tasks:
30+
```bash
31+
make docs-html
32+
make docs-linkcheck
33+
make format
34+
make lint
35+
make test
36+
make test-matrix
37+
```
38+
39+
The test matrix is executed using [nox] and runs all tests in all supported Python versions.
40+
The Python versions must be pre-installed on your system.
41+
42+
[pre-commit]: https://pre-commit.com/
43+
[ruff]: https://docs.astral.sh/ruff/
44+
[uv]: https://docs.astral.sh/uv/
45+
[nox]: https://nox.thea.codes
46+
[PEP621]: https://peps.python.org/pep-0621/

‎MANIFEST.in‎

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

‎doc-requirements.txt‎

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

‎noxfile.py‎

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,24 @@
44
PYTHON_VERSIONS = ["3.10", "3.12"]
55
SPHINX_VERSIONS = ["5.0", "7.2.5", "8.1.3"]
66
SPHINX_NEEDS_VERSIONS = ["2.1", "4.2"]
7-
TEST_DEPENDENCIES = [
8-
"pytest",
9-
"pytest-xdist",
10-
]
11-
LINT_DEPENDENCIES = [
12-
"flake8",
13-
"pep8-naming",
14-
"flake8-isort",
15-
"flake8-black",
16-
]
17-
18-
19-
def is_supported(python: str, sphinx: str) -> bool:
20-
return not (python == "3.6" and float(sphinx) > 3.0) # fmt: skip
217

228

239
def run_tests(session, sphinx, sphinx_needs):
24-
session.install(".")
25-
session.install(*TEST_DEPENDENCIES)
10+
session.install(".[test]")
2611
session.run("pip", "install", f"sphinx=={sphinx}", silent=True)
2712
session.run("pip", "install", f"sphinx_needs=={sphinx_needs}", silent=True)
28-
session.run("pip", "install", "-r", "doc-requirements.txt", silent=True)
2913
session.run("make", "test", external=True)
3014

3115

3216
@session(python=PYTHON_VERSIONS)
3317
@nox.parametrize("sphinx_needs", SPHINX_NEEDS_VERSIONS)
3418
@nox.parametrize("sphinx", SPHINX_VERSIONS)
3519
def tests(session, sphinx_needs, sphinx):
36-
if is_supported(session.python, sphinx):
37-
run_tests(session, sphinx, sphinx_needs)
38-
else:
39-
session.skip("unsupported combination")
40-
20+
run_tests(session, sphinx, sphinx_needs)
4121

42-
@session(python="3.9")
43-
def lint(session):
44-
session.install(*LINT_DEPENDENCIES)
45-
session.run("make", "lint", external=True)
4622

47-
48-
@session(python="3.9")
23+
@session(python="3.12")
4924
def linkcheck(session):
50-
session.install(".")
51-
# LinkCheck cn handle rate limits since Sphinx 3.4, which is needed as
52-
# our doc has to many links to GitHub.
53-
session.run("pip", "install", "sphinx==3.5.4", silent=True)
54-
55-
session.run("pip", "install", "-r", "doc-requirements.txt", silent=True)
56-
session.run("make", "docs-linkcheck", external=True)
25+
session.install(".[docs]")
26+
with session.chdir("docs"):
27+
session.run("make", "linkcheck", external=True)

‎pyproject.toml‎

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
[build-system]
2-
requires = ["setuptools>=42", "wheel"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["flit_core >=3.4,<4"]
3+
build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "sphinx-test-reports"
77
version = "1.2.0"
88
description = "Sphinx extension for showing test results and test environment information inside sphinx documentations"
99
readme = "README.rst"
10-
requires-python = ">=3.6"
1110
license = { text = "MIT" }
1211
authors = [{ name = "team useblocks", email = "[email protected]" }]
13-
dependencies = ["sphinx>4.0", "lxml", "sphinx-needs>=1.0.1"]
1412
classifiers = [
1513
"Framework :: Sphinx",
1614
"Framework :: Sphinx :: Extension",
@@ -27,20 +25,39 @@ classifiers = [
2725
"Topic :: Documentation",
2826
]
2927
keywords = ["sphinx", "documentation", "test-reports"]
28+
requires-python = ">=3.9"
29+
dependencies = ["sphinx>4.0", "lxml", "sphinx-needs>=1.0.1"]
3030

31-
[project.urls]
31+
[project.optional-dependencies]
32+
test = [
33+
"nox>=2025.2.9",
34+
"pytest-xdist",
35+
"pytest>=7.0",
36+
"sphinx_design",
37+
"sphinxcontrib-plantuml",
38+
]
39+
docs = [
40+
"pillow",
41+
"sphinx-design",
42+
"sphinx-immaterial",
43+
"sphinx-needs>=4",
44+
"sphinx-test-reports>=0.3.3",
45+
"sphinx==7",
46+
"sphinxcontrib-plantuml",
47+
]
3248

49+
[dependency-groups]
50+
dev = ["pre-commit~=3.0", "nox>=2025.2.9"]
51+
52+
[tool.flit.module]
53+
name = "sphinxcontrib.test_reports"
54+
55+
[project.urls]
3356
Homepage = "https://github.com/useblocks/sphinx-test-reports"
3457
Repository = "https://github.com/useblocks/sphinx-test-reports.git"
3558
Documentation = "https://sphinx-test-reports.readthedocs.io/en/latest/"
3659
download-url = "http://pypi.python.org/pypi/sphinx-test-reports"
3760

38-
[tool.setuptools.packages.find]
39-
include = ["*"]
40-
41-
[project.optional-dependencies]
42-
development = ["wheel"]
43-
4461
[tool.ruff.lint]
4562
# TODO enable and fix commented rules
4663
extend-select = [

‎sphinxcontrib/__init__.py‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎test-requirements.txt‎

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

0 commit comments

Comments
 (0)