Skip to main content

Runtime package for building models on the TRAC Data & Analytics Platform

Project description

TRAC Model Runtime for Python

TRAC D.A.P. is a next-generation data and analytics platform for use in highly regulated environments

The TRAC model runtime provides all the APIs needed to write models for the TRAC platform. It includes an implementation of the runtime library that can be used as a development sandbox, so you can run and debug TRAC models right away from your favourite IDE or notebook. A number of tools are included to make it easy to plug in development data and configuration. When your models are ready they can be loaded into a real instance of TRAC for testing and eventual deployment.

Documentation for the TRAC platform is available on our website at tracdap.finos.org.

Requirements

The TRAC runtime for Python has these requirements:

  • Python: 3.9 up to 3.13
  • Pandas: 1.2 up to 2.2 (optional)
  • NumPy: 1.2 up to 2.2 (optional, required by Pandas)
  • Polars: 1.X (optional)

3rd party libraries may impose additional constraints on supported versions of key libraries. For example, Pandas 1.5 is not available for Python 3.12 or 3.13, while NumPy 2.0 is only compatible with Pandas 2.1 and later.

Installing the runtime

The TRAC runtime package can be installed directly from PyPI:

pip install tracdap-runtime

The TRAC runtime depends on Pandas and PySpark, so these libraries will be pulled in as dependencies. If you want to target particular versions, install them explicitly first.

Writing a model

Once the runtime is installed you can write your first TRAC model! Start by inheriting the TracModel base class, your IDE should be able to generate stubs for you:

import tracdap.rt.api as trac

class SampleModel(trac.TracModel):

    def define_parameters(self) -> tp.Dict[str, trac.ModelParameter]:
        pass

    def define_inputs(self) -> tp.Dict[str, trac.ModelInputSchema]:
        pass

    def define_outputs(self) -> tp.Dict[str, trac.ModelOutputSchema]:
        pass

    def run_model(self, ctx: trac.TracContext):
        pass

You can fill in the three define_* methods to declare any parameters, inputs and outputs your model is going to need, then start writing your model code in run_model.

To learn about modelling with TRAC D.A.P. and what is possible, check out the modelling tutorials available in our online documentation. The tutorials are based on example models in the TRAC GitHub repository. We run these examples as part of our CI, so they will always be in sync with the corresponding version of the runtime library.

Building the runtime from source

This is not normally necessary for model development, but if you want to do it here are the commands.

cd tracdap-runtime/python

# Configure a Python environment

python -m venv ./venv
venv\Scripts\activate              # For Windows platforms
. venv/bin/activate                # For macOS or Linux
pip install -r requirements.txt

# Build the Python package files

python ./build_runtime.py --target dist

The package files will appear under build/dist

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracdap_runtime-0.9.0rc1.tar.gz (208.2 kB view details)

Uploaded Source

Built Distribution

tracdap_runtime-0.9.0rc1-py3-none-any.whl (288.1 kB view details)

Uploaded Python 3

File details

Details for the file tracdap_runtime-0.9.0rc1.tar.gz.

File metadata

  • Download URL: tracdap_runtime-0.9.0rc1.tar.gz
  • Upload date:
  • Size: 208.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tracdap_runtime-0.9.0rc1.tar.gz
Algorithm Hash digest
SHA256 dfbf1a630a97c60da3a58070231252e874cbaa647e8c1ef59b2ebfcfc531000f
MD5 b93d3f637520113f2227768e05e8da46
BLAKE2b-256 f55403ee056c90c6efb9b3f21a52d94792d9e813501cbced58b0926290df83fb

See more details on using hashes here.

File details

Details for the file tracdap_runtime-0.9.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for tracdap_runtime-0.9.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e35557826b3874b21e0b16e67bd82e63725563f86b759e46ed37bc396fd91b4
MD5 6d7eb1f1f1e6a55a25d9dad765c93941
BLAKE2b-256 8d78ad094ebf2a2ce0a9f093fcf1d6b4e2de02162657fefcd5316b8c405e7ff9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page