Skip to content

Commit ff1a110

Browse files
committed
gh-119786:: move 'repo structure' and 'additional resources' from devguide to InternalDocs
1 parent de0d5c6 commit ff1a110

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

InternalDocs/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ The core dev team attempts to keep this documentation up to date. If
1111
it is not, please report that through the
1212
[issue tracker](https://github.com/python/cpython/issues).
1313

14+
- [Structure of the CPython Repository](repo_structure.md)
1415

15-
Compiling Python Source Code
16+
Compilation
1617
---
1718

1819
- [Guide to the parser](parser.md)
@@ -42,3 +43,7 @@ Program Execution
4243
- [Garbage Collector Design](garbage_collector.md)
4344

4445
- [Exception Handling](exception_handling.md)
46+
47+
---
48+
49+
- [External Resources](external_resources.md)

InternalDocs/external_resources.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# External Resources About CPython
3+
4+
The CPython code base is constantly changing and evolving.
5+
Below are references to external resources about CPython's architecture aimed at
6+
building your understanding of CPython internals and its evolution:
7+
8+
9+
| Title | Brief | Author | Version |
10+
| --- | --- | --- | --- |
11+
| [`A guide from parser to objects, observed using GDB`](https://hackmd.io/s/ByMHBMjFe) | Code walk from Parser, AST, Sym Table and Objects | Louie Lu | 3.7.a0 |
12+
| [`Green Tree Snakes`](https://greentreesnakes.readthedocs.io/en/latest/) | The missing Python AST docs | Thomas Kluyver | 3.6 |
13+
| [`Yet another guided tour of CPython`](https://paper.dropbox.com/doc/Yet-another-guided-tour-of-CPython-XY7KgFGn88zMNivGJ4Jzv) | A guide for how CPython REPL works | Guido van Rossum | 3.5 |
14+
| [`Python Asynchronous I/O Walkthrough`](https://www.youtube.com/playlist?list=PLpEcQSRWP2IjVRlTUptdD05kG-UkJynQT) | How CPython async I/O, generator and coroutine works | Philip Guo | 3.5 |
15+
| [`Coding Patterns for Python Extensions`](https://pythonextensionpatterns.readthedocs.io/en/latest/) | Reliable patterns of coding Python Extensions in C | Paul Ross | 3.9+ |
16+
| [`Your Guide to the CPython Source Code`](https://realpython.com/cpython-source-code-guide/) | Your Guide to the CPython Source Code | Anthony Shaw | 3.8 |
17+
| [`Python's Innards Series`](https://tech.blog.aknin.name/category/my-projects/pythons-innards/) | ceval, objects, pystate and miscellaneous topics | Yaniv Aknin | 3.1 |
18+
| [`Eli Bendersky's Python Internals`](https://eli.thegreenplace.net/tag/python-internals) | Objects, Symbol tables and miscellaneous topics | Eli Bendersky | 3.x |
19+
| [`A guide from parser to objects, observed using Eclipse`](https://docs.google.com/document/d/1nzNN1jeNCC_bg1LADCvtTuGKvcyMskV1w8Ad2iLlwoI/) | Code walk from Parser, AST, Sym Table and Objects | Prashanth Raghu | 2.7.12 |
20+
| [`CPython internals: A ten-hour codewalk through the Python interpreter source code`](https://www.youtube.com/playlist?list=PLzV58Zm8FuBL6OAv1Yu6AwXZrnsFbbR0S) | Code walk from source code to generators | Philip Guo | 2.7.8 |

InternalDocs/repo_structure.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
# The CPython Repository
3+
4+
This section gives an overview of CPython's code structure and provides
5+
a summary of file locations for modules and built-ins.
6+
7+
Source code layout
8+
==================
9+
10+
The core interpreter implementation is in the [`Python/`](../Python) directory.
11+
Some of the files there are generated during the build process, that will be
12+
indicated by a comment at the top of the file.
13+
14+
For a Python [`module`](https://docs.python.org/3/glossary.html#term-module),
15+
the typical layout is:
16+
17+
* `Lib/{<module>}.py`
18+
* `Modules/_{<module>}.c` (if there's also a C accelerator module)
19+
* `Lib/test/test_{<module>}.py`
20+
* `Doc/library/{<module>}.rst`
21+
22+
For an [`extension module`](https://docs.python.org/3/glossary.html#term-extension-module),
23+
the typical layout is:
24+
25+
* `Modules/{<module>}module.c`
26+
* `Lib/test/test_{<module>}.py`
27+
* `Doc/library/{<module>}.rst`
28+
29+
For [`bltin-types`](https://docs.python.org/3/library/stdtypes.html#bltin-types),
30+
the typical layout is:
31+
32+
* `Objects/{<builtin>}object.c`
33+
* `Lib/test/test_{<builtin>}.py`
34+
* [`Doc/library/stdtypes.rst`](../Doc/library/stdtypes.rst)
35+
36+
For [`built-in-funcs`](https://docs.python.org/3/library/functions.html#built-in-funcs),
37+
the typical layout is:
38+
39+
* [`Python/bltinmodule.c`](../Python/bltinmodule.c)
40+
* [`Lib/test/test_builtin.py`](../Lib/test/test_builtin.py)
41+
* [`Doc/library/functions.rst`](../Doc/library/functions.rst)
42+
43+
Some exceptions to these layouts are:
44+
45+
* built-in type ``int`` is at [`Objects/longobject.c`](../Objects/longobject.c)
46+
* built-in type ``str`` is at [`Objects/unicodeobject.c`](../Objects/unicodeobject.c)
47+
* built-in module ``sys`` is at [`Python/sysmodule.c`](../Python/sysmodule.c)
48+
* built-in module ``marshal`` is at [`Python/marshal.c`](../Python/marshal.c)
49+
* Windows-only module ``winreg`` is at [`PC/winreg.c`](../PC/winreg.c)

0 commit comments

Comments
 (0)