Skip to main content

Imports an object based on a string

Project description

import_string

https://img.shields.io/pypi/v/import_string.svg https://img.shields.io/travis/rochacbruno/import_string.svg Documentation Status Updates

Imports an object based on a string

Features

Imports an object based on a string. This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (.) or with a colon as object delimiter (:). If silent is True the return value will be None if the import fails.

Usage

import import_string

module = import_string('my_system.my_package.my_module')

function = import_string('my_system.my_module:some_function')

Class = import_string('my_system.my_module:SomeClass', silent=True)
# If path doesn't exist Class = None

Credits

History

0.1.0 (2016-06-30)

  • First release on PyPI.

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

import_string-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

import_string-0.1.0-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file import_string-0.1.0.tar.gz.

File metadata

File hashes

Hashes for import_string-0.1.0.tar.gz
Algorithm Hash digest
SHA256 67528219c433ee6037944e52482989770333b4b02f380a44c5560c09f8bc3a61
MD5 377b22d04267613d60a869662117569e
BLAKE2b-256 37a696d706f61fb06b85d2ba2292ff1f18c9cf3f8eefaf68dbed219c9eb07c3c

See more details on using hashes here.

File details

Details for the file import_string-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for import_string-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5fc47d00bd324e7ea8da97248b57799c59da5d097085178073030b839897d5e5
MD5 3c69fb3e977e238a99761324f577f56a
BLAKE2b-256 0e69cf9315d0905ab9146212c9a3ab1ae9ae25f893606397e2533f6adee8232f

See more details on using hashes here.

Supported by

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