-
Notifications
You must be signed in to change notification settings - Fork 9
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
Distribute cargo-ament-build as a PyPI package #12
Comments
@jhdcs @luca-della-vedova @maspe36 @stelzo, thoughts? |
Maybe it would be nice to ship the binary inside one of the colcon packages directly without creating a package for cargo-ament-build. This would better fit the semantics of the |
I admit I am not very familiar with the details of how this package can be used with pure |
Off hand, I don't see anything wrong with shipping Considering the ROS ecosystem, this seems like a great way to offer symmetry for users. Our instructions could look something like this
Now to @luca-della-vedova's point, maybe it doesn't make sense to even write this component in Rust. It would probably be a pain to maintain something like cargo-manifest ourselves though. |
Fair enough, there are toml crates but not really any cargo.toml crate, my hunch is that it wouldn't really be a ton of work since this crate is fairly simple but I admit haven't looked at it much. |
Correct me if I'm wrong, but the colcon extensions are not released to the ROS buildfarm. They are built locally and then uploaded to Dirk's packagecloud (https://packagecloud.io/dirk-thomas/colcon). So in our case, we'd add support for maturin in AFAIK, packagecloud does not build packages, just stores them, so there's no worry about it supporting Rust or not. Given that the PyPI package will already contain a binary version of |
Ah yes sorry indeed colcon is built locally and uploaded to packagecloud. I am still worried about distributing compiled binaries with Pypi / packagecloud though. Currently all the packages that are distributed are pure Python packages hence we don't need to worry about which platform they are running on. If we distribute debians with binaries / Pypi packages with precompiled binaries how would that work with different architectures? I.e. as you brought up in your last comment about supporting |
PyPI supports wheels, which are platform and architecture-dependent binary packages, maturin takes care of building the binary part and uploading it to PyPI as the appropriate wheel. See for example https://pypi.org/project/ruff/#files, Ruff is a Python linter written in Rust, but distributed as a PyPI package that can be installed via pipx / pip. |
I've submitted #14 as a test, it generated a bunch of wheel files, for example the one I'm attaching (I'm not sure if you everyone can see the log files from the CI run). Unzip it and then install the whl file with pipx and it'll be available in your PATH: $ pipx install ./cargo_ament_build-0.1.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
installed package cargo-ament-build 0.1.8, installed using Python 3.11.2
These apps are now globally available
- cargo-ament-build
done! ✨ 🌟 ✨
$ cargo ament-build
Error in cargo-ament-build
Caused by:
the '--install-base' option must be set
$ which cargo-ament-build
/home/esteve/.local/bin/cargo-ament-build |
Maturin uses cross-compilation and reaches much more targets. Probably needed for PyPI. The binaries are somewhere in the pipeline but there is no easy integration for both tools in the same project. Ruff does use the binaries from maturin in cargo-dist but it does not look very easy nor maintainable imo. |
Distributing cargo-ament-build as a crate is fine, but makes it more difficult for the colcon extensions to be properly package since they require
cargo-ament-build
, but we can't specify that dependency anywhere. This complicates things more when uploading the extensions to PackageCloud.https://github.com/PyO3/maturin seems to support packaging Rust crates as PyPI packages (thanks @stelzo for the link).
cargo-ament-build
could be compiled natively viacargo-dist
and then packaged as a script in thescripts
folder inside the PyPI archive. This might be bending the rules of what a PyPI package is, so any feedback would be great.The text was updated successfully, but these errors were encountered: