Skip to main content

Dynamically loads a function from code represented as a string.

Project description

dynamic-function-loader

Installation

pip install dynamic-function-loader

Overview

dynamic-function-loader allows dynamically loading a Python function into the current execution environment from a string.

Usage

import dynamic_function_loader

f = dynamic_function_loader.load("def foo():\n    return 'bar'")
f()

Note

All Python packages used by the imported function must be loaded within the function itself. For example:

def foo(regex):
  import re
  return re.compile(regex)

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

dynamic-function-loader-0.0.1.tar.gz (1.7 kB view hashes)

Uploaded Source

Built Distribution

dynamic_function_loader-0.0.1-py2.py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 2 Python 3

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