Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/test-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ jobs:

- name: Lint translation file
if: always()
run: sphinx-lint locales/${LANGUAGE}/LC_MESSAGES/messages.po
run: nox -s sphinx_lint -- locales/${LANGUAGE}/LC_MESSAGES/messages.po
env:
LANGUAGE: ${{ matrix.language }}
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
matrix:
noxenv:
- build
- sphinx_lint
continue-on-error:
- false
include:
Expand Down
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,14 @@ def checkqa(session):
"--all-files",
"--show-diff-on-failure",
)


@nox.session()
def sphinx_lint(session):
"""
Check for reST format issues in source rst files,
accepting another path as positional argument.
"""
session.install("sphinx-lint==1.0.2")
target = session.posargs or ["source"]
session.run("sphinx-lint", *target)
2 changes: 1 addition & 1 deletion source/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Glossary
<https://github.com/pypa>`_, and discuss issues on the
`distutils-sig mailing list
<https://mail.python.org/mailman3/lists/distutils-sig.python.org/>`_
and `the Python Discourse forum <https://discuss.python.org/c/packaging>`__.
and `the Python Discourse forum <https://discuss.python.org/c/packaging>`__.


Python Package Index (PyPI)
Expand Down
28 changes: 14 additions & 14 deletions source/guides/creating-command-line-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ so initialize the command-line interface here:

.. code-block:: python

if __name__ == "__main__":
from greetings.cli import app
app()
if __name__ == "__main__":
from greetings.cli import app
app()

.. note::

Expand All @@ -112,8 +112,8 @@ For the project to be recognised as a command-line tool, additionally a ``consol

.. code-block:: toml

[project.scripts]
greet = "greetings.cli:app"
[project.scripts]
greet = "greetings.cli:app"

Now, the project's source tree is ready to be transformed into a :term:`distribution package <Distribution Package>`,
which makes it installable.
Expand All @@ -134,14 +134,14 @@ Let's test it:

.. code-block:: console

$ greet
Greetings, friend!
$ greet --doctor Brennan
Greetings, Dr. Brennan!
$ greet --title Ms. Parks
Greetings, Ms. Parks!
$ greet --title Mr.
Greetings, Mr. mr!
$ greet
Greetings, friend!
$ greet --doctor Brennan
Greetings, Dr. Brennan!
$ greet --title Ms. Parks
Greetings, Ms. Parks!
$ greet --title Mr.
Greetings, Mr. mr!

Since this example uses ``typer``, you could now also get an overview of the program's usage by calling it with
the ``--help`` option, or configure completions via the ``--install-completion`` option.
Expand All @@ -151,7 +151,7 @@ To just run the program without installing it permanently, use ``pipx run``, whi

.. code-block:: console

$ pipx run --spec . greet --doctor
$ pipx run --spec . greet --doctor

This syntax is a bit impractical, however; as the name of the entry point we defined above does not match the package name,
we need to state explicitly which executable script to run (even though there is only one in existence).
Expand Down
2 changes: 1 addition & 1 deletion source/specifications/glob-patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Valid glob patterns
For PyPA purposes, a *valid glob pattern* MUST be a string matched against
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 馃

and dots (``.``) MUST be matched verbatim.

- Special glob characters: ``*``, ``?``, ``**`` and character ranges: ``[]``
Expand Down
Loading