pyupgrade-docs
Run pyupgrade on python code blocks in documentation files.
install
pip install pyupgrade-docs
usage
pyupgrade-docs provides a single executable (pyupgrade-docs) which will modify
.rst / .md / .tex files in place.
It currently supports the following pyupgrade
options:
--keep-percent-format--keep-mock--keep-runtime-typing--py3-plus--py3-only--py36-plus--py37-plus--py38-plus--py39-plus--py310-plus
The following additional parameters can be used:
-E/--skip-errors
pyupgrade-docs will format code in the following block types:
(markdown)
```python
def hello():
print("hello world")
```
(markdown pycon)
```pycon
>>> def hello():
... print("hello world")
...
```
(rst)
.. code-block:: python
def hello():
print("hello world")
(rst pycon)
.. code-block:: pycon
>>> def hello():
... print("hello world")
...
(latex)
\begin{minted}{python}
def hello():
print("hello world")
\end{minted}
(latex pycon)
\begin{minted}{pycon}
>>> def hello():
... print("hello world")
...
\end{minted}
(latex with pythontex)
\begin{pycode}
def hello():
print("hello world")
\end{pycode}
(markdown/rst in python docstrings)
def f():
"""docstring here
.. code-block:: python
print("hello world")
```python
print("hello world")
```
"""
usage with pre-commit
See pre-commit for instructions
Sample .pre-commit-config.yaml:
- repo: https://github.com/verhovsky/pyupgrade-docs
rev: v0.3.0
hooks:
- id: pyupgrade-docs
Metadata
Release files for pyupgrade-docs 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyupgrade_docs-0.3.0.tar.gz | 5.2 kB | Without provenance | Details for pyupgrade_docs-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyupgrade_docs-0.3.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pyupgrade_docs-0.3.0-py2.py3-none-any.whl |
Total release size: 10.7 kB
Release files / pyupgrade_docs-0.3.0.tar.gz
| Download URL | pyupgrade_docs-0.3.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70d0ac07e986611fc444cd33cb6f1b24c4cdd4717253ce84a88dd4c3487ebd08
|
|
BLAKE2b-256 checksum How to use checksums |
7f6c1266b48faa6e12663369179bcfd777a56247d3390e8f93f38a6c5e39edeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10
|
Release files / pyupgrade_docs-0.3.0-py2.py3-none-any.whl
| Download URL | pyupgrade_docs-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
346808225a2230cede1fd367d994ea0618a4d3e300c018a1df4d6ae6ed784ce9
|
|
BLAKE2b-256 checksum How to use checksums |
9cb03cdd267e487ff1869268fd9a63bfff7e0e516a698439e18f01ddddb7a080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10
|
Security for pyupgrade-docs 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.