Skip to main content

Nested Imports for Python

Project description

Allows nested imports, a la Java. It installs a harmless meta import-hook that adds support for nested packages, i.e., multiple packages that “live” under a common namespace. This is the idiom in Java, where you have packages like com.foo.bar.spam and com.foo.bar.eggs, as well as in Haskell. Nimp basically allows packages to “inject” themselves into shared namespaces.

Compatible with Python 2.3 and up and 3.0 and up

Usage:

import nimp
nimp.install()

Example Layout

Assume the following directory structure, say, in your site-packages:

com.ibm.storage/
  files...
com.ibm.storage.plugins/
  files...
com.ibm.pythontools/
  files...

Using Nimp, the following imports will work as expected:

import com                              # a namespace package (empty)
import com.ibm                          # a namespace package (empty)
import com.ibm.pythontools              # a real package
com.ibm.pythontools.myfunc(1,2,3)

# and of course using `from` works too
from com.ibm.storage import ScsiDisk

# note how the `plugins` package was "injected" into `storage`
from com.ibm.storage.plugins import MySQLPlugin

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

nimp-0.9.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

nimp-0.9.1.win32.exe (200.5 kB view details)

Uploaded Source

File details

Details for the file nimp-0.9.1.tar.gz.

File metadata

  • Download URL: nimp-0.9.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nimp-0.9.1.tar.gz
Algorithm Hash digest
SHA256 84a2795e38b915c7bfed5960234f48832d078d0edbe073fa42592559c15261e3
MD5 0130974095aae0eadd8cc9408ebf4746
BLAKE2b-256 27a736d1bf0bbc8c49685be6532f7d64f7d5e90e0fa05b967a3b8c54d0fa5302

See more details on using hashes here.

File details

Details for the file nimp-0.9.1.win32.exe.

File metadata

  • Download URL: nimp-0.9.1.win32.exe
  • Upload date:
  • Size: 200.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nimp-0.9.1.win32.exe
Algorithm Hash digest
SHA256 4b4293820547ea91f94cf08f6b66bcd522058d2241b864ab43026dafeb583035
MD5 177a4cdd2f3c60b5ac3a724ffe3415d9
BLAKE2b-256 e0ab3937c19daef5098509d7033c96361f1a7170448d35c7f037781ce211f2a5

See more details on using hashes here.

Supported by

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