-
-
Notifications
You must be signed in to change notification settings - Fork 275
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 implicit/native namespace packages (PEP 420) #811
Comments
While I'm aware that namespace packages are a python standard, they are also a massive footgun and break some assumption around installation and removal, so I'd rather not support them in maturin (and rather lint against them). I'd recommend using packages |
Could you elaborate on this? We can reconsider using namespace packages, but we weren't aware of any major issues (other than needing to make sure all projects with the namespace use the same type of namespace package). |
Normally, a package Namespace packages break those assumption: Suddenly installing a new package can modify an already existing package. To figure out the responsible package of a line of code you have to check the list of installed package instead of just assuming it's the top-level. Also I'm not sure if there's any mechanism to ensure that the different |
Thanks for the explanation. I agree that it adds some complexity to the package management. For my project, we are leaning towards continuing to use namespace packages despite the disadvantages. Ideally, we would like the option to use namespace packages or not based on their own merits, rather than based on Maturin not supporting them. I hope that you could reconsider since they do have official support in Python and seem to be fairly popular. However, if Maturin doesn't add support, we'll probably continue to use namespace packages via a workaround. |
In that case I recommend switching to setuptools-rust, which supports all the python standards and additionally gives you nearly arbitrary configuraribility. It'll likely match your needs much better |
Hi, Although @konstin explained his opinion about the namespace package, but I'd like to ask for any chance to revisit the issue. I think the main confusion about the assumption described is already there regardless of maturin and should be known for those who are using namespace package. As it has been commonly used for many organization and definitely helps for ourself, if there's no critical conflict that maturin itself have, I'd like to contribute the feature if possible. (maturin has more features than setuptools-rust we'd love to, so it may not an option for us to replace it) Can you share your thought? |
Just do add to this: namespace packages are supported due to how we can do the We currently could use this because many of our python packages get re-packaged in to linux packaging, They have issues if files like the |
I have set of projects that share the same Python namespace package (e.g.,
foo.project1.module1
andfoo.project2.module2
are both under thefoo
namespace). My directory structure looks like this:foo
is a native namespace package (PEP 420), so it should not have an__init__.py
. I set the Maturin module name to match:However, maturin complains that there is no
__init__.py
:As a workaround, I have to use the pre-Python 3.3 kind of namespace packages by adding this
__init__.py
tofoo
:But I would prefer to use the newer kind of namespace packages. This is related to #792, but I created a new issue since it feels different - I don't have a pure stub package, but instead my
__init__.py
is in a nested folder. (Feel free to close as a duplicate if I'm mistaken though.)The text was updated successfully, but these errors were encountered: