Import python code from anywhere.
importit is a python code import helper. Using it, you can dynamically import python code from different sources (like gists, python files on the internet, local python files). You don't need to copy python code snippets from project to project.
Some of use cases can be:
- Reusing python code snippets in multiple places and projects
- Dynamically reloading python code on live environments
- You tell me, what will you use it for?
From where do you want to import?
Github Gist
Find the gist id from the gist url: https://gist.github.com/<username>/<gist id>
Using this gist as an exmaple:
from importit import import_gist
imported_gist = import_gist("imported_gist", "51dcf067f4e445c3f837d26efd2c138e")
imported_gist.first_file.some_function()
imported_gist.second_file.some_other_function()
Note: The gist will be imported in the form of module, with each python file in the gist as a submodule.
Remote File
Use any valid python file url (for example, http://bit.ly/aPythonFile)
from importit import import_remote_file
imported_file = import_remote_file("imported_file", "http://bit.ly/aPythonFile")
imported_file.some_function()
Local File
from importit import import_remote_file
imported_file = import_remote_file("imported_file", "/home/divykj/aPythonFile.py")
imported_file.some_function()
Code Snippet
from importit import import_code
python_code = """
def some_function():
# do some crazy things
pass
"""
imported_code = import_code("imported_code", python_code)
imported_code.some_function()
Planning to add Github, Gitlab, Bitbucket (and other git repository services) and maybe PyPI support soon.
How to install?
❯ pip install importit
Want to contribute?
To get more information on contributing, go to the CONTRIBUTING.md.
Also read the CODE_OF_CONDUCT.md.
Metadata
Release files for importit 0.1.3
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 | Actions |
|---|---|---|---|---|
| importit-0.1.3.tar.gz | 4.3 kB | Without provenance | Details for importit-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| importit-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for importit-0.1.3-py3-none-any.whl |
Total release size: 9.8 kB
Release files / importit-0.1.3.tar.gz
| Download URL | importit-0.1.3.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a62f72b1e9016bb09c203e83020fc856f35a3c518c5a7f0dbee4f15abc47cc1
|
|
BLAKE2b-256 checksum How to use checksums |
5abd6114d83d74c08dfd531e7929ee070ef2d00e8062ce178b4d5dc0253fc756
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.9.0
|
Release files / importit-0.1.3-py3-none-any.whl
| Download URL | importit-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edce2a9fa2ebac21c67604f4601c467d4f97856f58237645f3a56ba8316f43a2
|
|
BLAKE2b-256 checksum How to use checksums |
dd797cdd6aafaaea48e3e4898e14d0e3a04d544c068a205bca67c5f963486bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.9.0
|
Security for importit 0.1.3
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.