Skip to content
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

multiple candidates for rlib dependency anise found #76

Open
ChristopherRabotin opened this issue Sep 3, 2024 · 4 comments
Open

multiple candidates for rlib dependency anise found #76

ChristopherRabotin opened this issue Sep 3, 2024 · 4 comments

Comments

@ChristopherRabotin
Copy link

Hi there,

My project, ANISE, is organized as a workspace and provides a Rust and a Python library, separately. I've just tried adding your stub generator, because the lack of type hinting is pretty problematic given how complex ANISE is. Here's the commit that tries this: nyx-space/anise@master...feat/type-hints .

However, when I run the stub_gen binary, I get the following error:

error[E0464]: multiple candidates for `rlib` dependency `anise` found
 --> anise-py/src/bin/stub_gen.rs:5:16
  |
5 |     let stub = anise::stub_info()?;
  |                ^^^^^
  |
  = note: candidate #1: /home/chris/Workspace/nyx-space/anise/target/debug/deps/libanise-ade813368379e110.rlib
  = note: candidate #2: /home/chris/Workspace/nyx-space/anise/target/debug/deps/libanise.rlib

I thought that maybe a cargo clean would help, but alas, the same error pops up again. Could this be due to the Cargo workspace configuration where there is an anise crate for the Rust version and anise-py for the Python version (but called anise in the pyproject.toml file)?

What other information can I give you that may help you help me debug this?

Thank you

@gtfierro
Copy link

Hey @ChristopherRabotin --- did you have any luck addressing this? I'm running into the same error on my own project. I have a separate crate for the PyO3 stuff (not the same name as the Rust crate)

@ChristopherRabotin
Copy link
Author

I ended up rewriting the code from the Dora library to parse the Python module once it's built : https://github.com/nyx-space/anise/blob/master/anise-py/generate_stubs.py.

The issue with this approach is that only one level deep submodules are be correctly seen by IDEs (because submodules are hacked to be classes). The process is also a bit tedious : one needs to build the python library, run that script, and build the library again for the stubs to be included in the module.

@gtfierro
Copy link

Thanks so much for the quick reply! I'll see if something similar works for me.

@net
Copy link

net commented Feb 25, 2025

Same issue here. I expect this will be a pretty common issue given the nature of PyO3.

@ChristopherRabotin would you consider licensing your generate_stubs.py under the MIT license?

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

No branches or pull requests

3 participants