Commit 26bcfbb
committed
Inline DEFAULT_NAMESPACE literal to avoid top-level server.py import
Cosmetic import-graph cleanup on top of #1863's move of `NAMESPACE`
from `namespace.py` into `server/server.py`. Before this change,
`tableauserverclient/__init__.py:2` did `from tableauserverclient.
server.server import NAMESPACE`, which forces `server.server` (and
its transitive endpoint tree) to load just to read a string
constant.
Copilot flagged the circular-import path this creates: `server.
server` -> `server.endpoint.endpoint` -> `from tableauserverclient
import ...` -> `__init__` -> `server.server`. Python resolves the
chain today because the reentrant lookups pull submodules whose
own load doesn't back-reference the partially-initialized parent,
but the shape is fragile and adding a new top-level import to
`__init__.py` before line 2 could easily break it.
Replaced the import with the string literal. Kept in sync with
the `NAMESPACE` constant in `server/server.py`. Also removes one
of the two entry points into `server.server` at package load,
though everything else in `__init__.py` still transitively pulls
the endpoint tree via the models block below, so no real startup
savings -- this is defensive, not a perf fix.1 parent eafeece commit 26bcfbb
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
0 commit comments