Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NamespaceDistribution-0.0.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

NamespaceDistribution-0.0.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file NamespaceDistribution-0.0.2.tar.gz.

File metadata

  • Download URL: NamespaceDistribution-0.0.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for NamespaceDistribution-0.0.2.tar.gz
Algorithm Hash digest
SHA256 cf6e14e004c46b5b5e896be045bc367d9ca187da0c8a29d17b82a287449b40ec
MD5 6b3d17b3de06c517d868c893476e5037
BLAKE2b-256 db99d685bee92060dd430fb928d5fbfb5d06253fc2790889e37d1d02d0a7e043

See more details on using hashes here.

File details

Details for the file NamespaceDistribution-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: NamespaceDistribution-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for NamespaceDistribution-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5dfbf6a5cab10015df6a3631eb82bf08c4a1014da8dc64926b86dad162aec976
MD5 8a0fa711090f340f8f0e2151b5616178
BLAKE2b-256 04796ac38bbc71404bd6f8122e80cd18b2c82f558f02cdb44120656ce8be90b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page