Hi,

Would it make sense to move the pythoncapi_compat project under the
GitHub Python or PSF organization to make it more "official" and a
little bit more sustainable?

"The pythoncapi_compat project can be used to write a C extension
supporting a wide range of Python versions with a single code base. It
is made of the pythoncapi_compat.h header file and the
upgrade_pythoncapi.py script."

Documentation: https://pythoncapi-compat.readthedocs.io/en/latest/
GitHub: https://github.com/pythoncapi/pythoncapi_compat

In the past, I managed to move my personal pyperf project under the
PSF organization. Now other core developers are contributing and using
it. It's better than having it as a personal project.

pythoncapi_compat respects the PSF requirements to move a project in
the GitHub PSF organization: contributors are required to respect the
PSF Code of Conduct and the project has 3 maintainers (Dong-hee Na,
Erlend E. AAsland and me).

---

Some context.

Incompatible C API changes in Python 3.10 and 3.11 require adding
compatibility code to write C code compatible with old and new Python
versions.

For example, What's New in Python 3.10 suggests adding the following
code to your project to get the Py_SET_REFCNT() function on Python 3.9
and older:

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
#endif

Python 3.11 requires even more compatibility functions (7) and the
implementation of these functions take more lines of code:

* Py_SET_TYPE()
* Py_SET_SIZE()
* PyFrame_GetCode()
* PyFrame_GetBack()
* PyThreadState_GetFrame()
* PyThreadState_EnterTracing()
* PyThreadState_LeaveTracing()

I added a reference to the pythoncapi_compat project to What's New in
Python 3.11:
"Or use the pythoncapi_compat project to get these functions on old
Python functions."
https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes

The project provides an upgrade_pythoncapi.py script to automatically
add Python 3.10 and 3.11 support without losing support with Python
2.7. Just run the script, maybe copy pythoncapi_compat.h, and you're
done! :-)

It also provides a "pythoncapi_compat.h" header file which contains
all the required compatibility code. Just copy the header file and use
>#include "pythoncapi_compat.h"< in your project. You don't have to
maintain this compatibilty code yourself anymore (pythoncapi_compat.h
is made of 400 lines of C code).

pythoncapi_compat supports Python (2.7 to 3.11), PyPy (2.7, 3.6, 3.7)
and C++. It is distributed under the MIT license.

My concern is that currently the project lives in my
https://github.com/pythoncapi organization which is not really a
sustainable option for the future.

---

The pythoncapi_compat project is used by more and more Python
projects, like Mercurial or mypy:
https://pythoncapi-compat.readthedocs.io/en/latest/users.html

I already made a similar request in June 2021 (move the project under
the PSF organization):
https://mail.python.org/archives/list/python-dev@python.org/thread/KHDZGCNOYEDUTSPAATUDP55ZSSQM5RRC/

What changed since June 2021? Python 3.11 now requires way more
compatibility code than Python 3.10 does: 7 functions instead of 1.

On Discord, I was asked to ask the Steering Council. I asked the SC
who asked me to ask on python-dev, so here I am :-)

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/XI23GU54UC2Y6UBMPY6US4IK4PSUXXPI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to