Skip to main content

Import Python objects from arbitrary locations

Project description

importloc

Import Python objects from arbitrary locations

versions pypi tested with multipython using docsub license

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

importloc-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for importloc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d96d107b48c0373799c81f5f89caf155e7c5826ded0d0d25a6b43e91806ad8e
MD5 8c103f2775733f7f6b5337fb18d8a99b
BLAKE2b-256 e7197882a13254a1c8e31e7e871f1e73695bfbb1202b57d9747ccc7d66e091a7

See more details on using hashes here.

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

Hashes for importloc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eab21f8d8ca04dad4425d7ef2d3bf86118a8fa5eceaac2aa9037cc73afb6ea60
MD5 27c5ef8acac7f4eb122f14932936bfc9
BLAKE2b-256 e5001176bac8ea69ca08cd59e85727bd07ee5548ca53c95fc0a286e73fdfe6bc

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