10000 Use `:cpy-file:` throughout the Devguide by ezio-melotti · Pull Request #984 · python/devguide · GitHub
[go: up one dir, main page]

Skip to content

Use :cpy-file: throughout the Devguide #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use :cpy-file: throughout the Devguide.
  • Loading branch information
ezio-melotti committed Nov 14, 2022
commit 15c151775cdc18f662e92e5ae3b92f93a2fca00e
2 changes: 1 addition & 1 deletion core-developers/experts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while any other issues can and should be decided by any committer.

Developers can choose to follow labels, so if a label that they are
following is added to an issue or pull request, they will be notified
automatically. The :file:`CODEOWNERS` file is also used to indicate
automatically. The :cpy-file:`CODEOWNERS` file is also used to indicate
maintainers that will be automatically added as reviewers to pull requests.

Unless a name is followed by a '*', you should never assign an issue to
Expand Down
4 changes: 2 additions & 2 deletions developer-workflow/c-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ C API Tests
Tests for the public C API live in the ``_testcapi`` module.
Functions named ``test_*`` are used as tests directly.
Tests that need Python code (or are just easier to partially write in Python)
live in ``Lib/test``, mainly in :file:`Lib/test/test_capi.py`.
live in ``Lib/test``, mainly in :cpy-file:`Lib/test/test_capi.py`.

Due to its size, the ``_testcapi`` module is defined in several source
files.
To add a new set of tests (or extract a set out of the monolithic
:file:`Modules/_testcapimodule.c`):
:cpy-file:`Modules/_testcapimodule.c`):

- Create a C file named ``Modules/_testcapi/yourfeature.c``

Expand Down
49 changes: 26 additions & 23 deletions developer-workflow/grammar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Abstract
========

There's more to changing Python's grammar than editing
:file:`Grammar/python.gram`. Here's a checklist.
:cpy-file:`Grammar/python.gram`. Here's a checklist.

.. note::
These instructions are for Python 3.9 and beyond. Earlier
Expand All @@ -25,42 +25,45 @@ Checklist

Note: sometimes things mysteriously don't work. Before giving up, try ``make clean``.

* :file:`Grammar/python.gram`: The grammar, with actions that build AST nodes. After changing
it, run ``make regen-pegen`` (or ``build.bat --regen`` on Windows), to
regenerate :file:`Parser/parser.c`.
* :cpy-file:`Grammar/python.gram`: The grammar, with actions that build AST nodes.
After changing it, run ``make regen-pegen`` (or ``build.bat --regen`` on Windows),
to regenerate :cpy-file:`Parser/parser.c`.
(This runs Python's parser generator, ``Tools/peg_generator``).

* :file:`Grammar/Tokens` is a place for adding new token types. After
changing it, run ``make regen-token`` to regenerate :file:`Include/token.h`,
:file:`Parser/token.c`, :file:`Lib/token.py` and
:file:`Doc/library/token-list.inc`. If you change both ``python.gram`` and ``Tokens``,
run ``make regen-token`` before ``make regen-pegen``. On Windows,
``build.bat --regen`` will regenerate both at the same time.
* :cpy-file:`Grammar/Tokens` is a place for adding new token types. After
changing it, run ``make regen-token`` to regenerate :cpy-file:`Include/token.h`,
:cpy-file:`Parser/token.c`, :cpy-file:`Lib/token.py` and
:cpy-file:`Doc/library/token-list.inc`. If you change both ``python.gram``
and ``Tokens``, run ``make regen-token`` before ``make regen-pegen``.
On Windows, ``build.bat --regen`` will regenerate both at the same time.

* :file:`Parser/Python.asdl` may need changes to match the grammar. Then run ``make
regen-ast`` to regenerate :file:`Include/Python-ast.h` and :file:`Python/Python-ast.c`.
* :cpy-file:`Parser/Python.asdl` may need changes to match the grammar.
Then run ``make regen-ast`` to regenerate :cpy-file:`Include/Python-ast.h`
and :cpy-file:`Python/Python-ast.c`.

* :file:`Parser/tokenizer.c` contains the tokenization code. This is where you would
add a new type of comment or string literal, for example.
* :cpy-file:`Parser/tokenizer.c` contains the tokenization code.
This is where you would add a new type of comment or string literal, for example.

* :file:`Python/ast.c` will need changes to validate AST objects involved with the
grammar change.
* :cpy-file:`Python/ast.c` will need changes to validate AST objects
involved with the grammar change.

* :file:`Python/ast_unparse.c` will need changes to unparse AST objects involved with the
grammar change ("unparsing" is used to turn annotations into strings per :pep:`563`).
* :cpy-file:`Python/ast_unparse.c` will need changes to unparse AST
involved with the grammar change ("unparsing" is used to turn annotations
into strings per :pep:`563`).

* The :ref:`compiler` has its own page.

* ``_Unparser`` in the :file:`Lib/ast.py` file may need changes to accommodate
any modifications in the AST nodes.
* ``_Unparser`` in the :cpy-file:`Lib/ast.py` file may need changes
to accommodate any modifications in the AST nodes.

* :file:`Doc/library/ast.rst` may need to be updated to reflect changes to AST nodes.
* :cpy-file:`Doc/library/ast.rst` may need to be updated to reflect changes
to AST nodes.

* Add some usage of your new syntax to ``test_grammar.py``.

* Certain changes may require tweaks to the library module :mod:`pyclbr`.

* :file:`Lib/tokenize.py` needs changes to match changes to the tokenizer.
* :cpy-file:`Lib/tokenize.py` needs changes to match changes to the tokenizer.

* Documentation must be written! Specifically, one or more of the pages in
:file:`Doc/reference/` will need to be updated.
:cpy-file:`Doc/reference/` will need to be updated.
14 changes: 7 additions & 7 deletions documentation/start-documenting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ You can also use ``make help`` to see a list of targets supported by
you submit a :ref:`pull request <pullrequest>`, so you should make
sure that it runs without errors.

**On Windows**, a :file:`make.bat` batchfile tries to emulate :command:`make`
as closely as possible, but the venv targe D7AE t is not implemented, so you will
probably want to make sure you are working in a virtual environment before
proceeding, otherwise all dependencies will be automatically installed on your
system.
**On Windows**, the :cpy-file:`Doc/make.bat` batchfile tries to emulate
:command:`make` as closely as possible, but the venv target is not implemented,
so you will probably want to make sure you are working in a virtual environment
before proceeding, otherwise all dependencies will be automatically installed
on your system.

When ready, run the following from the root of your :ref:`repository clone
<checkout>` to build the output as HTML::
Expand All @@ -114,9 +114,9 @@ When ready, run the following from the root of your :ref:`repository clone
make html

You can also use ``make help`` to see a list of targets supported by
:file:`make.bat`.
:cpy-file:`Doc/make.bat`.

See also :file:`Doc/README.rst` for more information.
See also :cpy-file:`Doc/README.rst` for more information.

Using sphinx-build
------------------
Expand Down
2 changes: 1 addition & 1 deletion getting-started/git-boot-camp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Exclude generated files from diff by default::
git config diff.generated.binary true

The ``generated`` `attribute <https://git-scm.com/docs/gitattributes>`_ is
defined in :file:`.gitattributes`, found in the repository root.
defined in :cpy-file:`.gitattributes`, found in the repository root.

.. _push-changes:

Expand Down
Loading
0