Skip to content

Commit 34bf669

Browse files
committed
Update Porting page, move platform experts list there
Rename page to "Porting and Platform support". Move the "Platforms" list from the Experts Index here. Add relevant links (setup guides, issue trackers, config/patches). Update the guide for porting to a new platform a bit.
1 parent e0ecbef commit 34bf669

3 files changed

Lines changed: 131 additions & 27 deletions

File tree

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@
276276
"gh-label": (f"{_repo}/labels/%s", "%s"),
277277
"github": ("https://github.com/%s", "%s"),
278278
"github-user": ("https://github.com/%s", "@%s"),
279+
"gh-python-team": ("https://github.com/orgs/python/teams/%s", "@%s"),
279280
"pypi": ("https://pypi.org/project/%s/", "%s"),
280281
"pypi-org": ("https://pypi.org/org/%s/", "%s"),
281282
}

core-team/experts.rst

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,9 @@ PEG Generator gvanrossum, pablogsal, lysnikolaou
179179
Platforms
180180
=========
181181

182-
For official contacts for supported platforms, see :pep:`11`.
182+
The **Platforms experts list** has moved to :ref:`ports`.
183183

184-
Platforms listed here are not necessarily supported by CPython.
185-
Some of the experts listed here maintain and distribute Python
186-
for “their” platform as a third-party project.
187-
188-
=================== ===========
189-
Platform Maintainers
190-
=================== ===========
191-
AIX ayappanec
192-
Android mhsmith
193-
Emscripten hoodmane, pmp-p, rdb, rth, ryanking13
194-
iOS freakboy3742, ned-deily
195-
macOS ronaldoussoren, ned-deily, freakboy3742
196-
Solaris/OpenIndiana jcea, kulikjak
197-
Windows tjguk, zooba, pfmoore
198-
=================== ===========
184+
For official contacts for supported platforms, see :pep:`11`.
199185

200186

201187
Miscellaneous

developer-workflow/porting.rst

Lines changed: 128 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,107 @@
11
.. _porting:
22

3-
=========================
3+
============================
4+
Porting and platform support
5+
============================
6+
7+
The Python interpreter runs on an underlying *platform* -- the operating system
8+
(for example, Linux, Windows or macOS), processor (like Intel/AMD, ARM),
9+
C compiler and library, and other "lower level" details.
10+
11+
CPython is *officially supported* on several platforms, on which the core team
12+
has adequate knowledge and resources to test releases and fix bugs.
13+
See :pep:`11` for details.
14+
15+
Other platforms are unsupported *by the core team*, but might be supported
16+
by others -- as a volunteer project, by a company that wants Python on "their"
17+
system, or just as a one-off experiment.
18+
See :pep:`11#unsupported-platforms` for the policy on merging code for
19+
unsupported platforms into the main CPython repository.
20+
21+
22+
.. _ports:
23+
24+
Ports and contacts
25+
==================
26+
27+
The table below lists relevant third-party projects,
28+
their maintainers, and links to information that's relevant when triaging
29+
platform-specific issues.
30+
31+
It is OK to @mention the listed GitHub usernames to draw maintainers' attention
32+
or request their opinion on platform-specific issues.
33+
Maintainers must only be listed with their permission, and they may remove
34+
themselves at any time.
35+
36+
Third-party projects should only be listed if they benefit substantially
37+
more people than the maintainer(s).
38+
Officially supported platforms are included when there are relevant links
39+
to show, or to group similar platforms.
40+
41+
Links should be for the port specifically (not the platform itself),
42+
and relevant for porting work and fixing platform-specific issues
43+
(no homepage/marketing links).
44+
45+
* **AIX**: :github-user:`ayappanec`
46+
* **Linux** [t1]_
47+
48+
* Fedora: :github-user:`hroncok`, :github-user:`befeleme`; see
49+
`Config & patches <https://src.fedoraproject.org/rpms/python3.15/tree/rawhide>`_,
50+
`Bugs <https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&classification=Fedora&columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cshort_desc%2Cchangeddate%2Cbug_severity&f1=component&o1=regexp&order=status%2C%20assigned_to%2C%20id%2C%20&product=Fedora&product=Fedora%20EPEL&query_format=advanced&v1=python3%5C..%2A>`__,
51+
`Maintenance guide <https://hackmd.io/9f64YNIZTCy0ZzKb5wKtqQ?view>`__
52+
* Debian: :github-user:`stefanor`, :github-user:`doko42`; see
53+
`Config & patches <https://salsa.debian.org/cpython-team/python3/-/tree/master/debian/patches>`_,
54+
`Bugs <https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=python3.15>`__,
55+
`Wiki <https://wiki.debian.org/Python>`__
56+
* Alpine: see
57+
`Config & patches <https://github.com/alpinelinux/aports/tree/master/main/python3>`_
58+
* **macOS** [t1]_: :gh-python-team:`macos-team`, :github-user:`freakboy3742`;
59+
see
60+
`Limitations <https://docs.python.org/3/library/intro.html#mobile-platforms>`__,
61+
`Usage <https://docs.python.org/3/library/intro.html#mobile-platforms>`__,
62+
:cpy-file:`Platforms/Apple`
63+
* Mobile platforms: see
64+
`Limitations <https://docs.python.org/3/library/intro.html#mobile-platforms>`__
65+
66+
* **Android** [t3]_: :github-user:`mhsmith`; see
67+
`Usage <https://docs.python.org/3/using/android.html>`__,
68+
:cpy-file:`Platforms/Android`
69+
* **iOS** [t3]_: :github-user:`freakboy3742`, :github-user:`ned-deily`; see
70+
`Usage <https://docs.python.org/3/using/ios.html>`__,
71+
:cpy-file:`Platforms/Apple`
72+
73+
* **Solaris**/OpenIndiana: :github-user:`jcea`, :github-user:`kulikjak`
74+
* **WebAssembly**: see `Limitations <https://docs.python.org/3/library/intro.html#webassembly-platforms>`__
75+
76+
* WASI [t2]_: see :cpy-file:`WASI <Platforms/WASI>`
77+
* Emscripten [t3]_: :github-user:`pmp-p`, :github-user:`rdb`, :github-user:`rth`; see
78+
:cpy-file:`emscripten <Platforms/emscripten>`
79+
80+
* Pyodide: :github-user:`hoodmane`, :github-user:`ryanking13`, :github-user:`agriyakhetarpal`
81+
82+
* **Windows** [t1]_: :gh-python-team:`windows-team`, :github-user:`pfmoore`; see
83+
`Usage <https://docs.python.org/3/using/windows.html>`__,
84+
:cpy-file:`PC`,
85+
:cpy-file:`PCbuild`
86+
* **Cross-Platform**:
87+
88+
* conda-forge: see
89+
`Recipe <https://github.com/conda-forge/python-feedstock/tree/main/recipe>`_
90+
91+
.. [t1] Specific variants have official :pep:`Tier 1 support <11#tier-1>`
92+
.. [t2] Specific variants have official :pep:`Tier 2 support <11#tier-2>`
93+
.. [t3] Specific variants have official :pep:`Tier 3 support <11#tier-3>`
94+
95+
496
Porting to a new platform
597
=========================
698

