Skip to main content

A custom Sphinx extension to easily embed PRIME applets in a Sphinx book

Project description

Sphinx Extension: PRIME applets

Introduction

This extension provides an interface to include PRIME applets with relative ease.

What does it do?

This extension provides one Sphinx directives (applet) that can be used to quickly insert a PRIME applet.

Installation

To use this extension, follow these steps:

Step 1: Install the Package

Install the module sphinx-prime-applets package using pip:

pip install sphinx-prime-applets

Step 2: Add to requirements.txt

Make sure that the package is included in your project's requirements.txt to track the dependency:

sphinx-prime-applets

Step 3: Enable in _config.yml

In your _config.yml file, add the extension to the list of Sphinx extra extensions (important: underscore, not dash this time):

sphinx: 
    extra_extensions:
        .
        .
        .
        - sphinx_prime_applets
        .
        .
        .

Applet directive

```{applet}
:url: lines_and_planes/normal_equation_plane_origin
:fig: Images/image_shown_in_print_version.svg
:name: name_that_is_used_to_refer_to_this_figure
:class: dark-light
:title: This title is shown when you full-screen the applet

A plane through the point $P$.
```

[!NOTE] The url parameter should be the part of the URL after /applet/. So if the full URL is https://openla.ewi.tudelft.nl/applet/lines_and_planes/normal_equation_plane_origin, you should set the parameter to lines_and_planes/normal_equation_plane_origin.

Parameters for an applet

Some parameters can be set for an applet. Only the url and name parameters are required; the rest is optional. It is recommended to add a status to the applet, which can be unreviewed, in-review or reviewed.

```{applet}
:url: lines_and_planes/normal_equation_plane_origin # Required url
:fig: Images/lines_and_planes/normal_equation_plane_origin.svg  # Image shown in print version
:status: reviewed # default is "unreviewed". Other options are "in-review" and "reviewed"
:name: Fig:InnerProduct:ProjectionVectorLine

A title that describes the applet
```

Optional parameters

Parameter Description Default
fig The path to an image that will be shown in the print version of the document None
title A string that will be shown as the title of the applet when the applet is in fullscreen mode ""
status The status of the applet. Can be unreviewed, in-review or reviewed unreviewed
width The width of the applet in pixels 100%
height The height of the applet in pixels 400px

[!NOTE] If the fig parameter is not defined, the code will insert the image provided by the applet itself as a fallback.

Control parameters

[!WARNING] Work in progress

2D Specific parameters

[!TIP] You should add split-* before the parameter to make it apply to the right scene

Parameter Description Default
position2D The position of the applet in the 2D plane 0,0
zoom2D The zoom level of the applet in the 2D plane 1

3D Specific parameters

[!TIP] You should add split-* before the parameter to make it apply to the right scene

Parameter Description Default
position3D The position of the applet in the 3D plane 0,0,0
zoom3D The zoom level of the applet in the 3D plane 1

Contribute

This tool's repository is stored on GitHub. If you'd like to contribute, you can create a fork and open a pull request on the GitHub repository.

The README.md of the branch manual is also part of the TeachBooks manual as a submodule.

Metadata

By default the applet directive adds metadata to the figure node it creates. This metadata includes information such as author, license, copyright, and source. This information is useful for documentation and attribution purposes. If you want to disable this feature, you can set the prime_applets_metadata configuration option to False in your Sphinx configuration file.

[!NOTE] This extension always loads the extension sphinx_metadata_figure as it depends on it to add metadata to the figures. This means that also the configuration options of that extension are available and if this is not desired, you must disable the workings of that extensions by applying appropriate settings in metadata_figure_settings in your Sphinx configuration file. See the documentation of the sphinx_metadata_figure extension for more information.

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_prime_applets-1.2.1.tar.gz (10.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_prime_applets-1.2.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_prime_applets-1.2.1.tar.gz.

File metadata

  • Download URL: sphinx_prime_applets-1.2.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_prime_applets-1.2.1.tar.gz
Algorithm Hash digest
SHA256 62ca16bd29e1471532eaccba9c93f192fce97f975b88f535fc518d90a8097824
MD5 a12bb81f1baea5d1789b3cd9fea42dac
BLAKE2b-256 12b59441d4731da3f462ecf469afec53d8d0c26983776fe94c763e9e8f6fbc99

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_prime_applets-1.2.1.tar.gz:

Publisher: python-publish.yml on TeachBooks/Sphinx-PRIME-applets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_prime_applets-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_prime_applets-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9098a75b24ec612b3a85c37ef97388697017d9c2a48bd282bc895aa57ed9778
MD5 3c7a6192be385c548b696ecd5b792bc0
BLAKE2b-256 89db098d44bab5e25d0a5766a8703f61d9f71a490b6472af32f42dbddfcb40dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_prime_applets-1.2.1-py3-none-any.whl:

Publisher: python-publish.yml on TeachBooks/Sphinx-PRIME-applets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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