I have a project where I manage the version through git
tags.
Then, I use setuptools_scm
to get this information in my setup.py
and also generates a file (_version.py
) that gets included when generating the wheel for pip
.
This file is not tracked by git
since:
- it has the same information that can be gathered by
git
- it would create a circular situation where building the wheel will modify the version which changes the sources and a new version will be generated
Now, when I build the documentation, it becomes natural to fetch this version from _version.py
and this all works well locally.
However, when I try to do this within ReadTheDocs, the building of the documentation fails because _version.py
is not tracked by git
, so ReadTheDocs does not find it when fetching the sources from the repository.
EDIT: I have tried to use the method proposed in the duplicate, which is the same as what setuptools_scm
indicate in the documentation, i.e. using in docs/conf.py
:
from pkg_resources import get_distribution
__version__ = get_distribution('numeral').version
... # I use __version__ to define Sphinx variables
but I get:
pkg_resources.DistributionNotFound: The 'numeral' distribution was not found and is required by the application
(Again, building the documentation locally works correctly.)
How could I solve this issue without resorting to maintaining the version number in two places?