Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to uv and pyproject.toml #1776

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/test-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,30 @@ jobs:
with:
ref: ${{ env.I18N_BRANCH }}

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: >-
3.10
enable-cache: true
cache-dependency-glob: "requirements**.txt"

- name: Install Python tooling
run: python -m pip install --upgrade nox virtualenv sphinx-lint
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Set Sphinx problem matcher
uses: sphinx-doc/[email protected]

- name: Build translated docs in ${{ matrix.language }}
run: nox -s build -- -q -D language=${{ matrix.language }}
run: uv run nox -s build -- -q -D language=${{ matrix.language }}

- name: Set Sphinx Lint problem matcher
if: always()
run: echo '::add-matcher::.github/sphinx_lint_matcher.json'

- name: Lint translation file
if: always()
run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/messages.po
run: uv run sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/messages.po
18 changes: 10 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: 'requirements.txt'
enable-cache: true
cache-dependency-glob: "requirements**.txt"

- name: Install dependencies
run: |
python -m pip install --upgrade nox virtualenv
- name: Install Python tooling
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Nox ${{ matrix.noxenv }}
run: |
python -m nox -s ${{ matrix.noxenv }}
uv run nox -s ${{ matrix.noxenv }}


check:
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@ jobs:

git merge '${{ github.event.repository.default_branch }}'

- name: Set up Python
uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: >-
3.10
enable-cache: true
cache-dependency-glob: "requirements**.txt"

- name: Install Python tooling
run: python -m pip install --upgrade nox virtualenv
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev

- name: Generate a fresh POT file out of RST documents
run: python -m nox -s translation
run: uv run nox -s translation

- name: Commit the POT file to Git
run: |
Expand Down
19 changes: 0 additions & 19 deletions .readthedocs.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a deprecated filename that is warned about right at the top of the page, linked in this first line of the file. It must not be used.

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

# adapted from uv recipe at https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
# and comment at https://github.com/readthedocs/readthedocs.org/issues/11289#issuecomment-2103832834
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- asdf global uv latest
- uv sync --extra docs --frozen
- uv run -m sphinx -T -b html -d source/_build/doctrees source $READTHEDOCS_OUTPUT/html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx must remain integrated via nox.

Empty file added README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this empty file added?

Empty file.
4 changes: 0 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def translation(session):
"""
Build the gettext .pot files.
"""
session.install("-r", "requirements.txt")
target_dir = "locales"
session.run(
"sphinx-build",
Expand All @@ -32,8 +31,6 @@ def build(session, autobuild=False):
"""
Make the website.
"""
session.install("-r", "requirements.txt")

if autobuild:
command = "sphinx-autobuild"
extra_args = "--host", "0.0.0.0"
Expand Down Expand Up @@ -76,7 +73,6 @@ def linkcheck(session):
"""
Check for broken links.
"""
session.install("-r", "requirements.txt")
session.run(
"sphinx-build",
"-b",
Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[project]
name = "packaging-python-org"
version = "0.1.0"
description = "Overview of Python Packaging"
readme = "README.rst"
repository = "https://github.com/pypa/packaging.python.org"
documentation = "https://packaging.python.org/en/latest/"
requires-python = ">=3.9"
keywords = ["packaging", "518", "621"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"furo==2024.8.6",
"sphinx-autobuild==2021.3.14",
"sphinx==7.2.6",
"sphinx-inline-tabs==2023.4.21",
"sphinx-copybutton==0.5.2",
"sphinx-toolbox==3.5.0",
]

Comment on lines +1 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project is not a distribution package, it must not have any packaging metadata as it's not supposed to be packaged as such.

Suggested change
[project]
name = "packaging-python-org"
version = "0.1.0"
description = "Overview of Python Packaging"
readme = "README.rst"
repository = "https://github.com/pypa/packaging.python.org"
documentation = "https://packaging.python.org/en/latest/"
requires-python = ">=3.9"
keywords = ["packaging", "518", "621"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"furo==2024.8.6",
"sphinx-autobuild==2021.3.14",
"sphinx==7.2.6",
"sphinx-inline-tabs==2023.4.21",
"sphinx-copybutton==0.5.2",
"sphinx-toolbox==3.5.0",
]

Using the dependency groups may be fine, provided that they list docs build environment deps.

[dependency-groups]
dev = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this called dev? What's the difference from non-dev? Why is sphinx-lint installed in the same env as nox? Why is virtualenv needed?

"nox>=2024.10.9",
"sphinx-lint>=1.0.0",
"virtualenv>=20.28.1",
]
6 changes: 0 additions & 6 deletions requirements.txt

This file was deleted.

Loading
Loading