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:
git
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?
Eventually the issue was that ReadTheDocs did not have the option to build my package active by default and I was expecting this to happen.
All I had to do was to enable "Install Project" in the Advanced Settings / Default Settings.