-
Notifications
You must be signed in to change notification settings - Fork 341
Migrate python to use pyproject.toml #1202
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
Conversation
Installing python through CMake is very error prone and should only be done through pip or similar package manager. User tend to install it with sudo which tends to make the bindings inaccessible. Signed-off-by: Travis F. Collins <[email protected]>
9d81699 to
8ca4a09
Compare
bindings/python/pyproject.toml
Outdated
| [project.urls] | ||
| homepage = "https://analogdevicesinc.github.io/libiio/" | ||
| documentation = "https://analogdevicesinc.github.io/libiio/" | ||
| repository = "https://github/analogdevicesinc/libiio" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must have meant github.com here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Replace old setup.py with project.toml and move single file module to subfolder. setuptools does not support single file modules; therefore, we need to use a subfolder for packaging Signed-off-by: Travis F. Collins <[email protected]>
Make error helpful when python cannot find the libiio C library Signed-off-by: Travis F. Collins <[email protected]>
8ca4a09 to
af0dbae
Compare
nunojsa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM... just one minor, nit comment
| sudo ldconfig | ||
| cd .. | ||
| - name: Build and test Python bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The "and test" seems redundant to me given the next step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Signed-off-by: Travis F. Collins <[email protected]>
Signed-off-by: Travis F. Collins <[email protected]>
af0dbae to
bc943a4
Compare
| version = _get_lib_version() | ||
| backends = [_get_backend(b).decode("ascii") for b in range(0, _get_backends_count())] | ||
|
|
||
| bindings_version = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codacy points out:
PEP 8, recommends using ALL_CAPS with underscores separating words for module-level constants. This naming convention helps distinguish constants from other types of variables and makes their immutability clear to other developers.
Constant name "bindings_version" doesn't conform to UPPER_CASE naming style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__bindings_version__
would be correct to PEP 8 https://peps.python.org/pep-0396/#:~:text=distributions%20as%20well.-,Rationale,developers%20dates%20back%20to%201995
| analog@precision:~/libiio$ mkdir build | ||
| analog@precision:~/libiio/build$ cd build | ||
| analog@precision:~/libiio/build$ cmake ../ -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON | ||
| analog@precision:~/libiio/build$ cmake ../ -DCPP_BINDINGS=ON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the removal - but we should include some more instructions for those that only look at the build readme? (or at least point people to the bindings/python/README.md file for detailed instructions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea.
I mentioned the Python bindings in the README_BUILD.md and provided a link to the Python Readme. It helps to keep python related instructions in one place.
|
Closing this as a copy of this branch has been made and work continued in PR #1366. |
PR Description
This PR addresses #1201 and more improvements. This includes a change away from the CMake install mechanism used for the python bindings which has been historically error prone. Debian for example does not want you to install python packages like we are doing with CMake. Changes include CI updates with testing
PR Type
PR Checklist