Skip to content

Commit

Permalink
Add Sphinx Lint to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 14, 2025
1 parent c6a3722 commit 9858430
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
20 changes: 18 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/codespell-project/codespell
Expand All @@ -37,7 +43,17 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
rev: v0.9.1
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint

- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
furo==2024.8.6
sphinx==7.2.6
sphinx-autobuild==2021.3.14
sphinx-inline-tabs==2023.4.21
sphinx-copybutton==0.5.2
sphinx-inline-tabs==2023.4.21
sphinx-toolbox==3.5.0
2 changes: 1 addition & 1 deletion source/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Glossary
<https://bitbucket.org/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
24 changes: 12 additions & 12 deletions source/guides/creating-command-line-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ so initizalize 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 @@ -123,8 +123,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 @@ -145,12 +145,12 @@ Let's test it:

.. code-block:: console
$ greet --knight Lancelot
Greetings, dear Sir Lancelot!
$ greet --gender feminine Parks
Greetings, dear Ms. Parks!
$ greet --gender masculine
Greetings, dear Mr. what's-his-name!
$ greet --knight Lancelot
Greetings, dear Sir Lancelot!
$ greet --gender feminine Parks
Greetings, dear Ms. Parks!
$ greet --gender masculine
Greetings, dear Mr. what's-his-name!
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 @@ -160,7 +160,7 @@ To just run the program without installing it permanently, use ``pipx run``, whi

.. code-block:: console
$ pipx run --spec . greet --knight
$ pipx run --spec . greet --knight
This syntax is a bit unpractical, 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 on in existence).
Expand Down

0 comments on commit 9858430

Please sign in to comment.