Skip to main content

Tutorial edition framework

Project description

Gepetuto

PyPI version pre-commit.ci status Tests Release

Ruff uv

Tutorial edition framework

This project contains some tools to help authoring and maintaing python tutorials presented on notebooks.

Install

Add gepetuto in your pip / PyPI dependencies

Usage

  1. create a (eg. tp1) directory (tp0 can be used to check prerequisites)
  2. write python scripts (eg. example_script.py) in this directory
  3. delimit snippets inside those scripts between # %jupyter_snippet example_snippet and # %end_jupyter_snippet
  4. create a (eg. 1-example_notebook.ipynb) notebook, containing import gepetuto.magic
  5. run gepetuto -a generate: this will create a tp{i}/generated directory with eg. example_script_example_snippet
  6. cells can contain either eg. %load tp1/generated/example_script_example_snippet to display some code to students, or their %do_not_load version to let the student write the code themself
  7. run gepetuto -a test to check all python scripts in tp directories
  8. run gepetuto -a lint to ensure the coding standards are respected in all python scripts in tp directories
  9. add gepetuto -a test in your CI, and gepetuto -a lint + gepetuto -a generate in your pre-commit

Command line

$ gepetuto -h
usage: gepetuto [-h] [-q] [-v] [-a [{lint,test,generate,all}]] [-f [FILE ...]] [-F [FILTER ...]]
                [-p PYTHON] [-c] [-C DIRECTORY] [--version] [tp_id ...]

Tutorial edition framework

positional arguments:
  tp_id                 choose which tp to process. Default to all.

options:
  -h, --help            show this help message and exit
  -q, --quiet           decrement verbosity level
  -v, --verbose         increment verbosity level
  -a, --action [{lint,test,generate,all}]
                        choose what to do. Default to 'generate'.
  -f, --file [FILE ...]
                        choose which files to process.
  -F, --filter [FILTER ...]
                        filter files to process.
  -p, --python PYTHON   choose python interpreter to use.
  -c, --check           check if linters change files.
  -C, --directory DIRECTORY
                        choose directory to run action on.
  --version             Get gepetuto version.

CI Example

example of CI using all gepetuto actions on tests folder here :

Pre commit example

- repo: https://github.com/Gepetto/gepetuto
  rev: v2.0.3
  hooks:
  - id: generate-action
  - id: lint-action
  - id: test-action

Examples

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

gepetuto-2.0.3.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

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

gepetuto-2.0.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file gepetuto-2.0.3.tar.gz.

File metadata

  • Download URL: gepetuto-2.0.3.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gepetuto-2.0.3.tar.gz
Algorithm Hash digest
SHA256 f0d4c8082467c1912f74658b48ef48f0af742318ae0ab28c6c39822d66cebe50
MD5 c53b796a300de6fabfa211d2b404ea08
BLAKE2b-256 cd040fd02b9f3a0c56e55d3a4ae782241b1a8e61324c981db9c40d83217b3f5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gepetuto-2.0.3.tar.gz:

Publisher: release.yml on Gepetto/gepetuto

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

File details

Details for the file gepetuto-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: gepetuto-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gepetuto-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dce5ed4da305aad65149296d9379b462ac6187fc260dfbd7f29927de3ce9c427
MD5 1eb136d0136f295623b7bf7cd1c405c9
BLAKE2b-256 4bfb70d71ac626ae4cf5bae070c7752d648c36790282337d4905a7b7a04b5873

See more details on using hashes here.

Provenance

The following attestation bundles were made for gepetuto-2.0.3-py3-none-any.whl:

Publisher: release.yml on Gepetto/gepetuto

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