-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation requires preinstalled Sphinx #714
Comments
@danwos I like your proposal of a There is however a bunch of other stuff with higher priority, so this'll be a "patches welcome" for now. Thanks |
I found a way to automate the version number completely. Using from importlib.metadata import version
__version__ = version("breathe") Some tweaks are needed to the above snippet if installing with python v3.7 or older. Also, if installed from a non-tagged commit, the version number used will be much like what This form can still be used by the docs' conf.py to signal weather or not the docs are of stable release or a dev build. I will submit a PR |
The version.py proposal is implemented in #766 via the setuptools_scm pkg at build time. |
Pending discussion in #766 really this is quite a minor hangup but should be resolved to support installing breathe from github urls. Option 1: Dirty HackWhat I do is just defer imports. You also don't need the type hint in diff --git a/breathe/__init__.py b/breathe/__init__.py
--- a/breathe/__init__.py
+++ b/breathe/__init__.py
@@ -1,13 +1,13 @@
-from breathe.directives.setup import setup as directive_setup
-from breathe.file_state_cache import setup as file_state_cache_setup
-from breathe.renderer.sphinxrenderer import setup as renderer_setup
-
-from sphinx.application import Sphinx
-
__version__ = "4.31.0"
-def setup(app: Sphinx):
+def setup(app: "sphinx.application.Sphinx"):
+ # Defer breathe imports so that install tools needing breathe.__version__
+ # do not need sphinx installed.
+ from breathe.directives.setup import setup as directive_setup
+ from breathe.file_state_cache import setup as file_state_cache_setup
+ from breathe.renderer.sphinxrenderer import setup as renderer_setup
+
directive_setup(app)
file_state_cache_setup(app)
renderer_setup(app) Problem solved. Possibly some Option 2: some sort of
|
I don't know if it is ideal but I've merged a change to just double of the version number. We'll have to be more careful as maintainers but I've also added a CI check to make sure they stay in sync. I wish there was a more obviously better solution. I understand moving stuff into I don't know much about |
I'm unable to install breathe with a fresh new virtual environment from locally checked out git repo .
Error message after
pip install breathe ,
:Reason is this line in
setup.py
:from breathe import __version__
breathe/__init__.py
, which contains the__version__
attribute, also contains this line:from sphinx.application import Sphinx
.So it looks like this line forces pip/setuptools to import already sphinx, which may not be installed yet.
Workarounds
setup.py
from breathe import __version__
and set a fix value forversion
.Solutions idea
Maybe put
__version__
into a separateversion.py
and let__init__.py
import it.setup.py
could then import directly fromversion.py
.The text was updated successfully, but these errors were encountered: