Skip to content

Commit 00525c0

Browse files
committed
Repaint the scaffolding.
1 parent 29436e2 commit 00525c0

File tree

8 files changed

+50
-18
lines changed

8 files changed

+50
-18
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ jobs:
5959
- name: Install dependencies
6060
run: brew install enchant
6161
if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs')
62+
- name: Set up Python
63+
uses: actions/setup-python@v4
64+
with:
65+
python-version: |
66+
3.8
67+
3.9
68+
3.10
69+
3.11
70+
3.12
71+
pypy3.10
72+
allow-prereleases: true
6273
- name: Set up nox
6374
uses: wntrblm/[email protected]
6475
- name: Run nox

noxfile.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,35 @@
99
DOCS = ROOT / "docs"
1010
PACKAGE = ROOT / "referencing"
1111

12+
REQUIREMENTS = dict(
13+
docs=DOCS / "requirements.txt",
14+
tests=ROOT / "test-requirements.txt",
15+
)
16+
REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
17+
path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values()
18+
]
19+
20+
SUPPORTED = ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"]
21+
LATEST = "3.12"
1222

1323
nox.options.sessions = []
1424

1525

16-
def session(default=True, **kwargs): # noqa: D103
26+
def session(default=True, python=LATEST, **kwargs): # noqa: D103
1727
def _session(fn):
1828
if default:
1929
nox.options.sessions.append(kwargs.get("name", fn.__name__))
20-
return nox.session(**kwargs)(fn)
30+
return nox.session(python=python, **kwargs)(fn)
2131

2232
return _session
2333

2434

25-
@session(python=["3.8", "3.9", "3.10", "3.11", "pypy3"])
35+
@session(python=SUPPORTED)
2636
def tests(session):
2737
"""
2838
Run the test suite with a corresponding Python version.
2939
"""
30-
session.install("-r", ROOT / "test-requirements.txt")
40+
session.install("-r", REQUIREMENTS["tests"])
3141

3242
if session.posargs and session.posargs[0] == "coverage":
3343
if len(session.posargs) > 1 and session.posargs[1] == "github":
@@ -109,7 +119,7 @@ def docs(session, builder):
109119
"""
110120
Build the documentation using a specific Sphinx builder.
111121
"""
112-
session.install("-r", DOCS / "requirements.txt")
122+
session.install("-r", REQUIREMENTS["docs"])
113123
with TemporaryDirectory() as tmpdir_str:
114124
tmpdir = Path(tmpdir_str)
115125
argv = ["-n", "-T", "-W"]
@@ -147,7 +157,7 @@ def requirements(session):
147157
Update the project's pinned requirements. Commit the result.
148158
"""
149159
session.install("pip-tools")
150-
for each in [DOCS / "requirements.in", ROOT / "test-requirements.in"]:
160+
for each in REQUIREMENTS_IN:
151161
session.run(
152162
"pip-compile",
153163
"--resolver",

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ classifiers = [
2929
"Programming Language :: Python :: 3.9",
3030
"Programming Language :: Python :: 3.10",
3131
"Programming Language :: Python :: 3.11",
32-
"Programming Language :: Python :: 3.8",
33-
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.12",
3433
"Programming Language :: Python :: 3",
3534
"Programming Language :: Python :: Implementation :: CPython",
3635
"Programming Language :: Python :: Implementation :: PyPy",
@@ -136,4 +135,4 @@ docstring-quotes = "double"
136135
[tool.ruff.per-file-ignores]
137136
"noxfile.py" = ["ANN", "D100"]
138137
"docs/*" = ["ANN", "D"]
139-
"referencing/loaders/tests/*" = ["ANN", "D", "RUF012"]
138+
"referencing/tests/*" = ["ANN", "D", "RUF012"]

referencing/loaders.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
r"""
2+
Helpers for loading `referencing.Resource`\ s out of various places.
3+
"""
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING, Any, Iterable
7+
8+
from referencing import Resource
9+
10+
if TYPE_CHECKING:
11+
from pathlib import Path
12+
13+
14+
def from_path(path: Path) -> Iterable[Resource[Any]]:
15+
"""
16+
Load some resources recursively from a given directory path.
17+
"""
18+
for _, _, _ in path.walk():
19+
yield Resource.opaque(None)

referencing/loaders/__init__.py

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

referencing/loaders/tests/test_integration.py

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

referencing/tests/test_loaders.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_it_imports(tmp_path):
2+
import referencing.loaders # noqa: F401

0 commit comments

Comments
 (0)