Skip to main content

A Sphinx extension for embedding interactive demo using The Python Playground

Project description

sphinxcontrib-playground ci

A Sphinx extension to embed interactive demo examples with The Python Playground.

Install with pip:

pip install sphinxcontrib-playground

Include below options in conf.py:

playground_options = {
    'commit_sha': subprocess.check_output(['git', 'rev-parse', 'HEAD'], encoding='utf-8').strip(),
    'github_repo': 'github repo in string'  # e.g. ydcjeff/sphinxcontrib-playground
    'url': 'https://python-playground.netlify.app'  # playground url (you should have your own playground forked from The Python Playground)
}

Use with .. playground:: directive:

.. playground:: path/to/the/python/file.py
      :title: Playground (Mandatory title - helpful for screen readers)

.. playground:: directive options:

  • title: Mandatory title for the embedding playground (helpful for screen readers)
  • height: Height of the embedding playground (default: 500)
  • with: Width of the embedding playground (default: 100%)

Souce code of this extension (Demo):

<iframe src='https://python-playground.netlify.app/?github.com/ydcjeff/sphinxcontrib-playground/blob/main/sphinxcontrib/playground.py' loading='lazy' allow='fullscreen' id='p-embed-sphinx-extension-playground' class='p-embed-iframe' name='p-embed-sphinx-extension-playground' width='100%' height='500' style='border: 1px solid #ddd;' title='A Sphinx extension for The Python Playground' ></iframe>

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

sphinxcontrib_playground-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file sphinxcontrib_playground-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_playground-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for sphinxcontrib_playground-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6cdc97413409fe5b243d93f2c372e7dc9ab1572e9486052505d0c4d74080aa5
MD5 01d37ef8be67070a968188f9ba81d7dc
BLAKE2b-256 c1d511e16280d75802e827ff712ca007ce2aee24cce3fdea1d33f287557b9fe0

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