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.get("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.3.4.tar.gz (47.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.4-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peppermint_lang-0.3.4.tar.gz
  • Upload date:
  • Size: 47.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.4.tar.gz
Algorithm Hash digest
SHA256 3aca0ede81670dad8f16a49e986f3b8aca507bcd81add701642d10d544fb097d
MD5 13b962a67e208515d2c07ce7b5c61fb4
BLAKE2b-256 5fd1b0e66cb9a27f1296dcc042de03df50a2f2583a35c9e4b9957f1bdd437ec2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: peppermint_lang-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 42.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 da801da81fa9022a5891864c5c5ea186a182281c988f3c9e3b30be2516926e14
MD5 793e6e2cfcebae722e5e787dd5d2492d
BLAKE2b-256 1fbd802badf92833fb48a177ff336a317e2b6864c94f7b390dffd1a9f55761fa

See more details on using hashes here.

Provenance

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