Skip to main content

A pipe-first DSL for data and ML work

Project description

Peppermint

A pipe-first language for data and ML work. Every operation is a pipeline step. Errors propagate automatically. The transform is the notation.

Install

pip install peppermint-lang

Run

pep file.pep  # run a file
pep           # interactive REPL

Examples

Transform

load("employees.csv")
  |> filter(it.age > 18)
  |> add(tax: it.salary * 0.2)
  |> sort(by: "salary", dir: "desc")
  |> print()

Each step prints a live summary:

|> filter    → List  843 rows × 5 cols  (157 dropped)
|> add       → List  843 rows × 6 cols  (+tax)
|> sort      → List  843 rows × 6 cols

Aggregate

load("sales.csv")
  |> collapse(by: "region",
      avg: mean(col.revenue),
      n:   count()
  )
  |> sort(by: "avg", dir: "desc")
  |> print()

Top N per group

load("sales.csv")
  |> each(by: "region",
      |> add(rank: rank(col.revenue, dir: "desc"))
      |> filter(it.rank <= 3)
      |> drop("rank")
  )
  |> print()

ML pipeline

use ml
use viz
use env

load("data.csv")
  |> ml.embed(
      on: "text", out: "embedding",
      source: "deepinfra", model: "Qwen/Qwen3-Embedding-4B",
      apikey: env.get("DEEPINFRA_TOKEN"))
  |> ml.kmeans(k: 2..8, on: "embedding", out: "cluster")
  |> ml.umap(dims: 2, on: "embedding", out: "umap")
  |> viz.scatter(x: "umap1", y: "umap2", color: "cluster", label: "text", display: ["labels", "legend"])

Error handling

result = load("data.csv")
  |> filter(it.score > 0.5)

match(result,
  Ok(data): data |> print(),
  Err(msg):  print(msg)
)

See docs/language.md for the full reference and examples/ for more.

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

peppermint_lang-0.3.1.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peppermint_lang-0.3.1-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file peppermint_lang-0.3.1.tar.gz.

File metadata

  • Download URL: peppermint_lang-0.3.1.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for peppermint_lang-0.3.1.tar.gz
Algorithm Hash digest
SHA256 939efcb0cc9b598e0df1cd1d3c017ed0f8f3bc7ba3ddbd7e08489a686ae07efe
MD5 a13c791fecde515eda85454109c6f212
BLAKE2b-256 d14adbda11d652e9f5b0a95c2bc223f51e43554ef3bf59fcc260cf1cd02f7cfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for peppermint_lang-0.3.1.tar.gz:

Publisher: workflow.yml on chayapatr/peppermint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file peppermint_lang-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: peppermint_lang-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for peppermint_lang-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 634e9945c59abbaed88e0251efcf179d5d677bb58a2a83bb9c05f28b123da5e6
MD5 df3227f734d79b58740a4fd4146c51a7
BLAKE2b-256 01e614c758608bcb2401d517feb7ea4f26688fc51ef8eb9017807bc085a2e80c

See more details on using hashes here.

Provenance

The following attestation bundles were made for peppermint_lang-0.3.1-py3-none-any.whl:

Publisher: workflow.yml on chayapatr/peppermint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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