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 very 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 allows for 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('../../include')
include_level_up = fsimport('../include')
include_same_level = fsimport('./include')
include_level_down = fsimport('./lv3/include')

Install

pip install fsimport

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsimport-0.0.3-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fsimport-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 cecc457818655258332c8f417aa4b96b6b4ebe14d980e63361ee3e6a48052cb7
MD5 286ad94dbd80470d0cefe346ee5751fb
BLAKE2b-256 2fed13db2077b2cc5351e5c3d9802784b4fe375948d29de1626f078523756689

See more details on using hashes here.

File details

Details for the file fsimport-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: fsimport-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25042571ee7aa7b8efb71a77d276e278107ccc5416a649edc1db9d7259c6798c
MD5 3c0af1dc2ed71f176cafd93ba2edb3d1
BLAKE2b-256 7e23808168e20d351ac09707e478200a5759ae5f710bd3253796b6246c05155b

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