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:
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.
Http url to zip file on GitHub: http(s)://github.com/<path>/<filename>.zip
Similar to the previous type except that module is located inside an additional directory (in <filename>.zip).
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
Install
Using pip:
$ pip install importable
Usage
Make remote package importable, then import it and use:
from importable import importable
# add contents of "<filename>.zip" to python path
importable('http://<url>/<filename>.zip')
# now you can import your module
import <module_name>
Example
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/__init__.py
$ zip -r mymodule.zip mymodule
$ mv mymodule.zip /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/mymodule.zip')
>>> import mymodule
>>> print(mymodule.my_var)
I want to import this one!
Metadata
Release files for importable 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| importable-0.2.2.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| importable-0.2.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.0 kB
Release files / importable-0.2.2.tar.gz
| Download URL | importable-0.2.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba126c273f78dfc9bcaef59902b0a232ad8cd129b7604e2e226ed968d22b6b6d
|
|
BLAKE2b-256 checksum How to use checksums |
ef0fa64c5a0537032ada7fc9518add94237929a1461814ca1c5dc4450e3f2e49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / importable-0.2.2-py2.py3-none-any.whl
| Download URL | importable-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d2c3aeac8ca7d06fea82b6f69f7e68d44f8e568ab74cd073a18408928854a9e6
|
|
BLAKE2b-256 checksum How to use checksums |
625847a32098f98c6c57a6847dbab2771f49c78475a651103892f8ec4fd0f132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for importable 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.