Skip to main content

A library for quickly applying symbolic expressions to NumPy arrays

Project description

expressive

A library for quickly applying symbolic expressions to NumPy arrays

Inspired in part by this Stack Overflow Question Using numba.autojit on a lambdify'd sympy expression

installation

via pip https://pypi.org/project/expressive/

pip install expressive

usage

refer to tests for examples for now

generally follow a workflow like

  • create instance expr = Expressive("a + log(b)")
  • build instance expr.build(sample_data)
  • instance is now callable expr(real_data)

The data should be provided as dict of NumPy arrays

data = {
    "a": numpy.array(range(1_000_000), dtype="int64"),
    "b": numpy.array(range(1_000_000), dtype="int64"),
}

testing

install dependencies

Only docker and compose (v2?) are required (used to generate the test environment)

sudo apt install docker.io docker-compose-v2

run tests

Just directly run the test script from the root of the repository, it will build the docker test environment and run itself inside it automatically

./test/runtests.sh

contributing

The development process is currently private (though most fruits are available here!), largely due to this being my first public project with the potential for other users than myself, and so the potential for more public gaffes is far greater

Please refer to CONTRIBUTING.md and LICENSE.txt and feel free to provide feedback, bug reports, etc. via Issues, subject to the former

additional future intentions for contributing

  • improve internal development history as time, popularity, and practicality allows
  • move to parallel/multi-version/grid CI over all-in-1, single-version dev+test container
  • greatly relax dependency version requirements to improve compatibility

version history

v1.2.1
  • add more detail to contributing block
  • switch array dimensions checking from .shape to .ndim
  • switch tests from numpy.array(range()) to numpy.arange()
v1.2.0
  • enable autobuilding (skip explicit .build() call)
  • basic display support for Expressive instances
v1.1.1
  • add version history block
v1.1.0
  • fixed bug: signature ordering could be unaligned with symbols, resulting in bad types
  • added support for non-vector data arguments
v1.0.0
  • completely new code tree under Apache 2 license
  • basic support for indexed offsets
v0.2.0 (unreleased)
v0.1.0
  • very early version with support for python 3.5

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

expressive-1.2.1.tar.gz (14.7 kB view hashes)

Uploaded Source

Built Distribution

expressive-1.2.1-py3-none-any.whl (13.1 kB view hashes)

Uploaded 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