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.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

nimp-0.9.win32.exe (200.3 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for nimp-0.9.tar.gz
Algorithm Hash digest
SHA256 a9b817bcfc3a256a5931f740f132846ad20d52fe97fe42e8808996ff11a352f4
MD5 29de8ffb965b966e52bf188311f8c6b1
BLAKE2b-256 b2372f1cd2c758c5fb62f13d18419ba26a85a350c44afc98f9a6ff43fd8eb6a2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nimp-0.9.win32.exe
Algorithm Hash digest
SHA256 bcbb0b5f3692486982598a44de3c0fe158a2a3db53e9f524888d3425a92dcfe1
MD5 2f7ad9a43588058687f594b67d74e5cf
BLAKE2b-256 090c1b6b84febce1234689696eba39bee3ed10c5e0ebd3fd287c6f5a99c7c797

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