Skip to content

danijar/imptools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI   Docs

imptools

Tools for improving Python imports.

Installation

pip3 install imptools

Overview

Detailed docs

import_path

Import a module from any path on the filesystem.

import imptools

my_module = imptools.import_path(
    '../path/to/my_module',  # Path to a module directory or single file.
    notfound='error',        # Raise 'error' or 'ignore' if not found.
    reload=False,            # Whether to import if already available.
)

import my_module  # Import statement also works.

enable_relative

Enable relative imports for scripts that are not executed as module.

import imptools

imptools.enable_relative()

# Relative imports...

Tests

python3 -m pytest tests

About

Tools for improving Python imports

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages