Skip to main content

Get an object by name or dotted path, import if it necessary.

Project description

Get an object by name or dotted path, import if it necessary.

Install

pip install object_by_name

Usage

>>> from object_by_name import object_by_name
>>> object_by_name('test_package')
<module 'test_package' from ...>
>>> object_by_name('test_package.test_module')
<module 'test_package.test_module' from ...>
>>> object_by_name('test_package.test_module.TestClass')
<class 'test_package.test_module.TestClass'>
>>> object_by_name('test_package.test_module.instance')
<test_package.test_module.TestClass object at 0x...>
>>> object_by_name('test_package.test_module.instance.method')
<bound method TestClass.method of <test_package.test_module.TestClass ...>>

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

object_by_name-0.0.1.tar.gz (1.8 kB view details)

Uploaded Source

File details

Details for the file object_by_name-0.0.1.tar.gz.

File metadata

File hashes

Hashes for object_by_name-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7ed6123e9843ba3a728ee1517ff7a6cc7e935e78084cb436414a8a1254806c31
MD5 e7c708eaa0b07bb16a9ea02e6c4f98a9
BLAKE2b-256 f065b35ab51b03be876cab045ac1215bafc3aa217c17bd095ebf3c734332705d

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