Import Python objects from arbitrary locations
Project description
importloc
Import Python objects from arbitrary locations
Features
- Import module from file
path/to/file.py - Import object from file
path/to/file.py:object[.attr...] - Import object from module
[...package.]module:object[.attr...] - No dependencies
Installation
$ pip install importloc
Usage
For more details, read the docs.
module_from_file
>>> from importloc import *
>>> foobar = module_from_file('example/foobar.py')
>>> foobar
<module 'foobar' from ...example/foobar.py'>
object_from_file
>>> from importloc import *
>>> baz = object_from_file('example/foobar.py:baz')
>>> baz
<function baz at 0x...>
object_from_module
>>> from importloc import *
>>> baz = object_from_module('example.foobar:baz')
>>> baz
<function baz at 0x...>
Changelog
Check repository CHANGELOG.md
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
importloc-0.1.0.tar.gz
(62.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file importloc-0.1.0.tar.gz.
File metadata
- Download URL: importloc-0.1.0.tar.gz
- Upload date:
- Size: 62.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d96d107b48c0373799c81f5f89caf155e7c5826ded0d0d25a6b43e91806ad8e
|
|
| MD5 |
8c103f2775733f7f6b5337fb18d8a99b
|
|
| BLAKE2b-256 |
e7197882a13254a1c8e31e7e871f1e73695bfbb1202b57d9747ccc7d66e091a7
|
File details
Details for the file importloc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: importloc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eab21f8d8ca04dad4425d7ef2d3bf86118a8fa5eceaac2aa9037cc73afb6ea60
|
|
| MD5 |
27c5ef8acac7f4eb122f14932936bfc9
|
|
| BLAKE2b-256 |
e5001176bac8ea69ca08cd59e85727bd07ee5548ca53c95fc0a286e73fdfe6bc
|