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')

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.2.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.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fsimport-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 d9db5270e2c1464f0f96436fe71a766b2836114b1965ee8ad80a3ef05d5077b4
MD5 6fa234c5c070305f2468fc088ed4f26c
BLAKE2b-256 b4d437acc807f2d605cf1c70535d9a370b142c468f8260e397cab631ed0190b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fsimport-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f080a6da6463837b846052bbe2c3549d2b7377fa395dfc0e9c5b984ac77a4a3e
MD5 d92ccbbbee4b98797173429681fe521a
BLAKE2b-256 0a63bd3fa78a83e5dfd375ff3cf046167890646e52a7d05d0f5624a23934cb69

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