Skip to content

Commit 6e7f130

Browse files
bruno-fsa-ovchinnikov
authored andcommitted
more thoughts on challanges/limitations
1 parent a18ab2f commit 6e7f130

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

docs/designs/cargo-support.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,15 +622,19 @@ is here to stay.
622622

623623
## The challenge and cachi2 boundaries
624624

625-
Building projects that do DIRECTLY depend on both rust and python should be straighforward and
626-
similar to build with pip and cargo independently. The challenge comes with indirect rust
627-
dependencies. For instance, when you project is "pure python" but have dependencies that rely on
628-
rust.
625+
Building projects that do DIRECTLY depend on both rust and python should be straightforward and
626+
similar to build with pip and cargo independently. The developers of those projects can easily
627+
have `requirements.txt`, `Cargo.lock`, etc readily available to them and have full control of
628+
how to build their own software. The challenge comes with indirect rust dependencies. For instance,
629+
when your project is "pure python" but have dependencies that rely on rust (like cryptography).
629630

630631
In this scenario, cargo vendor won't help unless you have all sources available. Also, users don't
631632
have a way to explicitly declare those dependencies, and, henceforth, aren't necessarily doing
632633
reproducible builds.
633634

635+
Another issue is how to configure cargo, something those developers are not even calling directly -
636+
that will be made by the python build backend (hopefully `maturin` or `setuptools-rust`).
637+
634638
In the following sections we are going to expose a bit of how `maturin` and `setuptools-rust` are
635639
configured in order to come with ideas on how to tackle the problem of FINDING rust dependencies
636640
on a pure-python project. This is probably outside of the scope of cachi2, but we will need to at
@@ -823,13 +827,17 @@ RUN source /tmp/cachi2.env && \
823827

824828
### Limitations
825829

826-
- the process likely won't work with python packages lacking Cargo.lock.
830+
- The process likely won't work with python packages lacking Cargo.lock.
827831
- Interestingly, while inspecting some projects relying on maturin I saw many that didn't have a
828832
Cargo.lock BUT their sources uploaded to pypi actually HAD those. I couldn't find in maturin
829833
documentation if this is a behavior we could rely upon. Example library with this behavior:
830834
[css-inline][css-inline-github]
831835
- this might represent a risk for dependencies pointing to git sources instead of pypi/crates.io
832-
836+
- This approach might work well for setuptools-rust and maturin - and might work for some new tool
837+
that resorts to invoke `cargo` at some point, but it won't work if a completely alien approach is
838+
created.
839+
- OTOH, that's not a problem for fetching dependencies, only for actually building the project.
840+
Given this is only a big IF, this is probably fine.
833841

834842
<!-- REFERENCES -->
835843

0 commit comments

Comments
 (0)