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

support for implicit namespace packages #1605

Closed
krpatter-intc opened this issue May 11, 2023 · 5 comments · Fixed by #1696
Closed

support for implicit namespace packages #1605

krpatter-intc opened this issue May 11, 2023 · 5 comments · Fixed by #1696
Labels
enhancement New feature or request

Comments

@krpatter-intc
Copy link
Contributor

krpatter-intc commented May 11, 2023

There is a check for requiring an __init__.py file in the levels of the python source directory. Can we get that check removed so that maturin can be used as part of packages implementing implicit namespaces ? PEP420

bail!("Found a directory with the module name ({}) next to Cargo.toml, which indicates a mixed python/rust project, but the directory didn't contain an __init__.py file.", module_name)

@krpatter-intc krpatter-intc added the enhancement New feature or request label May 11, 2023
@krpatter-intc
Copy link
Contributor Author

After further investigation users who need namespace packages can still use the older "pkgutil" trick kf really needed:

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

And so while support for implicit namespaces might be nice, its definitely not required for general namespace package usage

@konstin
Copy link
Member

konstin commented Jul 18, 2023

This is duplicate of #811

@krpatter-intc
Copy link
Contributor Author

Ok, will close the PR...so the answer really is to just switch to setuptools-rust ?

The idea of using the init.py is problematic due to some downstream tools repackaging python packages in to debian flows (that complain about the init.py being there in multiple packages)

@konstin
Copy link
Member

konstin commented Jul 18, 2023

i'll leave the final decision on this to @messense since he's way more active than me nowadays

@Marlin-Na
Copy link

+1 for this. If the sole reason for not supporting implicit namespace is for linting agaist an opinionated best practice, can we change that to a warning instead of error?

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.

3 participants