Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python wrapper needs pyproject.toml #1000

Closed
2bndy5 opened this issue Sep 9, 2024 · 3 comments
Closed

python wrapper needs pyproject.toml #1000

2bndy5 opened this issue Sep 9, 2024 · 3 comments

Comments

@2bndy5
Copy link
Member

2bndy5 commented Sep 9, 2024

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.

@2bndy5
Copy link
Member Author

2bndy5 commented Sep 9, 2024

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.

@2bndy5
Copy link
Member Author

2bndy5 commented Sep 9, 2024

Oh, I just realized this is ticket number 1000!

2bndy5 added a commit that referenced this issue Sep 9, 2024
note this removes the old cross compile script (for unix)

ref #1000
2bndy5 added a commit to nRF24/RF24Network that referenced this issue Sep 9, 2024
2bndy5 added a commit to nRF24/RF24Mesh that referenced this issue Sep 9, 2024
@2bndy5
Copy link
Member Author

2bndy5 commented Sep 9, 2024

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.

RF24/pyRF24/setup.py

Lines 76 to 78 in a8fe7cf

BOOST_LIB = "boost_python" + (
"" if version_info < (3,) else "%d%d" % (version_info.major, version_info.minor)
)

This improvement makes the following documented instruction obsolete
sudo ln -s $(ls /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3*.so | tail -1) /usr/lib/$(ls /usr/lib/gcc | tail -1)/libboost_python3.so

2bndy5 added a commit to nRF24/RF24Network that referenced this issue Sep 13, 2024
2bndy5 added a commit to nRF24/RF24Mesh that referenced this issue Sep 13, 2024
2bndy5 added a commit that referenced this issue Sep 13, 2024
note this removes the old cross compile script (for unix)

ref #1000
2bndy5 added a commit that referenced this issue Sep 13, 2024
note this removes the old cross compile script

ref #1000

* update docs
@2bndy5 2bndy5 closed this as completed Sep 18, 2024
2bndy5 added a commit to nRF24/RF24Mesh that referenced this issue Oct 5, 2024
2bndy5 added a commit to nRF24/RF24Network that referenced this issue Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant