trustin / sphinx-gradle-plugin

Sphinx site generation plugin for Gradle
https://trustin.github.io/sphinx-gradle-plugin/
Apache License 2.0
18 stars 7 forks source link

Support of other Sphinx extensions #10

Open rainer-steinegger opened 6 years ago

rainer-steinegger commented 6 years ago

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

trustin commented 6 years ago

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

trustin commented 6 years ago

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

rainer-steinegger commented 6 years ago

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

trustin commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

trustin commented 5 years ago

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

oliva123456 commented 2 years ago

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.