# Gepetuto
[![PyPI version](https://badge.fury.io/py/gepetuto.svg)](https://pypi.org/project/gepetuto)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gepetto/gepetuto/main.svg)](https://results.pre-commit.ci/latest/github/gepetto/gepetuto/main)
[![Tests](https://github.com/gepetto/gepetuto/actions/workflows/tests.yml/badge.svg)](https://github.com/gepetto/gepetuto/actions/workflows/tests.yml)
[![Release](https://github.com/gepetto/gepetuto/actions/workflows/release.yml/badge.svg)](https://github.com/gepetto/gepetuto/actions/workflows/release.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
## 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] [-v] [-a [{lint,test,generate,all}]] [-f [FILE [FILE ...]]] [-F [FILTER [FILTER ...]]]
[-p PYTHON] [-c] [-C DIRECTORY] [--version] [tp_id [tp_id ...]]
Tutorial edition framework
positional arguments:
tp_id choose which tp to process. Default to all.
optional arguments:
-h, --help show this help message and exit
-v, --verbose increment verbosity level
-a [{lint,test,generate,all}], --action [{lint,test,generate,all}]
choose what to do. Default to 'generate'.
-f [FILE [FILE ...]], --file [FILE [FILE ...]]
choose which files to process.
-F [FILTER [FILTER ...]], --filter [FILTER [FILTER ...]]
filter files to process.
-p PYTHON, --python PYTHON
choose python interpreter to use.
-c, --check check if linters change files.
-C DIRECTORY, --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 :
- https://github.com/Gepetto/gepetuto/blob/main/.github/workflows/tests.yml
## Pre commit example
```
- repo: https://github.com/Gepetto/gepetuto
rev: v1.3.0
hooks:
- id: generate-action
- id: lint-action
- id: test-action
```
## Examples
- https://github.com/gepetto/supaero2023
- https://github.com/nmansard/jnrh2023
Raw data
{
"_id": null,
"home_page": "https://github.com/gepetto/gepetuto",
"name": "gepetuto",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Guilhem Saurel",
"author_email": "guilhem.saurel@laas.fr",
"download_url": "https://files.pythonhosted.org/packages/a5/13/3f4a083486810d5677c52c37bb9e82c5d2d0e35407133febcbb18b5b8622/gepetuto-1.3.0.tar.gz",
"platform": null,
"description": "# Gepetuto\n\n[![PyPI version](https://badge.fury.io/py/gepetuto.svg)](https://pypi.org/project/gepetuto)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gepetto/gepetuto/main.svg)](https://results.pre-commit.ci/latest/github/gepetto/gepetuto/main)\n[![Tests](https://github.com/gepetto/gepetuto/actions/workflows/tests.yml/badge.svg)](https://github.com/gepetto/gepetuto/actions/workflows/tests.yml)\n[![Release](https://github.com/gepetto/gepetuto/actions/workflows/release.yml/badge.svg)](https://github.com/gepetto/gepetuto/actions/workflows/release.yml)\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n\n## Tutorial edition framework\n\nThis project contains some tools to help authoring and maintaing python tutorials presented on notebooks.\n\n## Install\n\nAdd `gepetuto` in your pip / PyPI dependencies\n\n## Usage\n\n1. create a (eg. `tp1`) directory (`tp0` can be used to check prerequisites)\n2. write python scripts (eg. `example_script.py`) in this directory\n3. delimit snippets inside those scripts between `# %jupyter_snippet example_snippet` and `# %end_jupyter_snippet`\n4. create a (eg. `1-example_notebook.ipynb`) notebook, containing `import gepetuto.magic`\n5. run `gepetuto -a generate`: this will create a `tp{i}/generated` directory with eg. `example_script_example_snippet`\n6. cells can contain either eg. `%load tp1/generated/example_script_example_snippet` to display some code to students,\n or their `%do_not_load` version to let the student write the code themself\n7. run `gepetuto -a test` to check all python scripts in tp directories\n8. run `gepetuto -a lint` to ensure the coding standards are respected in all python scripts in tp directories\n9. add `gepetuto -a test` in your CI, and `gepetuto -a lint` + `gepetuto -a generate` in your pre-commit\n\n### Command line\n\n```\n$ gepetuto -h\nusage: gepetuto [-h] [-v] [-a [{lint,test,generate,all}]] [-f [FILE [FILE ...]]] [-F [FILTER [FILTER ...]]]\n [-p PYTHON] [-c] [-C DIRECTORY] [--version] [tp_id [tp_id ...]]\n\nTutorial edition framework\n\npositional arguments:\n tp_id choose which tp to process. Default to all.\n\noptional arguments:\n -h, --help show this help message and exit\n -v, --verbose increment verbosity level\n -a [{lint,test,generate,all}], --action [{lint,test,generate,all}]\n choose what to do. Default to 'generate'.\n -f [FILE [FILE ...]], --file [FILE [FILE ...]]\n choose which files to process.\n -F [FILTER [FILTER ...]], --filter [FILTER [FILTER ...]]\n filter files to process.\n -p PYTHON, --python PYTHON\n choose python interpreter to use.\n -c, --check check if linters change files.\n -C DIRECTORY, --directory DIRECTORY\n choose directory to run action on.\n --version Get gepetuto version.\n```\n\n## CI Example\n\nexample of CI using all gepetuto actions on tests folder here :\n- https://github.com/Gepetto/gepetuto/blob/main/.github/workflows/tests.yml\n\n## Pre commit example\n\n```\n- repo: https://github.com/Gepetto/gepetuto\n rev: v1.3.0\n hooks:\n - id: generate-action\n - id: lint-action\n - id: test-action\n```\n\n\n## Examples\n\n- https://github.com/gepetto/supaero2023\n- https://github.com/nmansard/jnrh2023\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "Tutorial edition framework",
"version": "1.3.0",
"project_urls": {
"Homepage": "https://github.com/gepetto/gepetuto",
"changelog": "https://github.com/gepetto/gepetuto/blob/main/CHANGELOG.md"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5930f0946bf3aca88f7a7945558a994be58e77cd2db6ee14f57a951777fb5cfd",
"md5": "305a9c07e0fbcc474b4d21d34eacd15f",
"sha256": "db5b9024d36a29f4cbff67e443d749eda7678ed9f62b3d098e338d065c1def26"
},
"downloads": -1,
"filename": "gepetuto-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "305a9c07e0fbcc474b4d21d34eacd15f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 9033,
"upload_time": "2023-08-23T11:45:09",
"upload_time_iso_8601": "2023-08-23T11:45:09.583985Z",
"url": "https://files.pythonhosted.org/packages/59/30/f0946bf3aca88f7a7945558a994be58e77cd2db6ee14f57a951777fb5cfd/gepetuto-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a5133f4a083486810d5677c52c37bb9e82c5d2d0e35407133febcbb18b5b8622",
"md5": "ad969ccc41ffcfce42eee5eee88b3354",
"sha256": "599936116bec319897a4042c487a121747de2f944356f0c3c3c9c4a6e0af70ac"
},
"downloads": -1,
"filename": "gepetuto-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "ad969ccc41ffcfce42eee5eee88b3354",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 8104,
"upload_time": "2023-08-23T11:45:11",
"upload_time_iso_8601": "2023-08-23T11:45:11.063872Z",
"url": "https://files.pythonhosted.org/packages/a5/13/3f4a083486810d5677c52c37bb9e82c5d2d0e35407133febcbb18b5b8622/gepetuto-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-23 11:45:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gepetto",
"github_project": "gepetuto",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gepetuto"
}