You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Graphs can be built either from `namespace packages`_ or from their `portions`_.
120
118
121
119
What's a namespace package?
122
120
###########################
123
121
124
-
Namespace packages are a Python feature allows subpackages to be distributed independently, while still importable under a shared namespace. This is, for example, used by `the Python client for Google's Cloud Logging API`_. When installed, it is importable in Python as ``google.cloud.logging``. The parent packages ``google`` and ``google.cloud`` are both namespace packages, while ``google.cloud.logging`` is known as the 'portion'. Other portions in the same namespace can be installed separately, for example ``google.cloud.secretmanager``.
122
+
Namespace packages are a Python feature allows subpackages to be distributed independently, while
123
+
still importable under a shared namespace.
124
+
125
+
This is used by
126
+
`the Python client for Google's Cloud Logging API`_, for example. When installed, it is importable
127
+
in Python as ``google.cloud.logging``. The parent packages ``google`` and ``google.cloud`` are both namespace
128
+
packages, while ``google.cloud.logging`` is known as the 'portion'. Other portions in the same
129
+
namespace can be installed separately, for example ``google.cloud.secretmanager``.
130
+
131
+
Examples::
132
+
133
+
# In this one, the portion is supplied. Neither "google" nor "google.cloud"
# Neither "google" nor "google.cloud" will appear in the graph,
139
+
# as will other installed packages under the "google" namespace such
140
+
# as "google.auth".
141
+
>>> graph = grimp.build_graph("google")
125
142
126
-
Grimp expects the package name passed to ``build_graph`` to be a portion, rather than a namespace package. So in the case of the example above, the graph should be built like so::
143
+
# This one supplies a subnamespace of "google" - it will include
144
+
# "google.cloud.logging" and "google.cloud.secretmanager" but not "google.auth".
0 commit comments