# PyExec
[](http://sphinxcontrib-pyexec.readthedocs.io/en/latest/?badge=latest) [](https://travis-ci.org/3ptscience/sphinxcontrib-pyexec)
A sphinx extension for running python code and displaying both the input and
output [sphinx documentation](http://www.sphinx-doc.org/).
In the conf.py add `PyExec` to your extensions.
In the ReStructuredText file, use the `exec` environment
```
.. exec::
print 2 + 2
```
To output python code & the results in your documentation.
```
>> print 2 + 2
4
```
Note that you need to include the `print` statement for the output to be shown. To see it in action, checkout the [Properties documentation](http://propertiespy.readthedocs.io/).
Based on
- https://github.com/sphinx-doc/sphinx/blob/master/sphinx/directives/code.py
- http://stackoverflow.com/a/18143318/6086999
[](http://sphinxcontrib-pyexec.readthedocs.io/en/latest/?badge=latest) [](https://travis-ci.org/3ptscience/sphinxcontrib-pyexec)
A sphinx extension for running python code and displaying both the input and
output [sphinx documentation](http://www.sphinx-doc.org/).
In the conf.py add `PyExec` to your extensions.
In the ReStructuredText file, use the `exec` environment
```
.. exec::
print 2 + 2
```
To output python code & the results in your documentation.
```
>> print 2 + 2
4
```
Note that you need to include the `print` statement for the output to be shown. To see it in action, checkout the [Properties documentation](http://propertiespy.readthedocs.io/).
Based on
- https://github.com/sphinx-doc/sphinx/blob/master/sphinx/directives/code.py
- http://stackoverflow.com/a/18143318/6086999
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sphinxcontrib-pyexec-0.0.4.tar.gz.
File metadata
- Download URL: sphinxcontrib-pyexec-0.0.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
306a1481f2eb3f5f9ef274a3b15843c6f77db0b414970b2c2a9ff6ecf22f9a19
|
|
| MD5 |
638b08e655d1ad413adc2d94cec039a5
|
|
| BLAKE2b-256 |
8d2dd020aaf5b45b3a7ca316c9c217273be04adda5096b1283ae96dccb9f0dea
|