Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit 9e0a3a9

Browse files
committed
Use uv
1 parent 52d3766 commit 9e0a3a9

File tree

7 files changed

+602
-589
lines changed

7 files changed

+602
-589
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,17 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
# Some Ferrocene builders require the use of Python 3.9. Use that on CI
20-
# to make sure there are no surprises when we import into Ferrocene.
21-
- uses: actions/setup-python@v3
22-
with:
23-
python-version: "3.9.x"
19+
- name: Install `uv`
20+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
2421

2522
- name: Check that the requirements are installable
26-
run: python3 -m pip install -r requirements.txt
27-
28-
- name: Install linting dependencies
29-
run: python3 -m pip install reuse black flake8
23+
run: uv pip install -r pyproject.toml
3024

3125
- name: Verify licensing metadata
32-
run: reuse lint
26+
run: uvx reuse lint
3327

3428
- name: Verify Python code formatting
35-
run: black . --check --diff --color
29+
run: uvx black . --check --diff --color
3630

3731
- name: Lint Python code with flake8
38-
run: flake8 .
32+
run: uvx flake8 .

make_common.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,6 @@ def current_git_commit(root):
111111
return
112112

113113

114-
class VirtualEnv:
115-
def __init__(self, root, path):
116-
self.path = path
117-
self.requirements = root / "shared" / "requirements.txt"
118-
self.installed_requirements = path / "installed-requirements.txt"
119-
120-
if not self.up_to_date():
121-
self.create()
122-
123-
def bin(self, name):
124-
if sys.platform == "win32":
125-
return self.path / "scripts" / name
126-
else:
127-
return self.path / "bin" / name
128-
129-
def up_to_date(self):
130-
if self.installed_requirements.exists():
131-
expected = self.requirements.read_bytes()
132-
installed = self.installed_requirements.read_bytes()
133-
if expected == installed:
134-
return True
135-
return False
136-
137-
def create(self):
138-
venv.EnvBuilder(clear=True, symlinks=True, with_pip=True).create(self.path)
139-
subprocess.run(
140-
[self.bin("pip"), "install", "-r", self.requirements, "--require-hashes"],
141-
check=True,
142-
)
143-
self.installed_requirements.write_bytes(self.requirements.read_bytes())
144-
145-
146114
def main(root):
147115
root = Path(root)
148116

@@ -170,7 +138,6 @@ def main(root):
170138
)
171139
args = parser.parse_args()
172140

173-
env = VirtualEnv(root, root / ".venv")
174141
rendered = build_docs(
175142
root, env, "xml" if args.xml else "html", args.clear, args.serve, args.debug
176143
)

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: The Ferrocene Developers
2+
# SPDX-License-Identifier: MIT OR Apache-2.0
3+
[project]
4+
name = "sphinx-shared-resources"
5+
version = "0.0.1"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"sphinx",
9+
"sphinx-autobuild",
10+
"tomli",
11+
"myst_parser",
12+
"pyyaml",
13+
"semver",
14+
15+
# For compatibility with Python < 3.10, as Sphinx has a conditional dependency
16+
# on importlib-metadata on older Python versions.
17+
"importlib-metadata"
18+
]

requirements.in

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

requirements.txt

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

requirements.txt.license

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

uv.lock

Lines changed: 578 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)