semvec/pypi-packages huggingface dataset:
tyche-transforms 0.2.0
Transformation functions for Tyche market data pipelines
License: MIT
Requires Python: >=3.12

# Tyche Transforms

This package provides the transformation functions defined in `MARKETS_INFO.md` for Tyche market data pipelines,
operating on xarray DataArray inputs.
The intent is to keep the same implementations between local development and the Chainlink adapter.

## Install
```bash
uv pip install tyche-transforms
```

For development:
```bash
uv pip install -e ".[test]"
```

## Usage
```python
import pandas as pd
import xarray as xr
from tyche_transforms.transforms import date_first, runlen_lt, sum_value

times = pd.date_range("2024-01-01", periods=4)
data = xr.DataArray([15.0, 10.0, 8.0, 11.0], dims="time", coords={"time": times})
print(sum_value(data))
print(date_first(data, threshold=9.0))
print(runlen_lt(data, threshold=9.0))
```

## GitHub Actions
This repo includes a workflow that runs tests on every push/PR and publishes to PyPI when you push a tag
matching `v*` (for example `v0.2.0`). To enable publishing:

1) Add a repository secret named `PYPI_API_TOKEN` containing your PyPI token.
2) Push a version tag:
```bash
git tag v0.2.0
git push origin v0.2.0
```

## Transformation Functions

**DataArray -> Scalar**
- `SUM` (0 args): sum over window -> scalar.
- `AVG` (0 args): average over window -> scalar.
- `MAX` (0 args): max over window -> scalar.
- `INDEX_OF_MAX_VALUE` (0 args): index of the max value -> scalar.
- `MIN` (0 args): min over window -> scalar.
- `DATE_MAX` (0 args): timestamp of the max value -> scalar (timestamp).
- `DATE_FIRST:threshold` (1 arg): timestamp of first value > threshold, or epoch `pd.Timestamp(0)` if none -> scalar (timestamp).
- `RUNLEN_LT:threshold` (1 arg): longest run length where value < threshold -> scalar.
- `RUNLEN_GT:threshold` (1 arg): longest run length where value > threshold -> scalar.

**Scalar -> Scalar**
- `ABS` (0 args): absolute value of a scalar -> scalar.
- `SUBTRACT_V:threshold` (1 arg): subtract a scalar to the given threshold -> scalar.
echopykits15 0.1.0
My short description for my project.
License: MIT
Requires Python: >=3.6.0


📦 setup.py (for humans)
=======================

This repo exists to provide [an example setup.py] file, that can be used
to bootstrap your next Python project. It includes some advanced
patterns and best practices for `setup.py`, as well as some
commented–out nice–to–haves.

For example, this `setup.py` provides a `$ python setup.py upload`
command, which creates a *universal wheel* (and *sdist*) and uploads
your package to [PyPi] using [Twine], without the need for an annoying
`setup.cfg` file. It also creates/uploads a new git tag, automatically.

In short, `setup.py` files can be daunting to approach, when first
starting out — even Guido has been heard saying, "everyone cargo cults
thems". It's true — so, I want this repo to be the best place to
copy–paste from :)

[Check out the example!][an example setup.py]

Installation
-----

```bash
cd your_project

# Download the setup.py file:
#  download with wget
wget https://raw.githubusercontent.com/navdeep-G/setup.py/master/setup.py -O setup.py

#  download with curl
curl -O https://raw.githubusercontent.com/navdeep-G/setup.py/master/setup.py
```

To Do
-----

-   Tests via `$ setup.py test` (if it's concise).

Pull requests are encouraged!

More Resources
--------------

-   [What is setup.py?] on Stack Overflow
-   [Official Python Packaging User Guide](https://packaging.python.org)
-   [The Hitchhiker's Guide to Packaging]
-   [Cookiecutter template for a Python package]

License
-------

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any means.

  [an example setup.py]: https://github.com/navdeep-G/setup.py/blob/master/setup.py
  [PyPi]: https://docs.python.org/3/distutils/packageindex.html
  [Twine]: https://pypi.python.org/pypi/twine
  [image]: https://farm1.staticflickr.com/628/33173824932_58add34581_k_d.jpg
  [What is setup.py?]: https://stackoverflow.com/questions/1471994/what-is-setup-py
  [The Hitchhiker's Guide to Packaging]: https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/creation.html
  [Cookiecutter template for a Python package]: https://github.com/audreyr/cookiecutter-pypackage