# sphinx-exec-code
![Tests Status](https://github.com/spacemanspiff2007/sphinx-exec-code/workflows/Tests/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/sphinx-exec-code/badge/?version=latest)](https://sphinx-exec-code.readthedocs.io/en/latest/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-exec-code)
![PyPI](https://img.shields.io/pypi/v/sphinx-exec-code)
[![Downloads](https://pepy.tech/badge/sphinx-exec-code/month)](https://pepy.tech/project/sphinx-exec-code)
_A Sphinx extension to run python code in the documentation_
## About
Sphinx-exec-code allows execution of any python code during the documentation build.
It's also possible to display the output of the code execution.
With this extension it's easy to ensure that the provided code samples are always working.
Additionally, it's possible to show the output of the documented code.
Each code snippet runs in a fresh interpreter so changes to not leak between executions.
## Documentation
[The full documentation can be found at here](https://sphinx-exec-code.readthedocs.io)
## Quick Example
````text
.. exec-code::
print('This code will be executed')
````
generates
```python
print('This code will be executed')
```
```
This code will be executed
```
# Changelog
#### 0.14 (2024-11-15)
- Add support for all options from code block
- Reworked how blocks and options are processed
#### 0.13 (2024-10-15)
- Add support for python 3.13
#### 0.12 (2024-01-09)
- Error when providing invalid options
#### 0.11 (2024-01-09)
- Updated CI and ruff fixes
#### 0.10 (2023-02-13)
- Fixed a bug when no code was shown/executed
#### 0.9 (2023-02-08)
- If the whole shown code block is indented the indention is removed
#### 0.8 (2022-07-18)
- Renamed ``exec_code_folders`` to ``exec_code_source_folders``
- Changed type of parameter to specify stdout to a flag
- Changed default for config parameter that sets encoding
- Dropped support for Python 3.7
#### 0.7 (2022-07-15)
- Added config parameter to specify stdout encoding
- Only empty lines of the output get trimmed
#### 0.6 (2022-04-04)
- Fixed an issue where the line numbers for error messages were not correct
#### 0.5 (2022-03-10)
- Marked as safe for parallel reading
#### 0.4 (2022-03-09)
- Added option to run code from example files
#### 0.3 (2021-09-24)
- Added some more documentation and fixed some false path warnings
#### 0.2 (2021-09-21)
- Initial Release
Raw data
{
"_id": null,
"home_page": "https://github.com/spacemanspiff2007/sphinx-exec-code",
"name": "sphinx-exec-code",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "sphinx, execute, exec, code",
"author": "spaceman_spiff",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9a/d7/df7c94bd0edbc52646517453373d59de054e90bbbdb572b3190549239bef/sphinx_exec_code-0.14.tar.gz",
"platform": null,
"description": "# sphinx-exec-code\n![Tests Status](https://github.com/spacemanspiff2007/sphinx-exec-code/workflows/Tests/badge.svg)\n[![Documentation Status](https://readthedocs.org/projects/sphinx-exec-code/badge/?version=latest)](https://sphinx-exec-code.readthedocs.io/en/latest/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-exec-code)\n![PyPI](https://img.shields.io/pypi/v/sphinx-exec-code)\n[![Downloads](https://pepy.tech/badge/sphinx-exec-code/month)](https://pepy.tech/project/sphinx-exec-code)\n\n_A Sphinx extension to run python code in the documentation_\n\n## About\nSphinx-exec-code allows execution of any python code during the documentation build.\nIt's also possible to display the output of the code execution.\n\nWith this extension it's easy to ensure that the provided code samples are always working.\nAdditionally, it's possible to show the output of the documented code.\n\nEach code snippet runs in a fresh interpreter so changes to not leak between executions.\n\n## Documentation\n[The full documentation can be found at here](https://sphinx-exec-code.readthedocs.io)\n\n\n## Quick Example\n\n````text\n.. exec-code::\n\n print('This code will be executed')\n````\ngenerates\n```python\nprint('This code will be executed')\n```\n```\nThis code will be executed\n```\n\n# Changelog\n#### 0.14 (2024-11-15)\n- Add support for all options from code block\n- Reworked how blocks and options are processed\n\n#### 0.13 (2024-10-15)\n- Add support for python 3.13\n\n#### 0.12 (2024-01-09)\n- Error when providing invalid options\n\n#### 0.11 (2024-01-09)\n- Updated CI and ruff fixes\n\n#### 0.10 (2023-02-13)\n- Fixed a bug when no code was shown/executed\n\n#### 0.9 (2023-02-08)\n- If the whole shown code block is indented the indention is removed\n\n#### 0.8 (2022-07-18)\n- Renamed ``exec_code_folders`` to ``exec_code_source_folders``\n- Changed type of parameter to specify stdout to a flag\n- Changed default for config parameter that sets encoding\n- Dropped support for Python 3.7\n\n#### 0.7 (2022-07-15)\n- Added config parameter to specify stdout encoding\n- Only empty lines of the output get trimmed\n\n#### 0.6 (2022-04-04)\n- Fixed an issue where the line numbers for error messages were not correct\n\n#### 0.5 (2022-03-10)\n- Marked as safe for parallel reading\n\n#### 0.4 (2022-03-09)\n- Added option to run code from example files\n\n#### 0.3 (2021-09-24)\n- Added some more documentation and fixed some false path warnings\n\n#### 0.2 (2021-09-21)\n- Initial Release\n",
"bugtrack_url": null,
"license": null,
"summary": "Execute code blocks in Sphinx and display the output",
"version": "0.14",
"project_urls": {
"Documentation": "https://sphinx-exec-code.readthedocs.io/",
"GitHub": "https://github.com/spacemanspiff2007/sphinx-exec-code",
"Homepage": "https://github.com/spacemanspiff2007/sphinx-exec-code"
},
"split_keywords": [
"sphinx",
" execute",
" exec",
" code"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6b5f481d741f641c7d0ffdf71f871c7c7abb1a8cfaf9dd7045cfd7172d102f08",
"md5": "62f81419e8d31be09c6cec92350695aa",
"sha256": "a19fda820a3b80d4ca51dadb5d7f755dee0fbeb44ea944c14e0473a6c22f1bcf"
},
"downloads": -1,
"filename": "sphinx_exec_code-0.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "62f81419e8d31be09c6cec92350695aa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16739,
"upload_time": "2024-11-15T13:55:37",
"upload_time_iso_8601": "2024-11-15T13:55:37.627508Z",
"url": "https://files.pythonhosted.org/packages/6b/5f/481d741f641c7d0ffdf71f871c7c7abb1a8cfaf9dd7045cfd7172d102f08/sphinx_exec_code-0.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9ad7df7c94bd0edbc52646517453373d59de054e90bbbdb572b3190549239bef",
"md5": "17ef0828b91839afaf2084132b620095",
"sha256": "946eb791e1a4a4866175a6c64f2bc426a15d88e7f47465825793233175aa642c"
},
"downloads": -1,
"filename": "sphinx_exec_code-0.14.tar.gz",
"has_sig": false,
"md5_digest": "17ef0828b91839afaf2084132b620095",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15955,
"upload_time": "2024-11-15T13:55:40",
"upload_time_iso_8601": "2024-11-15T13:55:40.324625Z",
"url": "https://files.pythonhosted.org/packages/9a/d7/df7c94bd0edbc52646517453373d59de054e90bbbdb572b3190549239bef/sphinx_exec_code-0.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-15 13:55:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spacemanspiff2007",
"github_project": "sphinx-exec-code",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pre-commit",
"specs": [
[
"==",
"3.5.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.4.4"
]
]
},
{
"name": "sphinx",
"specs": [
[
"==",
"7.4.7"
]
]
},
{
"name": "sphinx",
"specs": [
[
"==",
"7.1.2"
]
]
},
{
"name": "pre-commit",
"specs": [
[
"==",
"4.0.1"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"8.3.3"
]
]
},
{
"name": "sphinx",
"specs": [
[
"==",
"8.1.3"
]
]
},
{
"name": "ruff",
"specs": [
[
"==",
"0.6.9"
]
]
},
{
"name": "sphinx-rtd-theme",
"specs": [
[
"==",
"3.0.1"
]
]
}
],
"tox": true,
"lcname": "sphinx-exec-code"
}