Skip to main content

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

PyPI - https://pypi.org/project/fsimport/0.0.3/

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.5.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file fsimport-0.0.5.tar.gz.

File metadata

  • Download URL: fsimport-0.0.5.tar.gz
  • Upload date:
  • Size: 3.0 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

Hashes for fsimport-0.0.5.tar.gz
Algorithm Hash digest
SHA256 bb69ebba79bd1446a3a46a4836625fb09e6dc26a09352a8d30606ef6bc91e1d9
MD5 0429f66fff48fa6a84a5fa7e9ca30bad
BLAKE2b-256 bf1e052c9fe799b19bea49a988d1618ccff6b7379fb24f774fe7549c73d25cb4

See more details on using hashes here.

Supported by

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