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

Maturin breaks when you have a directory of stub files instead of a single stub file #792

Closed
2 tasks done
kevinheavey opened this issue Feb 2, 2022 · 4 comments · Fixed by #914
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@kevinheavey
Copy link

kevinheavey commented Feb 2, 2022

Bug Description

When you run maturin develop on a pure Rust project containing a directory of stub files, you get the error message Found a directory with the module name (solders) next to Cargo.toml, which indicates a mixed python/rust project, but the directory didn't contain an __init__.py file.

From looking at the maturin code, it looks like it thinks you have a mixed python/rust project when it sees a subdirectory with the same name as the library. If you change the stubs directory name then the type hints don't actually work.

Your Python version (python -V)

Python 3.9

Your pip version (pip -V)

21.2.4

What bindings you're using

No response

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

I've made an example repo here https://github.com/kevinheavey/maturin-stub-package-error

This is what I did:

  1. Create a new project with maturin init.
  2. Make a directory of stub files where the directory name matches the library name.
  3. Run maturin develop and get the error Found a directory with the module name (solders) next to Cargo.toml, which indicates a mixed python/rust project, but the directory didn't contain an __init__.py file.
@kevinheavey kevinheavey added the bug Something isn't working label Feb 2, 2022
@messense
Copy link
Member

messense commented Feb 4, 2022

Maturin doesn't support pure stub packages right now, so labelling this as a feature request.

@messense messense added enhancement New feature or request and removed bug Something isn't working labels Feb 4, 2022
@messense
Copy link
Member

I think stub only package from PEP 561 is suitable for this? That is you provide a maturin-stub-package-error-stubs package for maturin-stub-package-error.

@kevinheavey
Copy link
Author

I think stub only package from PEP 561 is suitable for this? That is you provide a maturin-stub-package-error-stubs package for maturin-stub-package-error.

Does this mean the stub package gets published as a separate package on PyPI?

@messense
Copy link
Member

Does this mean the stub package gets published as a separate package on PyPI?

Yes, it needs to be published separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants