Skip to content

Add sphinx-lint session to noxfile - #1800

Open
rffontenelle wants to merge 6 commits into
pypa:mainfrom
rffontenelle:add_sphinx_lint
Open

Add sphinx-lint session to noxfile#1800
rffontenelle wants to merge 6 commits into
pypa:mainfrom
rffontenelle:add_sphinx_lint

Conversation

@rffontenelle

@rffontenelle rffontenelle commented Feb 4, 2025

Copy link
Copy Markdown
Contributor

See #1166

This runs sphinx-lint in the docs together with HTML build and linkcheck. It accepts one or more path as positional argument, so e.g. one may specify the path of a translation file instead of using the source reST files from "source" directory.

I was going to add sphinx-lint package to requirements.txt and pip-install from that file, but this unnecessarily added dependencies and increased install time.

Running without posargs:

$ python -m nox -s sphinx_lint
nox > Running session sphinx_lint
nox > Creating virtual environment (virtualenv) using python in .nox/sphinx_lint
nox > python -m pip install sphinx-lint
nox > sphinx-lint source
source/glossary.rst:294: OMG TABS!!!1 (horipython -m nox -s sphinx_lintzontal-tab)
source/guides/creating-command-line-tools.rst:105: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:106: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:107: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:126: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:127: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:148: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:149: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:150: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:151: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:152: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:153: OMG TABS!!!1 (horizontal-tab)
source/guides/creating-command-line-tools.rst:163: OMG TABS!!!1 (horizontal-tab)
nox > Command sphinx-lint source failed with exit code 1
nox > Session sphinx_lint failed.

Running with a posargs as the filepath "messages.po", the Brazilian Portuguese translation obtained from translation/source branch:

$ python -m nox -s sphinx_lint -- messages.po 
nox > Running session sphinx_lint
nox > Creating virtual environment (virtualenv) using python in .nox/sphinx_lint
nox > python -m pip install sphinx-lint==1.0.0
nox > sphinx-lint messages.po
No problems found.
nox > Session sphinx_lint was successful.

📚 Documentation preview 📚: https://python-packaging-user-guide--1800.org.readthedocs.build/en/1800/

@chrysle

chrysle commented Mar 1, 2025

Copy link
Copy Markdown
Contributor

Thanks for your contribution! But probably it will be sufficient to add sphinx-lint to CI (#1786)?

@webknjaz webknjaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Comment thread noxfile.py Outdated
@webknjaz

webknjaz commented Mar 2, 2025

Copy link
Copy Markdown
Member

Thanks for your contribution! But probably it will be sufficient to add sphinx-lint to CI (#1786)?

I like both solutions. The important bit is the ability to invoke it locally.

@rffontenelle WDYT? Should we go for the other PR?

@rffontenelle

Copy link
Copy Markdown
Contributor Author

I'm fine with it.

Although I wonder if it uses problem-matcher annotations and if not if it would feasible. Personally I find annotations very handy on GitHub Actions run log

@ncoghlan

ncoghlan commented Mar 2, 2026

Copy link
Copy Markdown
Member

@rffontenelle @webknjaz I was clearing out the approved-but-not-merged PRs, and noticed this one was still lingering, but now with conflicts. Should we just close it, or is it worth resurrecting?

@webknjaz webknjaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ncoghlan I seem to recall a similar/related PR by @hugovk but don't remember the context anymore. We should merge this provided https://docs.zizmor.sh/audits/#template-injection is addressed.

Comment thread .github/workflows/test-translations.yml Outdated
@hugovk

hugovk commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

@ncoghlan I seem to recall a similar/related PR by @hugovk but don't remember the context anymore.

#1786 (comment)

@webknjaz

Copy link
Copy Markdown
Member

@rffontenelle could you look into rebasing plz?

rffontenelle and others added 3 commits August 19, 2026 16:05
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Comment thread noxfile.py Outdated
@webknjaz

Copy link
Copy Markdown
Member

looks like we need to include some RST fixes now...

rffontenelle and others added 2 commits August 20, 2026 10:24
horizontal-tab and unbalanced-inline-literals-delimiters
filesystem entries as specified below:

- Alphanumeric characters, spaces (`` ``), underscores (``_``), hyphens (``-``),
- Alphanumeric characters, spaces (:literal:`\ `), underscores (``_``), hyphens (``-``),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In order the solve an issue in a literal space in https://packaging.python.org/en/latest/specifications/glob-patterns/#valid-glob-patterns, I had to add a single-backtick role. However rst-backticks pre-commit didn't like it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

underscores shows the same problem 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants