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.6.tar.gz (3.4 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.6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx_feature_flags-1.0.6.tar.gz
  • Upload date:
  • Size: 3.4 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.6.tar.gz
Algorithm Hash digest
SHA256 82cf6fe3d13833f2c8954006d6bca2929597abb48d173eeb063a3fcd0005fda1
MD5 60fe011e5cf351b189c22901cca96bcb
BLAKE2b-256 dfc5ec38e91be40f883279136d1e2930c63446c2e30c51f10ad5ab50a301e51a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sphinx_feature_flags-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 81d8ca11400483d37188a88e33f35f12e7702ec1dc0bcba93cede810e600cd03
MD5 e346a3c9112b36d286505aaf23b0f689
BLAKE2b-256 a390c6d50f12cc6cd18210e55679ad75b9fbb3573ec212c406dcf5e837fc2b7f

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