2023-09-03 17:08:42 -04:00
|
|
|
:author: Adam Turner
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
Building PEPs Locally
|
|
|
|
=====================
|
|
|
|
|
|
|
|
Whilst editing a PEP, it is useful to review the rendered output locally.
|
|
|
|
This can also be used to check that the PEP is valid reStructuredText before
|
|
|
|
submission to the PEP editors.
|
|
|
|
|
|
|
|
The rest of this document assumes you are working from a local clone of the
|
2023-09-03 17:08:42 -04:00
|
|
|
`PEPs repository <https://github.com/python/peps>`__,
|
|
|
|
with **Python 3.9 or later** installed.
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
Render PEPs locally
|
|
|
|
-------------------
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
1. Create a virtual environment and install requirements:
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
.. code-block:: shell
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
make venv
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
If you don't have access to ``make``, run:
|
|
|
|
|
|
|
|
.. code-block:: ps1con
|
|
|
|
|
|
|
|
PS> python -m venv .venv
|
|
|
|
PS> .\.venv\Scripts\activate
|
|
|
|
(venv) PS> python -m pip install --upgrade pip
|
|
|
|
(venv) PS> python -m pip install -r requirements.txt
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
2. **(Optional)** Delete prior build files.
|
|
|
|
Generally only needed when making changes to the rendering system itself.
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
.. code-block:: shell
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
rm -rf build
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
3. Run the build script:
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
.. code-block:: shell
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2023-04-09 03:43:55 -04:00
|
|
|
make html
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
If you don't have access to ``make``, run:
|
|
|
|
|
|
|
|
.. code-block:: ps1con
|
|
|
|
|
|
|
|
(venv) PS> python build.py
|
|
|
|
|
|
|
|
4. Navigate to the ``build`` directory of your PEPs repo to find the HTML pages.
|
|
|
|
PEP 0 provides a formatted index, and may be a useful reference.
|
|
|
|
|
|
|
|
|
|
|
|
``build.py`` tools
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Several additional tools can be run through ``build.py``, or the Makefile.
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
Note that before using ``build.py`` you must activate the virtual environment
|
|
|
|
created earlier:
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
source .venv/bin/activate
|
|
|
|
|
|
|
|
Or on Windows:
|
|
|
|
|
|
|
|
.. code-block:: ps1con
|
|
|
|
|
|
|
|
PS> .\.venv\Scripts\activate
|
|
|
|
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
Check links
|
|
|
|
'''''''''''
|
|
|
|
|
|
|
|
Check the validity of links within PEP sources (runs the `Sphinx linkchecker
|
|
|
|
<https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder>`__).
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
.. code-block:: shell
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2023-09-03 17:08:42 -04:00
|
|
|
python build.py --check-links
|
2023-11-03 03:24:48 -04:00
|
|
|
make linkcheck
|
2022-01-16 17:33:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
``build.py`` usage
|
|
|
|
------------------
|
|
|
|
|
|
|
|
For details on the command-line options to the ``build.py`` script, run:
|
|
|
|
|
2022-04-16 06:46:31 -04:00
|
|
|
.. code-block:: shell
|
2022-01-16 17:33:05 -05:00
|
|
|
|
2023-09-03 17:08:42 -04:00
|
|
|
python build.py --help
|