Metadata-Version: 2.4
Name: splime
Version: 0.1.2
Summary: Reuse Python functions across projects without rewriting or redeploying them.
Author-email: Yastrebov Kirill <yastrebovks@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://splime.io
Project-URL: Documentation, https://splime.io
Project-URL: Repository, https://github.com/yastrebovks/splime
Project-URL: Issues, https://github.com/yastrebovks/splime/issues
Keywords: splime,spl,python,functions,reuse,nodes,pipeline,remote-execution,registry
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Distributed Computing
Classifier: Typing :: Typed
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: pyyaml==6.0.3
Requires-Dist: keyring==25.7.0
Requires-Dist: quart==0.20.0
Provides-Extra: dev
Requires-Dist: ipykernel==7.3.0; extra == "dev"
Requires-Dist: ipywidgets==8.1.8; extra == "dev"
Requires-Dist: matplotlib==3.11.0; extra == "dev"
Requires-Dist: seaborn==0.13.2; extra == "dev"
Requires-Dist: nbformat==5.10.4; extra == "dev"
Requires-Dist: numpy==2.5.0; extra == "dev"
Requires-Dist: sympy==1.14.0; extra == "dev"
Requires-Dist: scikit-learn==1.9.0; extra == "dev"
Requires-Dist: xgboost-cpu==3.3.0; extra == "dev"
Requires-Dist: dominate==2.9.1; extra == "dev"
Provides-Extra: test
Requires-Dist: python-dotenv[cli]; extra == "test"
Requires-Dist: pyexpect; extra == "test"
Requires-Dist: mypy==2.1.0; extra == "test"
Requires-Dist: pytest==9.1.1; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx==9.1.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme==3.1.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints==3.11.0; extra == "docs"
Provides-Extra: build
Requires-Dist: build==1.5.0; extra == "build"
Requires-Dist: pip-tools==7.5.3; extra == "build"
Dynamic: license-file

# splime

**Reuse Python functions across projects without rewriting or redeploying them.**

splime turns trusted Python functions into versioned, portable **nodes** that can be
reused across projects and executed locally or remotely. You publish a function to a
private library once, then any project can call it by name, run it where the data or the
hardware lives, and read back the result and artifacts — without copying code or
redeploying.

- **Python-first.** Plain Python functions and pipelines, no DSL to learn.
- **Reuse-first.** Publish once, call by name from anywhere.
- **Private-team-first.** Your own libraries and workers, with explicit ownership and scoped access.
- **Local or remote.** The same call runs on your machine during development, or on a private worker that has the data, the GPU, or the credentials.

> splime is a private node registry and execution layer — not a workflow orchestrator, a
> scheduler, or a public marketplace. It does not replace Airflow, Prefect, or Temporal.

---

## Requirements

- Python **3.13+**

## Install

```bash
pip install splime
```

The distribution is named `splime`; the Python import package is `spl`.

## Quickstart

**1. Start the local daemon** (it stores your objects and runs workers):

```bash
spl-daemon serve            # listens on http://127.0.0.1:8765 by default
```

**2. Publish a function and call it** — a plain `SPLClient()` is fully local and never
contacts a server:

```python
from spl.client import SPLClient

def daily_total(date: str) -> float:
    prices = {"2026-06-08": [11.0, 6.5, 24.5]}
    return sum(prices.get(date, []))

client = SPLClient()                       # local-first; no server contact
client.publish(daily_total, name="daily_total")

result = client.call("daily_total", kwargs={"date": "2026-06-08"})
print(result.mode)    # "local"
print(result.value)   # 42.0
```

That is the whole loop: define a function, `publish` it as a versioned node, then `call`
it by name and get back the value (plus logs and any artifacts).

## Run it where the data lives

The same `call` becomes a remote run when you point it at a library, an owner, or a
target machine. This requires a connected splime server and a private worker; the local
daemon builds an isolated environment on the worker before executing.

```python
client = SPLClient(user_token="…", machine_token="…")   # connect the daemon to your server

result = client.call(
    "daily_total",
    kwargs={"date": "2026-06-08"},
    target_machine="gpu-box",        # hand the run to a private worker
)
print(result.mode)    # "server"
```

`SPLClient()` without tokens stays entirely local — connecting to a server is always
optional.

## Libraries

Libraries group versioned objects and control who can see and run them. Creating and
curating libraries uses a server-connected client:

```python
client.create_library("risk", display_name="Risk", visibility="private")
client.publish(risk_score, name="risk_score", library="risk")

# Grant scoped access to a teammate
client.grant_library("risk", "analyst1", scopes=["metadata:read", "objects:read", "execute"])
```

A library can also reference a live object from another library (`add_reference`, follows
`latest`) or take an owned snapshot with provenance (`copy_object`).

## Security & trust

splime runs code that you publish on purpose, on machines you control. It is built around:

- **explicit ownership** of every published object,
- **scoped access** grants per library (read metadata, read objects, execute),
- **private worker boundaries** — the server coordinates, your own workers execute,
- **isolated environments** built by the daemon before a run,
- an **auditable run history**.

## How it fits together

| Piece | What it does |
| --- | --- |
| `spl.core` | Serializes Python functions and pipelines to a portable SPL/YAML form. |
| `SPLClient` | The user-facing client: publish, call, manage libraries and runs. |
| `spl-daemon` | A local runtime that stores objects, builds environments, and executes workers. |

## Development

```bash
git clone https://github.com/yastrebovks/splime
cd splime
pip install -e '.[test]'
pytest
```

## Project status

Alpha (`0.1.0`). The API may change between releases. Feedback and issues are welcome at
the [issue tracker](https://github.com/yastrebovks/splime/issues).

## Links

- Website: https://splime.io
- Source: https://github.com/yastrebovks/splime

## License

Licensed under the [Apache License 2.0](LICENSE).
