Simple import library for Python (not entry-point based)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OpenDev Sysadmins 3bb9456d8b OpenDev Migration Patch 2 months ago
simport Add PEP8 check and fix related issues 3 years ago
tests Add PEP8 check and fix related issues 3 years ago
.gitignore Add PEP8 check and fix related issues 3 years ago
.gitreview OpenDev Migration Patch 2 months ago
LICENSE Initial commit 5 years ago
README.md Fixed up docs 5 years ago
requirements.txt Add PEP8 check and fix related issues 3 years ago
setup.cfg Bump dev status 3 years ago
setup.py added setup and tox support 5 years ago
tox.ini Add PEP8 check and fix related issues 3 years ago

README.md

simport

Simple Import Library for Python

Supports importing functions or class methods from files not in the Python Path.

Using Simport

import simport

# For modules already in the Python Path
function = simport.load('mymodule.myfunction')
class_method = simport.load('mymodule:MyClass.mymethod')
klass = simport.load('mymodule:MyClass')  # uninstanstiated.

# For modules not in the Python Path
function = simport.load('/path/to/dir|module_name:myfunction')
class_method = simport.load('/path/to/dir|module_name:MyClass.mymethod')

Look at the tests for some interesting naming conventions for specifying relative modules, etc.

Running Tests

From the simport root directory, run tox