Metadata-Version: 2.4
Name: uptimely-core
Version: 0.8.0
Summary: Manage data-driven numerical analytics with complex dependencies at scale
License-Expression: MIT
License-File: LICENSE
Keywords: analytics,declarative,industrial,feature-engineering,polars
Author: Mikael Ahonen
Author-email: mikael.ahonen@uptimely.ai
Requires-Python: >=3.13,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Provides-Extra: mcp
Provides-Extra: s3
Requires-Dist: Jinja2 (>=3.1,<4.0)
Requires-Dist: boto3 (>=1.34,<2.0) ; extra == "s3"
Requires-Dist: fastmcp (>=2.12,<5.0) ; extra == "mcp"
Requires-Dist: graphable (>=0.6.1,<0.8)
Requires-Dist: numpy (>=1.26,<3.0)
Requires-Dist: polars (>=1.0,<2.0)
Requires-Dist: pydantic (>=2.10,<3.0)
Project-URL: Documentation, https://uptimely-ai.github.io/uptimely-core
Project-URL: Homepage, http://uptimely.ai/core/
Project-URL: Repository, https://github.com/uptimely-ai/uptimely-core
Description-Content-Type: text/markdown

# Uptimely Core

Uptimely Core helps data science teams build, validate and run analytical pipelines with complex
input/output dependencies.

Use it for machine telemetry, process analytics, failure prediction, and
factory optimization. Currently works on batch, streaming abstractions are on the roadmap.

Definitions can be authored in Python and exported to JSON, or supplied directly as JSON. The built-in execution backend uses Polars, and the engine supports configurable runtime adapters.

> [!WARNING]
> This project follows semantic versioning, but is still at `0.x`: minor
> releases may include breaking changes. See the [changelog](CHANGELOG.md)
> for details.

## Demo

![Uptimely Core Demo](https://uptimely-public.s3.pl-waw.scw.cloud/uptimely-demo/uptimely-core/uptimely-core-feature-lineage.png)

Browset the [example project explorer](https://uptimely-ai.github.io/uptimely-core/examples/pump_analytics/).

More business stuff at [uptimely.ai website](https://uptimely.ai).

## Install

Python 3.13 or newer is required.

With pip:

```sh
pip install uptimely-core
```

With poetry:

```sh
poetry add uptimely-core
```

## End-to-end example

This short workflow downloads, builds, and runs the included pump analytics
project. The build compiles its analytics definition into an execution plan.
The run executes that plan.

With Poetry, prefix these commands with `poetry run`.

Download the example project:

```sh
uptimely examples
```

Build the project:

```sh
uptimely build examples/pump_analytics --verbose
```

The build creates files
under `examples/pump_analytics/_generated/build/`. Rebuild after changing the
project source.

Execute the data pipeline:

```sh
uptimely run examples/pump_analytics --verbose --preview 10
```

Output will show the materialized datasets:

![Uptimely run preview](https://uptimely-public.s3.pl-waw.scw.cloud/uptimely-demo/uptimely-core/uptimely-core-run-preview.png)


## Python API

The previous example was built by [Python authored example specification](examples/pump_analytics/). The specification describes entities, datasets and actions. The functions are pure Python - the decorator is just a label enabling automatic structural validation.

Here even more simplified example.

```python
import polars as pl
import uptimely as up


@up.function(kind="read")
def read_values() -> pl.DataFrame:
    return pl.DataFrame(
        {
            "id": [1, 2],
            "value": [10, 20],
        }
    )


@up.function(kind="vectorize")
def double(dataset: pl.LazyFrame, value: str, output: str) -> pl.LazyFrame:
    return dataset.with_columns((pl.col(value) * 2).alias(output))


@up.function(kind="write")
def print_results(dataset: pl.DataFrame) -> None:
    print(dataset)


class CalculatedData(up.Dataset):
    id = "calculated_dataset"
    entity = "measurements"

    producers = [
        up.Action(
            id="read",
            function=read_values,
            arguments={},
            outputs=[up.Feature(name="value")],
        ),
        up.Action(
            id="double",
            function=double,
            arguments={
                "dataset": up.ref.dataframe(),
                "value": up.ref.column("value"),
                "output": up.ref.output("doubled"),
            },
            outputs=[up.Feature(name="doubled")],
        ),
    ]
    publishers = [
        up.Action(
            id="print",
            function=print_results,
            arguments={"dataset": up.ref.dataframe()},
            outputs=[],
        )
    ]


python_spec = up.Spec(
    dimensions=[up.Dimension(id="id", type="integer")],
    entities=[
        up.Entity(
            id="measurements",
            name="Measurements",
            dimensions=["id"],
        )
    ],
    datasets=[CalculatedData],
    name="Analytics Specification",
)
```

Then create `run.py` in the project root and run it with `python run.py`.
The engine takes the built bundle, which contains the plan and its runtime
context. This is alternative to the previous CLI example:

```python
from uptimely import Engine, project
from uptimely.engine import EngineConfig

bundle = project.build_project(".")
result = Engine(bundle, EngineConfig()).run()
```

## Further exploration

Use the project explorer to inspect a project visually:

```sh
uptimely explore examples/pump_analytics
```

Open <http://127.0.0.1:8001/> to view the Explorer.

See the [documentation site](https://uptimely-ai.github.io/uptimely-core/) for
the full guides, and the [Python API reference](docs/python/index.md) for
public classes, functions, and signatures.

## Repository guide

| Path | Purpose |
| --- | --- |
| [`docs/`](docs/index.md) | Architecture, specification, and development documentation. |
| [`examples/`](examples/README.md) | Runnable examples and generated artifacts. |
| [`scripts/`](scripts) | Code snippets for repository management |
| [`src/uptimely/`](src/uptimely/) | Package implementation for analytics, compilation, dependencies, documentation, and execution. |
| [`tests/`](tests/) | Automated tests for the package and examples. |

## Development

See
[CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow.

## License

Released under the [MIT license](LICENSE). Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).

## Feedback

We are happy to hear development ideas, bug reports and other form of feedback.

Find the contact details from [Uptimely website](https://uptimely.ai).

