chilly-france-44439
10/15/2025, 1:40 PMfrom openhands.sdk import ... and from openhands.tools import ... resolve cleanly side-by-side.
openhands-sdk/
├─ pyproject.toml
├─ README.md
├─ LICENSE
├─ CHANGELOG.md
├─ openhands/ # PEP 420 namespace (NO __init__.py)
│ └─ sdk/
│ ├─ __init__.py
│ ├─ agent/
│ │ ├─ __init__.py
│ │ └─ ...
│ ├─ context/
│ │ ├─ __init__.py
│ │ └─ ...
│ └─ py.typed # if typing exports are intended
├─ tests/
│ └─ ...
└─ tox.ini / pytest.ini (optional)
openhands-tools/
├─ pyproject.toml
├─ README.md
├─ LICENSE
├─ CHANGELOG.md
├─ openhands/ # PEP 420 namespace (NO __init__.py)
│ └─ tools/
│ ├─ __init__.py
│ ├─ registry/
│ │ ├─ __init__.py
│ │ └─ ...
│ ├─ runners/
│ │ ├─ __init__.py
│ │ └─ ...
│ └─ py.typed
├─ tests/
│ └─ ...
└─ tox.ini / pytest.ini (optional)
openhands-workspace/
├─ pyproject.toml
├─ README.md
├─ LICENSE
├─ CHANGELOG.md
├─ openhands/ # PEP 420 namespace (NO __init__.py)
│ └─ workspace/
│ ├─ __init__.py
│ ├─ docker/
│ │ ├─ __init__.py
│ │ └─ ...
│ ├─ local/
│ │ ├─ __init__.py
│ │ └─ ...
│ └─ py.typed
├─ tests/
│ └─ ...
└─ tox.ini / pytest.ini (optional)
openhands-agent-server/
├─ pyproject.toml
├─ README.md
├─ LICENSE
├─ CHANGELOG.md
├─ openhands/ # PEP 420 namespace (NO __init__.py)
│ └─ agent_server/
│ ├─ __init__.py
│ ├─ app/
│ │ ├─ __init__.py
│ │ └─ ...
│ ├─ cli.py # optional console entrypoint
│ └─ py.typed
├─ tests/
│ └─ ...
└─ tox.ini / pytest.ini (optional)quick-window-91705
10/15/2025, 2:09 PMchilly-france-44439
10/15/2025, 2:11 PMquiet-night-61895
10/15/2025, 3:52 PMchilly-france-44439
10/15/2025, 4:04 PMquiet-night-61895
10/15/2025, 5:36 PMsrc, but also warns of potential caveates.
Namespace packages can be useful for a large collection of loosely-related packages (such as a large corpus of client libraries for multiple products from a single company). However, namespace packages come with several caveats and are not appropriate in all cases. A simple alternative is to use a prefix on all of your distributions such asV1 will probably be the last clean chance for a long time to change the namespaces if we decide to. Maybe this workaround you've got now is the last of the trouble, but if there are more snags I'd suggest changing(you could even useimport mynamespace_subpackage_ato keep the import object short).import mynamespace_subpackage_a as subpackage_a
chilly-france-44439
10/15/2025, 5:43 PMopenhands.sdk instead of openhands-sdk was primarily because the former feels cleaner/easier to read - but i can definitely be persuaded otherwise 🙂
Still dealing with the last bit of error on separating the package now..
The root issue is that your DiscriminatedUnionMixin depends on __subclasses__() to discover all subclasses at runtime—but after moving to a PEP 420 namespace package split across multiple wheels, many of those subclasses now live in other distributions that aren't automatically imported. Python only registers a class in __subclasses__() when its module has been imported and executed, so until the openhands.tools, openhands.workspace, or openhands.agent_server modules are imported, their concrete types don't exist in memory. As a result, your dynamic union builder only sees partial subclass sets and fails to resolve or serialize correctly—not because of packaging boundaries per se, but because the new namespace layout changed import timing and visibility.chilly-france-44439
10/15/2025, 5:43 PMfrom openhands.sdk import X OR from openhands_sdk import Xchilly-france-44439
10/15/2025, 5:44 PMquiet-night-61895
10/15/2025, 5:45 PMwooden-umbrella-84098
10/15/2025, 6:31 PMopenhands- prefixes from top-level directories if possiblewooden-umbrella-84098
10/15/2025, 6:32 PMopenhands.sdk aesthetically, but I could see a pretty strong argument against different packages sharing the same top-level namespacechilly-france-44439
10/15/2025, 6:41 PMI would remove theyep this is possibleprefixes from top-level directories if possibleopenhands-
slight preference forsame here, looks like it is probably ok to keep this; and it will save us from doing the big global replaceaestheticallyopenhands.sdk
I could see a pretty strong argument against different packages sharing the same top-level namespaceAlthough i do think this is a legit python namespace (PEP420), we are probably fine here..