-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
support namespace packing #167
Comments
How would the maintainers feel about an additional optional field in
corresponds with a layout like:
|
See #356 (comment) |
This isn't an issue for me. [tool.poetry]
name = "abc.foo"
version = "2018.0.0"
description = "abc foo module"
authors = ["Devin Fee <dev...>"]
packages = [
{ include = "abc" },
]
[tool.poetry.dependencies]
python = "^3.6.5"
"abc.core" = {path = "../abc.core"} # other namespaced modules work, too. |
@dfee what if the package name is different and doesn't correlate with the dir structure? |
My directory structure is as follows:
That should explain this line @moigagoo is your question about something that looks like the following?
Yeah, I just don't know that anything besides my current structure is compliant with PEP420 |
Poerty support this use case https://packaging.python.org/guides/packaging-namespace-packages/#native-namespace-packages by explicitly declaring the various namespaced packages with the |
The name of a distribution is declared in the
The name of a root module of a distribution is declared in the file system and appears:
By default, Poetry looks up the root module to include in a distribution by the distribution name declared in the If your root module cannot be found by this default mechanism (the root module is located elsewhere, the root module has a different name than that of the distribution or there are multiple root modules), you have to declare it in the For instance, let us say that you need to build three distributions named
where application_1/src/organization/application/application_1/__main__.py is:
and application_2/src/organization/application/application_2/__main__.py is:
and library/src/organization/library/library_1/__init__.py is:
and library/src/organization/library/library_2/__init__.py is:
and library/src/organization/library/library_3/__init__.py is:
In order to build the distributions, application_1/pyproject.toml should be:
and application_2/pyproject.toml should be:
and library/pyproject.toml should be:
|
@dfee Do you have any problems building your project? I have the same structure and faced problem with I think I've found related issue #2046 |
@maggyero, just to be clear, in [tool.poetry]
name = "application_1"
version = "..."
description = "..."
authors = ["..."]
packages = [
{ include = "organization", from = "src" }
] ...it is not mandatory to use |
@pawamoy No it is not mandatory to use For instance you can see that the
Indeed:
|
Edit I made a dumb comment here that was addressed in #356. tl;dr
poetry will automatically know how to interpret the folders nested under organization. |
It's important that your |
I fear I don't quite understand this. My use case is that I want to distribute a python package where the package has a different name from the module inside it. However, I still want my module to have a init.py file in it that ideally I write myself. However poetry (or some other tool in the chain) seems to strip out the file when I install the package as dependency. Can't I opt out of the "native namespace" concept (which I admittedly don't understand yet) and just use the different package/module naming as a strategy on its own? |
Python distributable packages can contain zero or more modules, zero or more packages, zero or more scripts, and data files. It seems that you are looking for poetry options to control the distribution name independently of the package names. If you have trouble with that, you should open a specific ticket, not comment on this one that’s about namespace packages. |
That makes sense, thanks. I managed to resolve my issue, leaving me with more questions than answers as to what actually caused it, but that's an altogether different story. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I follow the docs here: https://packaging.python.org/guides/packaging-namespace-packages/
but it does not work, maybe poetry not support yet?
The text was updated successfully, but these errors were encountered: