Skip to content

Commit

Permalink
Merge #542
Browse files Browse the repository at this point in the history
542: Convert the FLS to pull sphinx shared resources from pypi r=Veykril a=pietroalbini

This PR changes the FLS to use `uv` to manage its Python dependencies, and to pull our shared resources from PyPI instead of the submodule.

Co-authored-by: Pietro Albini <[email protected]>
  • Loading branch information
bors-ferrocene[bot] and pietroalbini authored Jan 21, 2025
2 parents e259bbd + 02e80ef commit 42e91c8
Show file tree
Hide file tree
Showing 9 changed files with 850 additions and 54 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,20 @@ jobs:
steps:
- uses: actions/checkout@v3

# Some Ferrocene builders require the use of Python 3.9. Use that on CI
# to make sure there are no surprises when we import into Ferrocene.
- uses: actions/setup-python@v3
with:
python-version: "3.9.x"
- name: Setup uv
uses: astral-sh/setup-uv@v5

- name: Build documentation and check links
run: ./make.py --check-links

- name: Install Python dependencies
run: python3 -m pip install reuse black flake8

- name: Verify licensing metadata
run: reuse lint
run: uvx reuse lint

- name: Verify Python code formatting
run: black . --check --diff --color
run: uvx black . --check --diff --color

- name: Lint Python code with flake8
run: flake8 . --exclude .venv
run: uvx flake8 . --exclude .venv

- name: Publish to GitHub Pages
uses: ferrous-systems/shared-github-actions/github-pages@main
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

29 changes: 8 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ licenses text is present in the ``LICENSES/`` directory.
Building the specification
==========================

FLS uses `Sphinx`_ to build a rendered version of the specification. To
simplify building the rendered version, we created a script called ``make.py``
that takes care of installing the expected Sphinx release and invoking it with
the right flags.
FLS uses `Sphinx`_ to build a rendered version of the specification, and `uv`_ to install and manage
Python dependencies (including Sphinx itself). To simplify building the rendered version, we created
a script called ``make.py`` that takes care of invoking Sphinx with the right flags.

You can build the rendered version by running::

Expand Down Expand Up @@ -66,25 +65,13 @@ This will clone the source code of the tool, build it, and execute it on the
rendered documentation.

.. _Sphinx: https://www.sphinx-doc.org
.. _uv: https://docs.astral.sh/uv/

Updating build dependencies
===========================

The FLS uses ``pip-tools`` to manage the Python dependencies used for builds,
as it allows pinning hashes for the dependencies. While it doesn't add any
additional burden when installing dependencies (the format it outputs is
understood by `pip`), you have to install it when regenerating the
``requirements.txt`` file.
The FLS uses ``uv`` to manage the Python dependencies used for builds. If you change the list of
dependencies in ``pyproject.toml`` they will automatically be installed the next time you run
``make.py``. If you want to update the packages in the lockfile, run::

To install `pip-tools`, we recommend first installing `pipx`_, and then
running::

pipx install pip-tools

Once that's done, you can change the list of desired dependencies in the
``requirements.in`` file, and run this command to regenerate the
``requirements.txt`` file::

pip-compile --generate-hashes

.. _pipx: https://pypa.github.io/pipx/
uv lock --upgrade
2 changes: 1 addition & 1 deletion generate-random-ids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers

Expand Down
17 changes: 3 additions & 14 deletions make.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers

import os
import subprocess
import sys
import ferrocene_standalone_make_cli

root = os.path.abspath(os.path.dirname(__file__))
subprocess.run(
["git", "submodule", "update", "--init"],
check=True,
cwd=root,
)

sys.path.insert(0, "shared")
import make_common # noqa: E402

make_common.main(root)
ferrocene_standalone_make_cli.main(os.path.abspath(os.path.dirname(__file__)))
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: MIT OR Apache-2.0
# SPDX-FileCopyrightText: The Ferrocene Developers

[project]
name = "fls"
version = "0.0.0"

requires-python = ">= 3.10"
dependencies = [
"sphinx ~= 8.0",
"sphinx-autobuild >= 0", # Doesn't use semver.
"ferrocene-sphinx-shared-resources >= 0",
]
1 change: 0 additions & 1 deletion shared
Submodule shared deleted from 52d376
818 changes: 818 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions uv.lock.license

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 42e91c8

Please sign in to comment.