Skip to content

[FR] Auto-record the release and version values into the known words list #224

Open
@webknjaz

Description

@webknjaz

In my projects, the version is generated with setuptools-scm and thus is derived from Git. For non-tagged commits this means that it has a local specifier part (per PEP 440) which contains a short commit SHA among other things. Like this: 10.0.1.dev100+gf84df246 — it makes sphinxcontrib-spelling complain about dev, gf and df not being words.

The version is rendered through an RST substitution as in |release|. So I can't do

:spelling:ignore:`|release|`

because then, the substitution doesn't work since the role doesn't interpret it.
Similarly, the following doesn't work either:

.. spelling::

   |release|

because the substitution isn't interpreted.

So the ideal solution for this specific problem would be for the extension to auto-learn the version "word".

A more flexible/generic solutions could include:

  1. interpreting RST within directive and role params
  2. having a configuration option with a word list (not in a separate file!) — it could be populated dynamically right in conf.py

I suppose using a custom spelling_filters = [VersionFilter] can be my workaround (though I haven't yet managed to make it work!) but this interface is not really ergonomic — making a class and a method to make just one comparison seems excessive. Even a regular callable with a signature like (str) -> bool would be much cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions