python wrapper needs pyproject.toml
2bndy5 opened this issue · 3 comments
I just installed the python wrapper to test a branch's changes, and I got the following message:
DEPRECATION: RF24 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at pypa/pip#8559
Should we maintain it?
I'm not sure if it is worth updating since we have the pyRF24 package which already complies with the latest approved/enforced PEPs. The only advantage in maintaining the individual wrappers is for outdated python versions: Any Python version below v3.7 would need to use individual wrappers.
Important
Python v3.7 is already at End-of-Life (just like Python v2.x). Python v3.8 is about to hit EoL in Oct 2024. See python version lifecycle page.
The pyRF24 package requires at least Python v3.7 for various reasons. The only unavoidable reason is that it is using pybind11 (requires v3.7 minimum) instead of boost.python (which seems less actively maintained nowadays).
Any complications?
The main problem here is that the individual wrapper uses a custom build script that drives the compiler: pyRF24/crossunixccompiler.py. I doubt that this is needed anymore, but I haven't looked into it for a few years. I'm also afraid that removing the build script and opting for the recommended/builtin functionality offered by the setuptools
package might break very old python versions.
It turns out that the pyRF24/crossunixcompiler.py script is only there for cross-compiling the python wrapper (instructions are for python v2). I don't think this works anymore because the CPython headers (python3-dev
or python-dev
for python v2) establish an ABI compatibility for certain versions of python. And then there's the the same problem with API and ABI compatibility with boost.python.
I'm confident enough to remove the custom build script and update the wrapper to use a pyproject.toml. I think we should also remove the cross-compiling python instructions from the docs too.
PS - The distutils
package no longer exists in the python std library. Installing the setuptools
package now includes monkey-patched imports to equivalent functionality in setuptools
.
Oh, I just realized this is ticket number 1000!
In reviewing the setup.py code for the 3 individual wrappers, I found a way to link to boost_python3x
without needing the user to create a symlink named boost_python3.so
. 🎉
It involves getting the major and minor versions of the python interpreter used for installation.
Lines 76 to 78 in a8fe7cf
This improvement makes the following documented instruction obsolete
Line 68 in 5e89cc8