Skip to content

Commit 258f0eb

Browse files
Erlend Egeberg Aaslandvstinner
Erlend Egeberg Aasland
andauthored
Add 'Getting Started' guide to README (#33)
Co-authored-by: Victor Stinner <[email protected]>
1 parent c43cea2 commit 258f0eb

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

README.rst

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,44 @@ The ``pythoncapi-compat`` project can be used to write a C extension supporting
1010
a wide range of Python versions with a single code base. It is made of the
1111
``pythoncapi_compat.h`` header file and the ``upgrade_pythoncapi.py`` script.
1212

13-
* Homepage: `GitHub pythoncapi-compat project
14-
<https://github.com/python/pythoncapi-compat>`_.
15-
* `Documentation
16-
<https://pythoncapi-compat.readthedocs.io/en/latest/>`_
13+
``upgrade_pythoncapi.py`` requires Python 3.6 or newer.
14+
15+
See the `documentation at ReadTheDocs
16+
<https://pythoncapi-compat.readthedocs.io/en/latest/>`_
17+
for more details.
18+
19+
Getting started
20+
===============
21+
22+
To upgrade a specific file::
23+
24+
python3 upgrade_pythoncapi.py module.c
25+
26+
To upgrade all C/C++ files in a directory::
27+
28+
python3 upgrade_pythoncapi.py src/
29+
30+
Select operations
31+
-----------------
32+
33+
To only replace ``op->ob_type`` with ``Py_TYPE(op)``, select the ``Py_TYPE``
34+
operation with::
35+
36+
python3 upgrade_pythoncapi.py -o Py_TYPE module.c
37+
38+
Or the opposite, to apply all operations but leave ``op->ob_type`` unchanged,
39+
deselect the ``Py_TYPE`` operation with::
40+
41+
python3 upgrade_pythoncapi.py -o all,-Py_TYPE module.c
42+
43+
Download pythoncapi_compat.h
44+
----------------------------
45+
46+
If you want to ``pythoncapi_compat.h`` to your code base, use the
47+
``upgrade_pythoncapi.py`` tool to fetch it::
48+
49+
python3 upgrade_pythoncapi.py --download PATH
50+
1751

1852
This project is distributed under the `Zero Clause BSD (0BSD) license
1953
<https://opensource.org/licenses/0BSD>`_ and is covered by the `PSF Code of

0 commit comments

Comments
 (0)