poly info command does not list components under lower level namespaces #95
Replies: 5 comments 4 replies
-
Thank you, very interesting ideas @hugobettmach! Today the |
Beta Was this translation helpful? Give feedback.
-
This could possibly be a new How are the bricks included in the pyproject.toml files? |
Beta Was this translation helpful? Give feedback.
-
I'm going to give the theming a try, but I would recommend you to reconsider the sub-namespacing into a flat structure as suggested in the If you still want the sub-namespacing, with the current tooling (while waiting for a future version to support it), you could do something like this: put all your bricks in the Example: create a new "component" (i.e. your sub-namespace): poetry poly create component --name my_namespace_1 Import the bricks that should belong to this sub-namespace in the # the __init__.py file
from org_name import component1, component2
__all__ = ["component1", "component2"] When using the bricks in a sub-namespace, you could import it like this: # some other module using the bricks in a sub-namespace
from org_name.my_namespace_1 import component1
... The pyproject.toml would need to add all components needed + the new namespace: packages = [
{include = "org_name/component1", from = "components"},
{include = "org_name/component2", from = "components"},
{include = "org_name/my_namespace_1", from = "components"},
...
] |
Beta Was this translation helpful? Give feedback.
-
I understand that you might want bricks with the same name, but in different in sub-namespaces. This could be accomplished in the suggestion above, but with an alias: # the __init__.py file of namespace_1
from org_name import some_brick_doing_X as component1
from org_name import some_brick_doing_Y as component2
__all__ = ["component1", "component2"] # the __init__.py file of namespace_2
from org_name import some_other_brick_doing_X as component1
from org_name import some_other_brick_doing_Y as component2
__all__ = ["component1", "component2"] When importing the namespace, it expose the alias: # import the component via the namespace, that has been "renamed" (alias)
from org_name.namespace_1 import component1 |
Beta Was this translation helpful? Give feedback.
-
Thank you for your excellent work. Although using alias is a good workaround, is there a plan to support namespace in future? |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Hi @DavidVujic, first of all this is such a great project, this way of organising python code makes so much sense in many situations.
The issue I came across is related to using multiple namespaces, under the top level namespace (or org_name) as mentioned in #45. This is something I think could be very useful for my use case.
But, when creating something like the example below...
Using
poetry poly create component --name=namespace_1/component_1
... And then runningpoetry poly info
, I get:Describe the solution you'd like
Would be nice
poly info
could list all the components detected under "sub namespaces". Same would apply to bases as well. For example, would like a summary something like the one below. Hopefully this makes sense?Additional context
Following on #45.
Beta Was this translation helpful? Give feedback.
All reactions