A small example package
Project description
Namespace Distribution
The purpose of the distribution is to demonstrate how to install namespace packages. Namespace packages do not require __init__.py files and allow modules to be stored in separate directories but logically appear to look as if they are installed in one directory.
To understand Git Mark down files click here
1. What does it do?
This python distribution installs two namespace packages called SampleDistribution_1/pkg1 and SampleDistribution_2/pkg1. The two pkg1 directories logically look like one directory even though physically they are separate. Notice how the module SampleDistribution_2/pkg1/mod2 imports mod3 with the code "from . import mod3".
2. How is this accomplished.
The python search path, sys.path, is modified to include the directories ...\PythonXX\site-packages\SampleDistribution_1 and ...\PythonXX\site-packages\SampleDistribution_2. The logic is coded in SampleDistribution_1/pkg2/main so that the environment varible PYTHONPATH does not have to be manually changed.
3. What versions of python support namespace packages
python 3.3 and later
4. How to install
pip install NamespaceDistribution
5. How do you run it?
SDRun
6. What is the output?
in mod1.py
...\PythonXX\site-packages\SampleDistribution_1\pkg1\mod3.py
...\PythonXX\site-packages\SampleDistribution_2\pkg1\mod2.py
7. Why is the program named SDRun.
SDRun is short for Sample Distribution Run. Instead of running python -m SampleDistribution_1/pkg2/main, the console script entry point SDRun has been created for ease of use.
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
Hashes for NamespaceDistribution-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf6e14e004c46b5b5e896be045bc367d9ca187da0c8a29d17b82a287449b40ec |
|
MD5 | 6b3d17b3de06c517d868c893476e5037 |
|
BLAKE2b-256 | db99d685bee92060dd430fb928d5fbfb5d06253fc2790889e37d1d02d0a7e043 |
Hashes for NamespaceDistribution-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dfbf6a5cab10015df6a3631eb82bf08c4a1014da8dc64926b86dad162aec976 |
|
MD5 | 8a0fa711090f340f8f0e2151b5616178 |
|
BLAKE2b-256 | 04796ac38bbc71404bd6f8122e80cd18b2c82f558f02cdb44120656ce8be90b4 |