Skip to main content

This Sphinx extension allows for the `feature-flag` directive to hide/show content based on build-time flags.

Reason this release was yanked:

Init setup fault

Project description

Sphinx Extension: Feature Flags

PyPI PyPI - License

Description

This Sphinx extension allows for the feature-flag directive to show (if True) or fallback (if False and using the :fallback: option).

Setup

  1. Add the following to your conf.py:

    import sys, os
    
    sys.path.append(os.path.abspath(os.path.join('_extensions', 'sphinx_feature_flags')))
    extensions = ['sphinx_feature_flags']
    
    feature_flags = {
        'production-stage': False,  # Example
    }
    

Usage

In any .rst file, wrap the feature-flag directive around any block:

```rst
.. feature-flag:: dev-debug-mode

   This only shows if production-stage = True; it can be an entire toctree, too!

.. feature-flag:: dev-debug-mode
   :fallback:

   This only shows if production-stage = False.
```

Requirements

  • Python>=3.6
  • Sphinx>=1.8

This may work with older versions, but has not been tested.

Entry Point

See setup(app) definition at sphinx_feature_flags.py.

Tested in

  • Windows 11 via PowerShell 7
  • Ubuntu 22.04 via ReadTheDocs (RTD) CI

Notes

  • __init__.py is required for both external pathing and to treat the directory as a pkg

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_feature_flags-1.0.5.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

sphinx_feature_flags-1.0.5-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_feature_flags-1.0.5.tar.gz.

File metadata

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

File hashes

Hashes for sphinx_feature_flags-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b1ef6a48a6889ce1f077563d0b25a3836bf5115fcea8acb15cca75a783d9963a
MD5 2c715a5e850e7146a71e49b765583a18
BLAKE2b-256 d0fd3af6f3cce3957a85a0b3e0ec8086dd0a327bc05cab07a955cdc0a3bfabf7

See more details on using hashes here.

File details

Details for the file sphinx_feature_flags-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_feature_flags-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 840417c67b7b2464885028e150d925dfb7faa888e1a34c33e39d616fe0bf8d8c
MD5 5b3d03983c5997e9a02a28498bd48c64
BLAKE2b-256 699ca541c6deb4571c97b00fe5df6d3af73e6aa3fd4c5a7175d550a7633e7335

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