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.3.tar.gz (46.5 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.3-py3-none-any.whl (41.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peppermint_lang-0.3.3.tar.gz
  • Upload date:
  • Size: 46.5 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.3.tar.gz
Algorithm Hash digest
SHA256 d1f7883b4b749d846c39738a3a5f7c6c0325875127a6a8aa0065d6a757998c2a
MD5 4ba3f9d2d3f43351d0e37919c6819103
BLAKE2b-256 47de174ac1a118d59955b793804f193daa38ceaac0be2bde9ffc09b05bc5352f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: peppermint_lang-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 41.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b93d5123d6c237b124062da741a44981471657dadfefddceb7b4aad914ed236
MD5 767385ed5ea8d7f4d1e95f183ce58b77
BLAKE2b-256 3b434a493c9a7b8f67658e718cfb67a4a0d2acf043c5325dacc07810229ab9b3

See more details on using hashes here.

Provenance

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