Skip to main content

dotpick

CI crates.io clispec compliant

Token-minimal field projection over JSON, YAML, TOML and NDJSON. Select fields by dotpath and emit the smallest valid slice. The anti-jq for agents and scripts: pure projection and format conversion, with no expression language to get wrong.

Why

jq and yq dump whole payloads, speak cryptic error messages, and jq cannot even read YAML or TOML. When you only need three fields out of a 50 KB response, you pay for the other 49 KB. dotpick takes a simple list of dotpaths and returns just those fields, in the format you ask for.

# 50 KB of pod JSON in, one name per line out
kubectl get pods -o json | dotpick '.items[].metadata.name' -o raw

Install

cargo install dotpick

Quickstart

# Smallest sub-document of two fields (structure preserved)
echo '{"metadata":{"name":"web","ns":"prod"},"spec":{"replicas":3}}' \
  | dotpick '.metadata.name,.spec.replicas'
# => {"metadata":{"name":"web"},"spec":{"replicas":3}}

# Just the value, unquoted
dotpick .spec.replicas deploy.yaml -o raw
# => 3

# Flatten to leaf names
dotpick '.metadata.name,.spec.replicas' deploy.yaml --flat
# => {"name":"web","replicas":3}

# Stream array elements as NDJSON
cat pods.json | dotpick '.items[]' -o ndjson
# => {"name":"a"}
#    {"name":"b"}

# Convert formats with the root path
dotpick . config.toml -o yaml

dotpick <paths> [file] is shorthand for dotpick project <paths> [file].

Dotpath grammar

Syntax Meaning
.key object key (bareword [A-Za-z0-9_-]+)
["any.key"] quoted key, for keys with dots, spaces or brackets
[0] array index (non-negative)
[] iterate every element of an array
. the whole document (useful for format conversion)
.a.b[0].c[].d chain segments freely
.a.b,.c[].d comma-separate multiple paths

Output shapes

  • structured (default): the smallest sub-document that keeps the original nesting.
  • --flat: an object keyed by each path's final name.
  • -o raw: bare scalar values, one per line (great for shell capture).
  • -o ndjson: one compact JSON value per selected match; [] controls granularity (.items[] streams elements, .items[].name streams names).

Object keys are emitted in sorted order for stable, diff-friendly output.

Formats

Input format is auto-detected (or taken from the file extension, or forced with --from json|yaml|toml|ndjson). Output is selected with -o/--output (auto, json, yaml, toml, ndjson, raw); auto is JSON, or NDJSON when the input is NDJSON. --to is an alias for --output. Use --pretty for indented JSON.

Missing fields

By default a missing path is an error with a "nearest existing key" hint:

echo '{"spec":{"replic":3}}' | dotpick .spec.replicas
# stderr: {"error":{"kind":"path_not_found","message":"path .spec.replicas not found; nearest existing: replic", ...}}

Pass --allow-missing to skip absent paths instead.

Exit codes

Code Meaning
0 success
1 no match (a selected path is absent, or a wrong-typed segment)
2 parse, serialize, or IO failure
3 usage error (bad arguments, bad dotpath, name collision, raw on non-scalar)

For agents (clispec)

dotpick follows The CLI Spec: data on stdout, structured error envelopes on the last line of stderr, and a schema subcommand whose output validates against clispec.dev/schema/v0.3.json (checked by the test suite). Every command is marked read-only (mutating: false).

dotpick schema   # machine-readable contract: commands, args, error kinds, exit codes

dotpick is a stateless filter, so the list-oriented principles (pagination, resource conflicts) do not apply; its paths argument is itself the field selector.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotpick-0.1.2.tar.gz (40.8 kB view details)

Uploaded Source

Built Distributions

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

dotpick-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (722.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

dotpick-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (669.5 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

dotpick-0.1.2-py3-none-macosx_11_0_arm64.whl (654.5 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

dotpick-0.1.2-py3-none-macosx_10_12_x86_64.whl (704.0 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file dotpick-0.1.2.tar.gz.

File metadata

  • Download URL: dotpick-0.1.2.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dotpick-0.1.2.tar.gz
Algorithm Hash digest
SHA256 11b82ff0ab1798b709ce97bccef18bfadba275805db27a792fe563e5ee9fd8ef
MD5 eaaacee0f5fbaf2498544c77faa8421e
BLAKE2b-256 2d8cb12cf92c05814085e3852c5e72ed50d5075dfbccdd0e65d52eca80b6487b

See more details on using hashes here.

File details

Details for the file dotpick-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: dotpick-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 722.3 kB
  • Tags: Python 3, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dotpick-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c68578c1be010231962e926e2e270920c92d17e07181a1fac98137c7c9a0e5d
MD5 0b1bfd99de60eb66648b5d2632f3ab1f
BLAKE2b-256 d51eeeec0a42dca32a535cbdc82fda731ee23007dcd4c2d450aaffc754ce0bcc

See more details on using hashes here.

File details

Details for the file dotpick-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: dotpick-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 669.5 kB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dotpick-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a9313b3f80515b9be718e857a247a7e8620a3a652af9e2dfd4038e32c0e7ae87
MD5 c798f97257b671abf3acfc73f2e484b4
BLAKE2b-256 00924daa048a6b761f964266911877f0979ff378f613509eeed287c00ac8791b

See more details on using hashes here.

File details

Details for the file dotpick-0.1.2-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: dotpick-0.1.2-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 654.5 kB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dotpick-0.1.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4815ee1241b6fc6406a42538801bbac04b9095026dcb76c0a16128311dc06997
MD5 a4df806fd97d5d453d0d30f287eb1749
BLAKE2b-256 acb89cf256122c50199dd73c99111a4f5831c26f3961480ae2fbfe6775f9b3b3

See more details on using hashes here.

File details

Details for the file dotpick-0.1.2-py3-none-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: dotpick-0.1.2-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 704.0 kB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dotpick-0.1.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 70faad283dd8de634c609b0b04043dbb1605abade0a247f36573d247205ff017
MD5 9281675f8432bcae63b386eaf1b28ff9
BLAKE2b-256 94d63c312bf2917de213f769456553788b1fcac2b56c117eaa2cd2a33ed66d5b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

5 files

0.1.0

5 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page