Relative imports that actually work
Project description
Install
pip install python-include
Use
import python_include
# import [name] from-anywhere (doesnt pollute global namespace)
hello = python_include.file("./path/to/file/with/hello/func/code.py", {"__file__":__file__}).hello
hello()
# import [*everything*] from-anywhere (does pollute global namespace)
python_include.file("./path/to/file/with/hello/func/code.py", globals())
hello() # function that was defined inside that^ "code.py"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_include-2.0.0.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file python_include-2.0.0.tar.gz
.
File metadata
- Download URL: python_include-2.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70f206ffee946a9771c1fbe6a061e52c97c3c2c16a1ae0ff2a0672545c05798b |
|
MD5 | b5095cf6529c46decb191e3fe4f6f9e8 |
|
BLAKE2b-256 | a1d2002dba951518fbaf414ad9153551817e2b8a36ab27aa270b89d4fead9e3e |
File details
Details for the file python_include-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: python_include-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ea2a8d95f7da3de211cb094a20e7a5f7b7d1c8441a998a785e1465234f197da |
|
MD5 | 239e04bc8539f88415e6aa3e2658c133 |
|
BLAKE2b-256 | 490864bfd7ea1eb7bce6eedbb4f6c22e286d935f835847276a99463962898a92 |