Skip to content

fimod

πŸπŸ¦€ fimod β€” the data shaper CLI

πŸ—οΈ Mold your data, shape your CI, play with your pipelines πŸͺΆ Python-powered molding without Python installed.

πŸ’‘ DRY your pipelines Β· Slim your container images Β· Tame your configs

fimod (Flexible Input, Mold Output Data) embeds Pydantic Monty (a Rust implementation of Python) in a single binary (~3.3 MB in the UPX-compressed standard build). You write the transform logic; fimod handles parsing, format detection, and I/O.

Python syntax, Monty runtime

Fimod runs molds on Monty, not CPython: use familiar Python syntax and built-ins, with Rust-powered helpers for data shaping.

# 🎯 One-liner
fimod s -i data.json -e '[u for u in data if u["active"]]'

# πŸ“œ Reusable script
fimod s -i input.csv -m cleanup.py -o output.json

# πŸ”€ Format conversion
fimod s -i config.yaml -e 'data' -o config.toml

# πŸ”₯ Fetch from URLs β€” no curl, no wget, no pipes!
fimod s -i https://api.github.com/repos/pytgaen/fimod -e 'data["name"]' --output-format txt

✨ Features

  • Python you already know


    No new DSL. Write for, if, comprehensions, and string methods using Monty's Python subset.

  • Single binary


    No runtime, no pip install, no dependencies. One ~3.3 MB standard binary after UPX compression; use slim when you do not need HTTP input, or fimod-fast for large CPU-heavy runs.

  • All the formats


    JSON Β· NDJSON Β· YAML Β· TOML Β· CSV Β· TXT Β· Lines β€” auto-detected from extension.

  • Batteries included


    Native import re for regex; dp_* dotpath Β· active it_* iteration Β· hs_* hashing Β· msg_* logging Β· gk_* validation Β· env_subst helpers require no imports. Deprecated helpers need legacy activation.

  • πŸš€ Awesome πŸ”₯ Your input can be an HTTPS request!


    Awesome: -i https://... just works β€” fimod fetches (via reqwest with proxy and HTTPS support), parses, and transforms in one shot. Goodbye curl | jq!


πŸ‘€ A taste of what fimod can do

🐍 Python-syntax transforms β€” Rust-powered I/O, serialization & builtins:

# YAML to JSON, filter active users, sort by name
fimod s -i users.yaml -e '[u for u in data if u["active"]]' -e 'it_sort_by(data, "name")' -o result.json
# Filter active users, then group by role β€” Unix pipes just work
fimod s -i users.json -e '[u for u in data if u["active"]]' | fimod s -e 'it_group_by(data, "role")'
# Enrich records with Python string methods β€” try this in jq...
fimod s -i users.json -e '[{**u, "slug": u["name"].lower().replace(" ", "-"), "domain": u["email"].split("@")[1]} for u in data]'

πŸ“¦ Registry molds β€” reusable recipes, one @name away:

# πŸ”€ Patch a YAML config with dot-path assignments
fimod s -i deployment.yaml -m @yaml_merge --arg set="spec.replicas=3,metadata.labels.env=prod" -o deployment.yaml
# πŸ” Anonymize PII fields with SHA-256
fimod s -i users.json -m @anonymize_pii --arg fields=email,phone -o users_anon.json
# πŸ“Š Deduplicate records by a field
fimod s -i data.json -m @dedup_by --arg field=email

πŸ“¦ More molds in the fimod-powered registry:

Mold Description
@gh_latest GitHub release resolver
@download wget-like fetch
@poetry_migrate Poetry β†’ uv/Poetry 2
@skylos_to_gitlab dead code β†’ GitLab Code Quality
fimod registry add fimod-powered https://github.com/pytgaen/fimod-powered
🍿 Even more taste... (in-place, regex, log parsing, env templating)
# πŸ”’ Anonymize emails in-place β€” replace with SHA-256 hashes
fimod s -i customers.csv -e '[{**r, "email": hs_sha256(r["email"])} for r in data]' --in-place
# πŸ•΅οΈ Mask IPs with regex β€” 192.168.1.42 β†’ 192.168.x.x
fimod s -i logs.json -e '
import re
def transform(data, **_):
    return [{**row, "ip": re.sub(r"\d+\.\d+$", "x.x", row["ip"])} for row in data]
'
# πŸ“Š Raw log lines β†’ structured JSON records
fimod s -i server.log -m @log_parse \
  --arg regex='(\S+) \[(.+?)\] "(.+?)" (\d+)' \
  --arg fields=ip,timestamp,request,status
# πŸ”€ Inject environment variables into ${VAR} placeholders
fimod s -i config.json --env 'DB_*' -e '{k: env_subst(v, env) for k, v in data.items()}'

Run fimod mold list to browse all built-in molds.


πŸ—ΊοΈ Guides

Start here if you're new to fimod.

  • Quick Start


    Install fimod and run your first transform in 2 minutes.

    Get started

  • Concepts


    The pipeline, Monty, molds, and the security model β€” how it all fits together.

    Understand fimod

  • Mold Scripting


    Write transforms with native import re, dotpath, iteration, and hash helpers.

    Write molds

  • CLI Reference


    All options and modes β€” slurp, check, no-input, in-place, args, debug, and more.

    Explore the CLI


πŸ“š Reference

Lookup tables and complete specifications.

  • Formats


    JSON, NDJSON, YAML, TOML, CSV, TXT, Lines β€” behavior and options for each.

    Formats

  • Built-ins


    Active helper signatures, legacy activation and migration, pipeline controls, args, and headers.

    Built-ins

  • Mold Defaults


    # fimod: directives β€” embed format and option defaults directly in scripts.

    Mold Defaults

  • Exit Codes


    --check truthiness table and set_exit behavior explained.

    Exit Codes


🍳 Cookbook

Practical recipes β€” filtering, aggregation, regex, format conversion, validation, data generation, slurp, and more.


⚠️ Project Status

Early-stage software

fimod is young software, built with AI-assisted development ("vibe coding").

  • Monty is Pydantic's Rust implementation of a Python subset. Fimod pins Monty 1.0.0; this is not CPython or full standard-library parity.
  • fimod is still pre-1.0. Supported mold APIs may evolve as the project matures.
  • Versioning follows Semantic Versioning. Before 1.0, breaking changes bump the minor version; after 1.0, they bump the major version.
  • Mold scripts can use Python syntax, common built-ins, and selected stdlib modules, but not arbitrary PyPI packages or full stdlib parity.
  • Fimod adds Rust helpers for dot paths, iteration, hashing, templating, logging, and validation. Legacy regex and selected iteration helpers require explicit activation; new regex molds use import re.

Legacy built-ins

New molds use Monty's import re and Python deduplication/flattening code. Existing molds can keep re_*, it_unique, it_unique_by, and it_flatten by setting FIMOD_LEGACY_BUILTINS=1. No warning is emitted when enabled. Without activation, calling one raises an error with migration guidance. See the migration guide for API differences.