Reputation: 10476
I have the following project structure:
├── Cargo.lock
├── Cargo.toml
├── lib1
│ ├── Cargo.lock
│ ├── Cargo.toml
│ ├── pyproject.toml
│ └── src
│ └── lib.rs
└── lib2
├── Cargo.lock
├── Cargo.toml
├── pyproject.toml
└── src
└── lib.rs
Here are some files' contents:
Cargo.toml:
[workspace]
resolver = "2"
members = ["lib1", "lib2"]
lib1/Cargo.toml
[package]
name = "lib1"
version = "0.1.0"
edition = "2021"
[lib]
name = "lib1"
crate-type = ["cdylib"]
[dependencies]
pyo3 = "0.22.0"
lib2/Cargo.toml:
[package]
name = "lib2"
version = "0.1.0"
edition = "2021"
[lib]
name = "lib2"
crate-type = ["cdylib"]
[dependencies]
pyo3 = "0.22.0"
lib1 = {path = "../lib1"}
In lib1/src/lib.rs
, I've defined a function, which I'd like to import in lib2
. But, if I run
maturin develop
from lib2
, then I get
$ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.11 at /home/ignoring_gravity/nested-pyo3-example/.venv/bin/python
📡 Using build options features from pyproject.toml
Compiling lib2 v0.1.0 (/home/ignoring_gravity/nested-pyo3-example/lib2)
error[E0432]: unresolved import `lib1`
--> lib2/src/lib.rs:2:5
|
2 | use lib1::sum_as_strings;
| ^^^^ use of undeclared crate or module `lib1`
|
help: there is a crate or module with a similar name
|
2 | use lib2::sum_as_strings;
| ~~~~
What am I doing wrong / missing?
Upvotes: 0
Views: 32