Skip to main content

A pipe-first language for data and ML work, running on top of Python

Project description

Peppermint

A pipe-first language for data and ML work, running on top of Python. Every operation is a pipeline step and errors propagate automatically. The Python ecosystem (pandas, scikit-learn, or your own code) is accessible from within the language.

Install

pip install peppermint-lang
pip install peppermint-lang[ml]    # + scikit-learn, umap, openai
pip install peppermint-lang[lsp]   # + language server
pip install peppermint-lang[all]   # everything

Or from source:

git clone https://github.com/chayapatr/peppermint
cd peppermint
pip install -e ".[all]"

Run

pep file.pep  # run a file
pep           # interactive REPL
pep lsp       # start language server (stdio)

Examples

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
use ml
use viz
use env

load("data.csv")
  |> add(embedding: ml.embed(it.text,
      source: "deepinfra", model: "Qwen/Qwen3-Embedding-4B",
      apikey: env.DEEPINFRA_TOKEN))
      @concurrent(10)
  |> ml.kmeans(k: 2..8, on: "embedding", out: "cluster")
  |> ml.umap(dims: 2, on: "embedding", out: "umap")
  |> viz.scatter(x: "umap_1", y: "umap_2", color: "cluster", display: { label: "text", legend })
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()
Error handling
result = load("data.csv")
  |> filter(it.score > 0.5)

match(result,
  Ok(data): data |> print(),
  Err(msg):  print(msg)
)
Python bridge
use "./transforms.py" as t

load("data.csv")
  |> t.clean()
  |> print()

Python functions receive and return plain Python types. Conversion is automatic.


Editor support

The LSP server (pep lsp) provides diagnostics, hover docs, completions, and go-to-definition for any LSP-capable editor.

VSCode — install the extension from ecosystem/vscode-peppermint/. It auto-discovers pep via mise, pyenv, or Homebrew — no PATH setup needed.

Neovim:

vim.lsp.start({ name = "peppermint", cmd = { "pep", "lsp" }, root_dir = vim.fn.getcwd() })

Helix (~/.config/helix/languages.toml):

[language-server.peppermint-lsp]
command = "pep"
args = ["lsp"]

See docs/language.md for the language reference, docs/stdlib.md for all stdlib functions, and docs/ecosystem.md for full editor setup.

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.4.0a1.tar.gz (57.8 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.4.0a1-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file peppermint_lang-0.4.0a1.tar.gz.

File metadata

  • Download URL: peppermint_lang-0.4.0a1.tar.gz
  • Upload date:
  • Size: 57.8 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.4.0a1.tar.gz
Algorithm Hash digest
SHA256 00ef09fe58f4928267cbf89348b9aa0e527520554f462b97accc1a94f520b90f
MD5 0d503983a360fb8759e67b0b304d9c5c
BLAKE2b-256 3e23f7715e0c528ae762aad36b504dda0536500669ac50b11890608990351b5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for peppermint_lang-0.4.0a1.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.4.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for peppermint_lang-0.4.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa544b6b8928ed7311566e8575ab3946959a23106d888debdd9e3b68895641f
MD5 531947a7565437e289222f00dfa2e23f
BLAKE2b-256 ae787dab84508e4c8d3cd16b41e7f03e10fe367669437797e499cb5f069d3fc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for peppermint_lang-0.4.0a1-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