easy_import.py
Project description
easy_import
Python imports made easy! Import any module or package from anywhere - as though it was in your current working directory.
Installation
Download the zip of the repository.
Run the
example.py
file for a quick tutorial.
Then to use in your projects, just copy
easy_import.py
to your working directory.
Will soon be available on PyPI to allow pip install:
pip install easy_import
Usage
"""
data_tools.py is a (fictious) module located....somwehere on your computer.
But not in the current working directory.
Directly trying to import it will raise an ImportError since its not visible.
easy_import to the rescue!
It will search the entire storage (or a given directory) for the module and make it visible
for importing as though it was in the current working directory.
"""
from easy_import import EasyImport
with EasyImport("data_tools.py"):
import data_tools
# etc
"""
Now we can use a function or class in data_tools.py
e.g. :
"""
smoothed_data = data_tools.smooth(data)
"""
Since searching the entire storage is s l o w, the locations of searched items
are cached to json files so the next time you run it, it will be super fast!
Check out example.py in the repository for a runnable example and more details.
"""
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for easy_import-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97d6b6f18092735340ad5ee2beef164832e33b3805236dccd6aa5b2d2232d72d |
|
MD5 | 731ba1657efc12871e2b3e67d3050ea7 |
|
BLAKE2b-256 | ceee635cc1303d41ab5d384bd5264e1ff85c3bae33162eebe5eb5802272b9ca4 |