Skip to main content

Allows to import zip-compressed Python package by URL (http, hdfs).

Project description

Test Status

Allows to import zip-compressed Python package by URL.

Download remote zip-compressed Python package, unzip and add to Python path.

All temp files will be removed on exit unless Python process was terminated.

Note: import should be called separatelly after calling importable. All we do here - just adding package to local python path.

Supported URL types

importable supports a limited set of URL types:

  1. Http url to zip file: http(s)://<url>/<filename>.zip

    The module, which you are going to import, should be located on the first level of <filename>.zip

    See section Example.

  2. Http url to zip file on GitHub: http(s)://<path>/<filename>.zip

    Similar to the previous type except that module is located inside an additional directory (in <filename>.zip).

  3. Hdfs url to zip file: webhdfs://<host>:<port>/<path>/<filename>.zip

    Similar to #1 except that file will be downloaded from HDFS.

    <host> - hostname or IP address of Hdfs namenode <port> - WebHdfs port of namenode


Using pip:

$ pip install importable


Make remote package importable, then import it and use:

from importable import importable

# add contents of "<filename>.zip" to python path

# now you can import your module
import <module_name>


Assuming that you have local nginx serving /var/www/html/ on port 80.

$ mkdir mymodule
$ echo "my_var = 'I want to import this one!'" > mymodule/
$ zip -r mymodule
$ mv /var/www/html

Then execute the python code:

>>> import mymodule
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'mymodule'
>>> from importable import importable
>>> importable('http://localhost/')
>>> import mymodule
>>> print(mymodule.my_var)
I want to import this one!

Project details

Download files

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

Files for importable, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size importable-0.2.2-py2.py3-none-any.whl (6.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size importable-0.2.2.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page