No project description provided
Project description
🐎 Horse with no namespace
horse-with-no-namespace is a tool which converts pkg_resources namespace packages to be compatible with PEP 420 implicit namespace packages.
Why is it needed?
The Python ecosystem provides several implementations of namespace packages, which make it possible to split the modules within a single package to be distributed in multiple distribution packages.
See https://packaging.python.org/en/latest/guides/packaging-namespace-packages/ for more background on namespace packages and their various implementations.
The pkg_resources-style namespace packages are considered obsolete, but it is difficult to incrementally migrate a namespace using them to native namespace packages, because there are situations where not all of the packages will be found. For example, this happens if one package within the namespace uses pkg_resources-style namespace packages but another package uses one of the other styles, and they are not installed in the same path.
The goal of horse-with-no-namespace is to provide a temporary solution that can be installed to make things work during the interim period while existing releases of some packages in a namespace still use the pkg_resources style, but other packages are already in the process of being converted to native namespaces packages. Once all packages in the namespace have been converted, horse-with-no-namespace is no longer needed.
How does it work?
horse-with-no-namespace interferes with both of the ways that pkg_resources-style namespace packages can be loaded.
- For packages that are installed into a
site-packagesdirectory, there is a file ending in-nspkg.pthwhich is automatically loaded by Python'ssitemodule to create the namespace package insys.modules.horse-with-no-namespaceremoves these namespace packages fromsys.modules, so that the namespace packages can be reloaded later without using the.pthmachinery. (horse-with-no-namespaceactually uses a similar hack with its own.pthfile to do this, but arranges for it to be loaded later.) - For packages imported from somewhere else in
sys.path,pkg_resources-style namespace packages are set up by a call topkg_resources.declare_namespacefrom__init__.py.horse-with-no-namespacereplacespkg_resources.declare_namespacewith a shim that instead initializes apkgutil-style namespace package (which is compatible with native namespace packages).
Can I use it with Buildout?
This approach can also help with packages installed using zc.buildout.
However, horse-with-no-namespace itself must not be installed using Buildout, but should be installed using pip into the same virtualenv where zc.buildout is installed. If horse-with-no-namespace is installed using Buildout, then its .pth file will not be loaded, since it is not in the site-packages folder.
Installation
pip install horse-with-no-namespace
License
horse-with-no-namespace is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file horse_with_no_namespace-20251105.1.tar.gz.
File metadata
- Download URL: horse_with_no_namespace-20251105.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d58bc23e20eb454a30608174f372cac6092ff396b516ea9ff3c300ec53856a3
|
|
| MD5 |
c787a52be903d05af81e4a0bb5aeb629
|
|
| BLAKE2b-256 |
496003dfa6c30307cbdb61a7b8757e35614c14ddf903346e645d83bf440293be
|
Provenance
The following attestation bundles were made for horse_with_no_namespace-20251105.1.tar.gz:
Publisher:
publish.yml on davisagli/horse-with-no-namespace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
horse_with_no_namespace-20251105.1.tar.gz -
Subject digest:
6d58bc23e20eb454a30608174f372cac6092ff396b516ea9ff3c300ec53856a3 - Sigstore transparency entry: 673070083
- Sigstore integration time:
-
Permalink:
davisagli/horse-with-no-namespace@3374958c9b4aae823a73db6d92e2b4796c7b725c -
Branch / Tag:
refs/tags/v20251105.1 - Owner: https://github.com/davisagli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3374958c9b4aae823a73db6d92e2b4796c7b725c -
Trigger Event:
push
-
Statement type:
File details
Details for the file horse_with_no_namespace-20251105.1-py3-none-any.whl.
File metadata
- Download URL: horse_with_no_namespace-20251105.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672f4e8d13951092af75c203a4cda83ba9151b17e28d9b480eec049d5ec0eca9
|
|
| MD5 |
11d27fcfc6f5b00a3961ea0d52676da8
|
|
| BLAKE2b-256 |
4f4021dd501fffc544bc8098055bc51421c2ddb45c50564d636c65df0e990152
|
Provenance
The following attestation bundles were made for horse_with_no_namespace-20251105.1-py3-none-any.whl:
Publisher:
publish.yml on davisagli/horse-with-no-namespace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
horse_with_no_namespace-20251105.1-py3-none-any.whl -
Subject digest:
672f4e8d13951092af75c203a4cda83ba9151b17e28d9b480eec049d5ec0eca9 - Sigstore transparency entry: 673070098
- Sigstore integration time:
-
Permalink:
davisagli/horse-with-no-namespace@3374958c9b4aae823a73db6d92e2b4796c7b725c -
Branch / Tag:
refs/tags/v20251105.1 - Owner: https://github.com/davisagli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3374958c9b4aae823a73db6d92e2b4796c7b725c -
Trigger Event:
push
-
Statement type: