Skip to content Skip to sidebar Skip to footer

Use Sphinx Within A Serverless Model

I am currently using sphinx to automatically generate my documentation site from ReStructuredText files within a bitbucket repo. This is of course all managed/hosted internally but

Solution 1:

Instead of executing sphinx-build from the command line, you can generate output by using a sphinx.application.Sphinx object directly.

A basic example:

import os
from sphinx.application import Sphinx

# Main arguments 
srcdir = "/path/to/source"
confdir = srcdir
builddir = os.path.join(srcdir, "_build")
doctreedir = os.path.join(builddir, "doctrees")
builder = "html"# Create the Sphinx application object
app = Sphinx(srcdir, confdir, builddir, doctreedir, builder)

# Run the build
app.build()

Post a Comment for "Use Sphinx Within A Serverless Model"