This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Nested Imports (Nimp)

Allows nested imports, a la Java. Nimp 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 and several other languages. Nimp basically allows packages to “inject” themselves into shared namespaces.

Compatible with Python 2.3-2.7 and 3.0 and up.

You can read more about nimp and __lazy__ on my blog.

Usage

import nimp
nimp.install()

You can add these two lines to your site.py script, so you’ll get Nimp out of the box.

Benefits

  • Allows for distributing “plug-in” packages independently: consider a project like twisted, made of several add-on packages (but without hacking distutils too much).
  • A project may depend on package X.Y without having to depend on X.
  • These nested-packages can be found anywhere on your python path (they don’t have to be located in the same directory)
  • A small (less than 100 LoC) standalone module that does all the magic for you – no third-party cooperation required.

Note

distutils has problems with directory names that contain dots (as in com.ibm.storage), so Nimp supports either dots or hyphens (e.g., com-ibm-storage). This allows you to distribute your package nicely, using commonplace distribution mechanisms.

The recommended way is to use hyphens, but you may continue to use dots, as was the case in previous versions. However, never mix dots and hyphens (e.g., com.ibm-storage) – it will not work.

Example Layout

Consider the following directory structure, somewhere on your python path (say, site-packages):

site-packages/

  com-ibm-storage/
    files...

  com-ibm-storage-plugins/
    files...

  com-ibm-pythontools/
    files...

After calling nimp.install(), 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 `from x import y` works too
from com.ibm.storage import ScsiDisk

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

Release History

0.9.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nimp-0.9.2.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Jun 15, 2011
nimp-0.9.2.win32.exe (202.2 kB) Copy SHA256 Checksum SHA256 any Windows Installer Jun 15, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting