I maintain a package whose documentation I auto-generate with Sphinx on readthedocs.org. For Sphinx/readthedocs I use a conf.py
and a properly defined .readthedocs.yaml
.
Inside the conf.py
I use the version:
import pybliometrics
version = pybliometrics.__version__
release = pybliometrics.__version__.replace("_", "")
The version is generated in pybliometrics/__init__.py
. The package itself uses its own version somewhere in the code as well.
When I do the versioning with pbr
(Python Build Reasonableness) like
from pbr.version import VersionInfo
_v = VersionInfo('pybliometrics').semantic_version()
__version__ = _v.release_string()
then the build process on readthedocs works without any problem (assuming I make it install pbr
).
However, when it looks like
from importlib.metadata import version
__version__ = version("pybliometrics")
then the build process fails with importlib.metadata.PackageNotFoundError: No package metadata was found for pybliometrics
. Same for importlib_metadata
.
What's happening there? The reason I switched to importlib.metadata
is that I can do the the entire build process with setuptools_scm
and get rid of setup.py
and setup.cfg
.
Likely you need to do pip install -e
equivalent in your RTD requirements.txt
build file.
See .readthedocs.yml example here and see requirements.txt here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With