LibQi Python bindings
Project description
This repository contains the official Python bindings of the LibQi, the qi Python module.
Building
To build the project, you need:
a compiler that supports C++17.
on Ubuntu: apt-get install build-essential.
CMake with at least version 3.23.
on PyPI (recommended): pip install “cmake>=3.23”.
on Ubuntu: apt-get install cmake.
Python with at least version 3.7 and its development libraries.
On Ubuntu: apt-get install libpython3-dev.
a Python virtualenv.
On Ubuntu:
apt-get install python3-venv python3 -m venv ~/my-venv # Use the path of your convenience. source ~/my-venv/bin/activate
Conan
Additionally, libqi-python is available as a Conan 2 project, which means you can use Conan to fetch dependencies.
You can install and/or upgrade Conan 2 and create a default profile in the following way:
# install/upgrade Conan 2
pip install --upgrade conan~=2
# create a default profile
conan profile detect
Install dependencies from Conan and build with CMake
The procedure to build the project using Conan to fetch dependencies is the following.
Most dependencies are available on Conan Center repository and should not require any additional steps to make them available. However, you might need to first get and export the libqi recipe into your local Conan cache.
# GitHub is available, but you can also use internal GitLab.
QI_REPOSITORY="https://github.com/aldebaran/libqi.git"
QI_VERSION="4.0.1" # Checkout the version your project need.
QI_PATH="$HOME/libqi" # Or whatever path you want.
git clone \
--depth=1 `# Only fetch one commit.` \
--branch "qi-framework-v${QI_VERSION}" \
"${QI_REPOSITORY}" \
"${QI_PATH}"
conan export "${QI_PATH}" \
--version "${QI_VERSION}" # Technically not required but some
# versions of libqi require it
# because of a bug.
You can then install the libqi-python dependencies in Conan.
conan install . \
--build=missing `# Build dependencies binaries that are missing in Conan.` \
-s build_type=Debug `# Build in debug mode.` \
-c tools.build:skip_test=true `# Skip tests building for dependencies.` \
-c '&:tools.build:skip_test=false' # Do not skip tests for the project.
This will generate a build directory containing a configuration with a toolchain file that allows CMake to find dependencies inside the Conan cache.
You can then invoke CMake directly inside the build configuration directory to configure and build the project. Fortunately, Conan also generates a CMake preset that simplifies the process. The name of the preset may differ on your machine. You may need to find the preset generated by Conan first by calling:
cmake --list-presets
Here, we’ll assume that the preset is named conan-linux-x86_64-gcc-debug. To start building, you need to configure with CMake and then build:
cmake --preset conan-linux-x86_64-gcc-debug
cmake --build --preset conan-linux-x86_64-gcc-debug
Tests can now be invoked using CTest, but they require a runtime environment from Conan so that all dependencies are found:
source build/linux-x86_64-gcc-debug/generators/conanrun.sh
ctest --preset conan-linux-x86_64-gcc-debug --output-on-failure
source build/linux-x86_64-gcc-debug/generators/deactivate_conanrun.sh
Finally, you can install the project in the directory of your choice.
The project defines a single install component, the Module component.
# `cmake --install` does not support presets sadly.
cmake \
--install build/linux-x86_64-gcc-debug \
--component Module --prefix ~/my-libqi-python-install
Wheel (PEP 517)
You may build this project as a wheel package using PEP 517.
It uses a scikit-build backend which interfaces with CMake.
You may need to provide a toolchain file so that CMake finds the required dependencies, such as a toolchain generated by Conan:
conan install . \
--build=missing `# Build dependencies binaries that are missing in Conan.` \
-c tools.build:skip_test=true # Skip any test.
You now can use the build Python module to build the wheel using PEP 517.
pip install -U build
python -m build \
--config-setting cmake.define.CMAKE_TOOLCHAIN_FILE=$PWD/build/linux-x86_64-gcc-release/generators/conan_toolchain.cmake
When built that way, the native libraries present in the wheel are most likely incomplete. You will need to use auditwheel or delocate to fix it.
pip install -U auditwheel # or `delocate` on MacOS.
auditwheel repair \
--strip `# Strip debugging symbols to get a lighter archive.` \
`# The desired platform, which may differ depending on your build host.` \
`# With Ubuntu 20.04, we can target manylinux_2_31. Newer versions of` \
`# Ubuntu will have to target newer versions of manylinux.` \
`# If you don't need a manylinux archive, you can also target the` \
`# 'linux_x86_64' platform.` \
--plat manylinux_2_31_x86_64 \
`# Path to the wheel archive.` \
dist/qi-*.whl
# The wheel will be by default placed in a `./wheelhouse/` directory.
Crosscompiling
The project supports cross-compiling as explained in the CMake manual about toolchains. You may simply set the CMAKE_TOOLCHAIN_FILE variable to the path of the CMake file of your toolchain.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file qi-3.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 945623a872adbf40da29f848038a4b6015a6016785b37633d2f7e5241650c931 |
|
MD5 | d61b5f462ec1f822b504e8337e2424cb |
|
BLAKE2b-256 | ac6dacc90da58e536237a62c77db4aefcd2bf828182d69a34c1dfb30e7e93cd3 |
File details
Details for the file qi-3.1.5-cp312-cp312-macosx_13_0_arm64.whl
.
File metadata
- Download URL: qi-3.1.5-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 6.7 MB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2130bb9fa47c618727112cc9b19d8c4d158365e9fe187198390126ef607155e |
|
MD5 | 5924fc9c15668075a300f42c7411baf0 |
|
BLAKE2b-256 | a6a29af765a4e955af83401134feae3dbd11b8a196bbe843345d9f86386f1832 |
File details
Details for the file qi-3.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 421d58a6f6a9e038d2dce5a68e293a69645aa50570313d5b96aa1dcf7c1ef259 |
|
MD5 | 6c5536a2e030fa053c5464c7d17b3bec |
|
BLAKE2b-256 | da2301999b202e1ada1e98460935f52442952a080921bcd7b10d078f95a7bc91 |
File details
Details for the file qi-3.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d62108438fac9363200254474990c6d212050fc0721e72ebaf3f157960e3598 |
|
MD5 | a1f80cdde9978ab28f0cd2232a36ca27 |
|
BLAKE2b-256 | e280582fe8ab8b8a1381a2e267a47cd3f3cf79fb6aef01ad43c80b6132b1a1e0 |
File details
Details for the file qi-3.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bc3902f8cd16a0490d8678be6912104f24f0578a072a8702bb62e3360b1d163 |
|
MD5 | f632c67661721ab7401bc546fae63168 |
|
BLAKE2b-256 | 9579cac712f5eb64d0b1397747eea5ffc7bfd72d45c21c404488661ee1e86116 |
File details
Details for the file qi-3.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 204870eee5257f843002811b3111a81f17a769acd3e313f2fdceb0761ce574ea |
|
MD5 | aed9005c2985624a0c4a847be3a84f10 |
|
BLAKE2b-256 | 28e3a0c6b6868b80a88e7d5bea12c43b65f368ef9aba840f78d514435f3e5a0b |
File details
Details for the file qi-3.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: qi-3.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b61080bc0d772f65ed13355da76b266117a56cec1cb23eabc05fa9f4f06d5a65 |
|
MD5 | c5f3f1ba94d86d4d53f1b10ded3ca3e7 |
|
BLAKE2b-256 | 80aacb5669dafe11885631c2fd76e46557f37ede6dfff03903b28686e064f9e4 |