{"id":17034508,"url":"https://github.com/randomir/namespace-packages-test","last_synced_at":"2025-03-22T22:17:17.718Z","repository":{"id":147756360,"uuid":"126242556","full_name":"randomir/namespace-packages-test","owner":"randomir","description":"Test specific features of namespace packages in Python 2/3","archived":false,"fork":false,"pushed_at":"2018-03-24T03:16:13.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T01:48:24.097Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randomir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-21T21:26:21.000Z","updated_at":"2018-03-24T03:16:14.000Z","dependencies_parsed_at":"2023-05-27T10:30:43.255Z","dependency_job_id":null,"html_url":"https://github.com/randomir/namespace-packages-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomir%2Fnamespace-packages-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomir%2Fnamespace-packages-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomir%2Fnamespace-packages-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomir%2Fnamespace-packages-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randomir","download_url":"https://codeload.github.com/randomir/namespace-packages-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245026042,"owners_count":20549073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T08:43:49.730Z","updated_at":"2025-03-22T22:17:17.690Z","avatar_url":"https://github.com/randomir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Namespace packages: battle-testing\n\nThe goal of this repo is to test several hypotheses about namespace packages and\ntheir usage in real-life scenarios. Tests are focused on Python 3, but for\ncompleteness we run them in Python 2, too.\n\nDifferent approaches for creating namespace packages are covered in PyPA's\n[Packaging namespace packages](https://packaging.python.org/guides/packaging-namespace-packages/)\ndocument, as well in [PEP-420](https://www.python.org/dev/peps/pep-0420).\nBasic examples are given in [pypa/sample-namespace-packages](https://github.com/pypa/sample-namespace-packages)\nGitHub repository.\n\nHere we're extending these samples (for `native` and `pkgutil` approaches) to\ntest the following claims:\n\n - no autocomplete on second-level packages\n - all stem `__init__.py` must be empty\n - uninstalls break the namespace\n - developer installs might not work effectively\n\n## Running tests\n\n    $ pip install -r requirements.txt\n    $ nox\n\n## Raw results\n\nMoved to [raw.md](raw.md).\n\n## Interpreted results\n\n### Basic case, vanilla namespace packages (`same_level_only` and `non_clashing_levels`)\n\n  - `root` is an empty shared namespace for `root.a` and `root.b` (split in two packages),\n    or for `root.a` and `root.b.c`\n  - `pkgutil` approach works for all install type variants, in all Python versions\n  - development and regular install work equally well\n  - in Python 2, for regular pip install method, uninstall of one package breaks the import of the other\n  - (fully) works in Python 3 (all test cases pass)\n  - developer install works in Python 2, but regular uninstall doesn't\n\n### Partially overlapping namespaces (`mixed_levels`)\n\n  - `root.b` is not empty, yet we try to overlap it with `root.b.c`\n  - (fully) works only in Python 3 for only regular pip installs, but both approaches\n\n### Overlapping namespaces, with mixed module definitions (`mixed_levels__mixed_module_def`)\n\n  - non-empty `root.b` is overlapped with `root.b.c` (as in previous case), but then also\n    with `root.b.d` (implemented in module file `d.py`) and `root.b.e` (implemented in `e/__init__.py`)\n  - (fully) works only in Python 3 for only regular pip installs and only `native` approach\n\n## Conclusions\n\n  - For full Python 2 and 3 compatibility, all stem `__init__.py` must be empty.\n\n  - Developer installs work.\n\n  - Uninstall works in Python 3 and mostly in Python 2.\n\n  - To have autocomplete on second-level packages, clashing namespaces would have to be used,\n    and those work only for native namespace packages in Python 3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomir%2Fnamespace-packages-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandomir%2Fnamespace-packages-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomir%2Fnamespace-packages-test/lists"}