99+
Porting CPython to an entirely new platform is an adventure.
100+
If you try it, consider keeping notes -- and updating this guide, if you
101+
find something that might be relevant to others.
102+
Since each platform is different, this guide can only give you a
103+
few rough tips.
104+
7105
The first step is to familiarize yourself with the development toolchain on
8106
the platform in question, notably the C compiler. Make sure you can compile and
9107
run a hello-world program using the target compiler.
@@ -12,23 +110,39 @@ Next, learn how to compile and run the Python interpreter on a platform to
12110
which it has already been ported; preferably Unix, but Windows will
13111
do, too. The build process for Python, in particular the ``Makefile`` in the
14112
source distribution, will give you a hint on which files to compile
15-
for Python. Not all source files are relevant: some are platform-specific,
16-
and others are only used in emergencies (for example, ``getopt.c``).
113+
for Python. Not all source files are relevant: some are platform-specific,
114+
and others are only used in emergencies (for example,
115+
:cpy-file:`Python/getopt.c`).
17116

18117
It is not recommended to start porting Python without at least a medium-level
19118
understanding of your target platform; how it is generally used, how to
20119
write platform-specific apps, and so on. Also, some Python knowledge is required, or
21120
you will be unable to verify that your port is working correctly.
22121

23-
You will need a ``pyconfig.h`` file tailored for your platform. You can
24-
start with ``pyconfig.h.in``, read the comments, and turn on definitions that
25-
apply to your platform. Also, you will need a ``config.c`` file, which lists
26-
the built-in modules you support. Again, starting with
27-
``Modules/config.c.in`` is recommended.
122+
On systems with a UNIX shell, run the included :cpy-file:`configure` script.
123+
This should generate all required files, including a :file:`Makefile`.
124+
If it does not, you will need to debug it (or reimplement it).
125+
Note that the script is generated from :cpy-file:`configure.ac` using GNU
126+
Autotools.
127+
(CPython pins a specific version for reproducibility, but other versions may
128+
work fine.)
129+
130+
The main files that ``configure`` generates -- and which you might want to
131+
check -- are:
28132

29-
Finally, you will run into some things that are not supported on your
30-
target platform. Forget about the ``posix`` module in the beginning. You can
31-
simply comment it out of the ``config.c`` file.
133+
* A :file:`pyconfig.h` file tailored for your platform.
134+
If you need to create this manually, start with :cpy-file:`pyconfig.h.in`,
135+
read the comments, and turn on definitions that apply to your platform.
136+
* A :file:`config.c` file, which lists the built-in modules you support.
137+
Until you get dynamic extension loading to work, all compiled modules
138+
you need to import will need to be listed here.
139+
The file is generated from :cpy-file:`Modules/config.c.in`.
140+
* A :file:`Makefile` with instructions to put everything together.
141+
If one isn't generated, try compiling all the ``*.c`` files, and fix the
142+
errors -- or omit files that don't look important.
143+
For example, forget about the ``posix`` module
144+
(:cpy-file:`Modules/posixmodule.c`) in the beginning: don't compile it,
145+
and comment it out of the :file:`config.c` file.
32146

33147
Keep working on it until you get a ``>>>`` prompt. You may have to disable the
34148
importing of ``site.py`` by passing the ``-S`` option. When you have a prompt,
@@ -38,6 +152,9 @@ At some point you will want to use the ``os`` module; this is the time to start
38152
thinking about what to do with the ``posix`` module. It is okay to simply
39153
comment out functions in the ``posix`` module that cause problems; the
40154
remaining ones will be quite useful.
155+
You can use the same approach for other modules too, of course.
41156

42157
Before you are done, it is highly recommended to run the Python regression test
43158
suite, as described in :ref:`runtests`.
159+
You will probably need to skip tests that do not make sense; for inspiration
160+
look at how that's done for the WASI platform.

0 commit comments

Comments
 (0)