Skip to main content

Sidestep import and load Python files as relative paths

Project description

Build Status Smuggler on PyPI

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


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)

Uploaded Source

Built Distribution

thesmuggler-1.0.1-py2.py3-none-any.whl (3.9 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page