-
Notifications
You must be signed in to change notification settings - Fork 134
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
Implicit namespace package support #370
Comments
There's been a PR (#159) hanging around for years; the idea would be that you package one module within the namespace, and flit reads the metadata from that, e.g. I'm just not really interested in namespace packages, so I find it hard to summon the enthusiasm for thinking about how to support them and hearing about bug reports when things go wrong. Quoting myself from that PR:
|
Seeing how long the PR has been hanging in the air, is that lack of enthusiasm a show-stopper for adopting namespace packages even if someone else implements/maintains the feature? Would it be more feasible to have this feature as a third-party, external package that builds on flit? (I will refrain from suggesting to implement it as a namespace package.) |
I for one would appreciate namespace package support as my team uses them extensively (I'd prefer if we didn't, but that ship has sailed). Since a lot of my coworkers are not that familiar with all the intricacies of Python packaging, flit would be ideal to use given its simplicity compared to setuptools. Unfortunately I don't have the time to work on this at the moment which is why I'm just adding my voice in favor of supporting namespace packages. |
I am looking at migrating to flit, and lack of support for namespace packages is forcing me to look for alternatives. One common use-case for namespace packages is plugins, where multiple separate plugins are contributing to the same namespace independently. |
That's a shame. Flit almost rescued my floundering project from a lack of direction in One developer to another, you might need to put your feelings to one side here. New-style namespace packages have been a standardized part of the language since 2012. They're not going anywhere. You can whine about them all you want (hey - you of all people should know - write a counter PEP) but, Flit is in the wrong here. You can't expect people to not to use a feature of the language just because you personally don't like or use it (as was pointed out to you several times in that PR). Now, it's your codebase. You can support (or not support) whatever you'd like. Just know that you're shooting yourself in the foot here with adoption and compatibility with a long standardized aspect of the language. Just see that closed issue from Facebook if you want another less-biased example. Personally, I have no choice but to go back to On the off chance; how dead is PR #159? It seems ancient by the velocity of this project's commit log - is it even relevant anymore? Would you even consider an updated PR for namespace support? I don't think I really have the time to push it forwards but if there is the potential, I'd consider it. |
The newstyle metadata allows for an explicit |
I have implemented support for implicit namespace packages based on new-style metadata in #453 and it is really simple now. The sdist and wheel built for my project look right to me and editable installs work as well. |
OK, I came round to the idea of doing this, even if it's not something I plan to use much myself. I've just released Flit 3.5. I went back to the idea of #159, where you specify the subpackage or module inside the namespace package (e.g. This only tries to support PEP 420 'implicit' namespace packages, where the namespace package (the outer one) doesn't have an |
Just wanted to chime in here and say that I've now successfully used this. Thanks @takluyver! |
The implicit namespace package is defined in PEP 420 as lacking a
__init__.py
in the package. But Flit relies on the file to read in the version and (short) description.Some ways to support this from the top of my head:
pyproject.toml
to instruct Flit to read those values from another file. Implicit namespace packages usually implement a submodule in the parent package, so it’d be possible to have something liketop-level = "foo.bar"
to instruct Flit to load that module instead of the one defined under themodule
key.module
. So instead of taking a Python identifier,module
can now may also be given a dotted name to specify a submodule. This would make Flit importmodule
for metadata values (as currently), but package all of the top-level module into the distribution. The downside is there’s no way to package multiple submodules into one namespace package in a distribution, but that’s a niche usage anyway (like Flit chose not to support having multiple packages in a distribution).__init__.py
in the top-level package, but introduce a flag (e.g.namespace = true
) to not package that file into the distribution. I don’t like this approach (the module would behave differently depending on whether it’s imported directly from PWD or afterflit install -s
), but it’s the easiest hack.The text was updated successfully, but these errors were encountered: