sphinx-gradle-plugin icon indicating copy to clipboard operation
sphinx-gradle-plugin copied to clipboard

Support of other Sphinx extensions

Open rainer-steinegger opened this issue 7 years ago • 8 comments

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

rainer-steinegger avatar Jul 04 '18 11:07 rainer-steinegger

That's correct. It's definitely possible though if we only ship CPython + pip and then build sphinx lazily in a virtual environment.

trustin avatar Jul 04 '18 11:07 trustin

Opening again since I'm interested making this come true.

trustin avatar Jul 06 '18 12:07 trustin

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

rainer-steinegger avatar Jul 09 '18 08:07 rainer-steinegger

Sorry for getting back very late. The idea is:

  1. Distribute portable full Python binaries, in a similar way we distribute sphinx-binary.
  2. The plugin downloads the Python binary and creates a virtual environment with it.
  3. Install various Python modules including sphinx into the virtual environment.

I didn't figure out how to build a portable Python distribution yet, though..

trustin avatar Aug 13 '18 03:08 trustin

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'))

trustin avatar Aug 13 '18 05:08 trustin

A working example: https://github.com/line/armeria/tree/armeria-0.68.2/site/src/sphinx

trustin avatar Aug 13 '18 05:08 trustin

@rainer-steinegger I'm curious copying your extensions to your site sources and updating sys.path solves your problem.

trustin avatar Dec 07 '18 02:12 trustin

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.

oliva123456 avatar Apr 06 '22 10:04 oliva123456