Import source file from the file system for Python
Project description
fsimport
Import source file from the file system for Python
This library is a simple wrapper around
spec = importlib.util.spec_from_file_location('module', str('/full/path/to/module'))
module_inst = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module_inst)
It is a convenient way to import files based on the file system path. The path is relative to the caller script.
Usage:
import fsimport
include_two_levels_up = fsimport('../../file.py')
include_level_up = fsimport('../another_py_file_without_ext')
include_same_level = fsimport('./include_me')
include_level_down = fsimport('./lv3/include_me.py')
Install
pip install fsimport
Links
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
fsimport-0.0.8.tar.gz
(3.1 kB
view details)
File details
Details for the file fsimport-0.0.8.tar.gz.
File metadata
- Download URL: fsimport-0.0.8.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc11206efe0287d695a3fcb028c6bc2ab1e61f7af9355adb3ea59050bae34e2f
|
|
| MD5 |
c11bdb075471f70ce6205b473883fb63
|
|
| BLAKE2b-256 |
d231cbcff17560152e137238890547da1e2e0625b6af1f7dc3792f185e2f714a
|