Support of other Sphinx extensions
Hi,
I was wondering what would be the best way to add other Sphinx extensions? As far as I understand, the Sphinx runner is pre-built and therefore it is not really possible to add other extensions after it has been released?
Thanks, Rainer
That's correct. It's definitely possible though if we only ship CPython + pip and then build sphinx lazily in a virtual environment.
Opening again since I'm interested making this come true.
Hi, Is there any way I could help? I have very little experience with Python and pip and have no idea where I could start :( Therefore pointers would be more than welcome. Take care, Raienr
Sorry for getting back very late. The idea is:
- Distribute portable full Python binaries, in a similar way we distribute sphinx-binary.
- The plugin downloads the Python binary and creates a virtual environment with it.
- Install various Python modules including sphinx into the virtual environment.
I didn't figure out how to build a portable Python distribution yet, though..
One workaround is to put your extensions in <sphinx_site_dir>/_extensions and add the following statement to conf.py:
sys.path.append(os.path.abspath('_extensions'))
A working example: https://github.com/line/armeria/tree/armeria-0.68.2/site/src/sphinx
@rainer-steinegger I'm curious copying your extensions to your site sources and updating sys.path solves your problem.
adding extensions is possible, but as far as i understand you have to deal with all direct or transitive dependencies manually, which makes including extensions quite erroneous and not so comfortable to do. e.g. i'm trying to include sphinx-toolbox (https://github.com/sphinx-toolbox/sphinx-toolbox) at the moment and there's the need to add other extensions like apeye, deprecation, deprecation_alias, typing_extensions, ..... an alternative is to install the desired extension via python/pip locally and copy the result (from python/lib/site-packages) as extensions.