Sidestep import and load Python files as relative paths
Project description
Sidestep import
and load Python files as relative paths.
Intended for one-off imports (e.g. global configuration). Currently, thesmuggler
can’t import files that import other local packages, but you can smuggle
files that
have already smuggled other files.
Tested and working on Python 2.7 and up.
Usage
pip install thesmuggler
, then:
from thesmuggler import smuggle
# À la `import weapons`
weapons = smuggle('weapons.py')
# À la `from contraband import drugs, alcohol`
drugs, alcohol = smuggle('drugs', 'alcohol', source='contraband.py')
# À la `from contraband import drugs as dope, alcohol as booze`
dope, booze = smuggle('drugs', 'alcohol', source='contraband.py')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
thesmuggler-1.0.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for thesmuggler-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d153131355aa0a53e2e124c40e777413397c7960966b0d006699f66ffb7f90d0 |
|
MD5 | 4bcca56b3c7ee5a367506e133436da37 |
|
BLAKE2b-256 | c19741b17caf76c6019479f3dbda3f374eaaa9cc5b2ef0a2158027263146a070 |