Skip to content

Conversation

@tfcollins
Copy link
Contributor

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

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have commented new code, particulary complex or unclear areas
  • I have checked that I did not intoduced new warnings or errors (CI output)
  • I have checked that components that use libiio did not get broken
  • I have updated the documentation accordingly (GitHub Pages, READMEs, etc)

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]>
[project.urls]
homepage = "https://analogdevicesinc.github.io/libiio/"
documentation = "https://analogdevicesinc.github.io/libiio/"
repository = "https://github/analogdevicesinc/libiio"
Copy link
Contributor

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

Copy link
Contributor Author

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]>
@tfcollins tfcollins force-pushed the tfcollins/pyproject.toml branch from 8ca4a09 to af0dbae Compare October 2, 2024 17:19
Copy link
Contributor

@nunojsa nunojsa left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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]>
version = _get_lib_version()
backends = [_get_backend(b).decode("ascii") for b in range(0, _get_backends_count())]

bindings_version = "1.0"
Copy link
Contributor

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

Copy link
Contributor Author

@tfcollins tfcollins Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

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?

Copy link
Contributor

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.

@dNechita
Copy link
Contributor

Closing this as a copy of this branch has been made and work continued in PR #1366.

@dNechita dNechita closed this Nov 26, 2025
@dNechita dNechita deleted the tfcollins/pyproject.toml branch November 26, 2025 13:35
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

Successfully merging this pull request may close these issues.

6 participants