Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-announce@python.org Delivered-To: python-announce-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'imports': 0.07; 'skip:` 10': 0.07; 'python': 0.08; 'url:pypi': 0.08; '-------': 0.09; 'homepage:': 0.09; 'namespace': 0.09; 'prefix': 0.09; 'packages.': 0.14; 'message-id:@glegroupsg2000goo.googlegroups.com': 0.16; 'subject:Java': 0.16; 'java': 0.21; 'collecting': 0.26; 'example': 0.27; 'import': 0.29; 'work:': 0.29; 'skip:( 20': 0.30; 'received:18': 0.30; 'received:mit.edu': 0.30; 'calling': 0.31; 'header:Received:8': 0.32; 'header:X-Complaints-To:1': 0.32; 'lines': 0.33; '...': 0.34; 'install': 0.34; 'header:User- Agent:1': 0.35; 'languages.': 0.35; 'using': 0.35; 'received:10.192.4': 0.36; 'received:10.192.4.9': 0.36; 'received:ywd9.prod.google.com': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'received:209.85.213': 0.37; 'two': 0.37; 'url:python': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'received:prod.google.com': 0.39; 'subject: (': 0.39; 'received:10.192': 0.39; 'received:209': 0.39; 'header:Mime- Version:1': 0.39; 'under': 0.40; 'your': 0.60; 'header:Reply- To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'reply- to:addr:googlegroups.com': 0.73; 'to:addr:moderators.isc.org': 0.73; 'easy:': 0.84; 'hook': 0.84 Delivered-To: comp-lang-python-announce@moderators.isc.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:x-authentication-warning:to:path:from :newsgroups:subject:date:organization:lines:message-id:reply-to :nntp-posting-host:mime-version:content-type :content-transfer-encoding:x-trace:x-complaints-to:nntp-posting-date :complaints-to:injection-info:user-agent:x-google-web-client; bh=ggP0LGqEOVfriMS/7vSvOpACDd5G53lAsdzHAO3LnGU=; b=kKJ+xvMGwsmIk9ToYVIicJcEnmEKRf41Inumayk3WjjXA6E1zdyfLFLF9j+xFsSKuD rTEwESpxfRWtWvlMzeJGcBNTVpFYmaCKrSx9Cstdpp9OPw+0pQjQiemrTdwLfZw2peyG AxjXl5+NBfce/CombSQHfLWHFjrbhbFqPjV1M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=x-authentication-warning:to:path:from:newsgroups:subject:date :organization:lines:message-id:reply-to:nntp-posting-host :mime-version:content-type:content-transfer-encoding:x-trace :x-complaints-to:nntp-posting-date:complaints-to:injection-info :user-agent:x-google-web-client; b=ut86TBVJgX7tx8nWPZ2ok2eBXm7A0HizTLOgdsJEohp4lYWjnL6WA3l+YAFHMSOs8o QNps9Py2BxPNiCNjv2iDZC9st7mKq7CylScdrQh3I7PiBI+o3o927VhEk+35bIissCUe Ma8R8fdiBMMq/uHWvMjOsPgkR0H/CSsmTYBZ8= X-Authentication-Warning: ywd9.prod.google.com: news set sender to news@google.com using -f To: comp-lang-python-announce@moderators.isc.org From: Tomer Filiba Newsgroups: comp.lang.python.announce Subject: Nimp: Nested Imports (a la Java) Date: Thu, 16 Jun 2011 01:48:32 -0700 (PDT) Organization: http://groups.google.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.114.107.4; posting-account=QZA29woAAADe-rc1eyfrBZmcIkzP48Dw User-Agent: G2/1.0 X-Google-Web-Client: true X-Mailman-Approved-At: Thu, 16 Jun 2011 21:03:01 +0200 X-BeenThere: python-announce-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org, comp.lang.python.announce@googlegroups.com List-Id: Announcement-only list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Approved: python-announce-list@python.org Message-ID: Lines: 36 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308250983 news.xs4all.nl 49180 [::ffff:82.94.164.166]:38793 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python.announce:191 Nimp (Nested Imports) is a little meta-importer hook for Python 2.3-2.7 and= 3.0-3.2 that enables the use of *nested packages* (`com.ibm.foo.bar`), as = is commonplace in Java and various other languages. It works by collecting = all packages that begin with a common prefix on your `sys.path` and "mergin= g" them into logical packages. Homepage: http://pypi.python.org/pypi/nimp Install: pip install nimp Example ------- Consider the following package layout (say, under site-packages, or anywher= e on your python path): site-packages/ com-ibm-storage/ ... package files ... com-ibm-storage-plugins/ ... package files ... com-google-protobuf/ ... package files ... com-google-appengine/ ... package files ... Using Nimp is easy: import nimp nimp.install() You can place these two lines in your `site.py`; after calling `nimp.instal= l()`, the following imports will "magically" work: import com # a namespace package (empty) import com.google.protobuf import com.ibm.storage from com.ibm.storage.plugins import MySQLPlugin