Skip to main content

This Sphinx extension by Xsolla Backend [XBE] automates the management of multiple documentation repositories as part of building a larger, unified documentation system. It facilitates multi-threaded cloning and updating of external repositories specified in a YAML manifest file before Sphinx builds.

Project description

Sphinx Extension: Repository Manager

PyPI PyPI - License

About

This Sphinx extension by Xsolla Backend [XBE] automates the management of multiple documentation repositories as part of building a larger, unified documentation system. It facilitates multithreaded cloning and updating of external repositories specified in a YAML manifest file before Sphinx builds.

Demo (GIF)

📜 See the XBE docgen source code and demo doc production site heavily making use of this extension. Here, you may also find tips for how to utilize this extension to its greatest capabilities.

See how it works or quickstart below >>

Installation

This guide assumes you have a basic understanding of Sphinx and RST

Add to Existing Project

  1. Install the extension via pip:

     pip install sphinx-repo-manager
    
  2. Add extension to your project's docs/source/conf.py (example template):

    extensions = [ "sphinx_repo_manager" ] ,  # https://pypi.org/project/sphinx-repo-manager
    
  3. Ensure a docs/.env file exists next to your Makefile -> set REPO_AUTH_TOKEN=

  4. Create a docs/repo_manifest.yml (example template) next to your Makefile

    • 💡 Optionally, set the manifest max_workers_local to a higher number for faster local builds [even 30 is ok for high-end machines!]

Once setup, sphinx-build as normal (typically via make html next to your Makefile)!

Tips

  • Windows user? You may want to unlock your max char paths by running tools/admin-enable-long-file-paths.ps1 as admin
  • Editing the manifest?
    • Consider purging your docs/source/_repos-available and docs/source/content dirs
  • Want speedier build iterations?
    • Test bumping up your max_workers_local counts - even significantly higher - for high-end machines!

Demos

Minimal Demo

  1. Clone the source repo for a demo:
  • Minimal build architecture begins at at docs/
  • repo_manifest.yml contains a minimal sphinx_demo_doc repo to be cloned

Production Demo

Alternately, see sphinx_repo_manager used by Xsolla Backend at a production-grade level:


How it Works

  1. repo_manifest.yml lists repositories with their respective clone URLs [and optional rules].
  2. docs/source/ creates _repos-available (src repos) and content (symlinked) dirs.
  3. Upon running sphinx-build (commonly via make html), the extension either clones or updates each repo defined within the manifest.
  4. Source clones will sparse checkout and symlink to the content dir, allowing for flexibility such as custom entry points and custom names (such as for shorter url slugs).
  5. All repos in the manifest will be organized in a monolithic doc.

💡 If you want to store local content (eg, static .rst), add it to source/_source-docs/

💡 The only RST file expected for your monolithic repo is the index.rst file (next to your conf.py)

⌛ 5 local workers (default) will take only ~50s to process 30 repos with default manifest settings

Tests

Confirmed compatability with:

  • Windows 11 via PowerShell 7, WSL2 (bash)
  • Ubuntu 22.04 via ReadTheDocs (RTD) CI, Docker Desktop
  • Python 3.10, 3.12
  • Sphinx 7.3.7, 8.1.3

Questions?

Join the Xsolla Backend official Discord guild!

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_repo_manager-1.0.27.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_repo_manager-1.0.27-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_repo_manager-1.0.27.tar.gz.

File metadata

  • Download URL: sphinx_repo_manager-1.0.27.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for sphinx_repo_manager-1.0.27.tar.gz
Algorithm Hash digest
SHA256 145348fbc4b809190359aa4b2413bdc62ea5b71c173ae0f40996684a24b57486
MD5 cb80fa07220fe173345a12ad26f6f1c3
BLAKE2b-256 ff8e474741bf726cbe4fca32663aa85788df18e0489b89b84a29e70e9393be56

See more details on using hashes here.

File details

Details for the file sphinx_repo_manager-1.0.27-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_repo_manager-1.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 301beea94bab0b92c04e43b397d315518a342c77f3219b45d052dfc5a297c34a
MD5 28c384e15f22b654528749df8ce4fbf2
BLAKE2b-256 7b54c79a74fb3c09785adac3e0191453551512be4f00ac2f1469632b965f235a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page