Skip to main content

smithtune

Utilities for preparing conversational datasets. Runs locally with no runtime dependencies.

Install

Requires Python 3.10 or newer.

pip install smithtune

Split a dataset

smithtune split data.jsonl --group-by conversation_id --output-dir splits/

Each input line must be a JSON object with a top-level group field containing a nonempty string or integer:

{"conversation_id":"a","messages":[{"role":"user","content":"Hello"}]}
{"conversation_id":"a","messages":[{"role":"assistant","content":"Hi"}]}
{"conversation_id":"b","messages":[{"role":"user","content":"Good morning"}]}

Creates train.jsonl, validation.jsonl, and test.jsonl and prints record counts. Records with the same group ID always go into the same file. Use IDs that are unique across your input sources.

Defaults target 80% training, 10% validation, and 10% test by group. Hash-based assignment gives approximate proportions; small datasets may have empty splits. Adding or reordering records does not change a group's assignment when its ID, seed, and fractions stay the same.

smithtune split data.jsonl --group-by conversation_id --output-dir splits-v2/ \
  --validation-fraction 0.15 --test-fraction 0.15 --seed 42

The splitter preserves record bytes and order within each output file, adding a final newline if needed. It validates the entire input in memory before writing. Blank lines, invalid JSON, duplicate JSON keys, and missing or invalid group IDs are rejected with a line number. String IDs and integer IDs are distinct.

The output directory must not exist, and its parent directory must exist. Existing files are never overwritten. No data is uploaded or fetched.

Python

from smithtune import split_jsonl

counts = split_jsonl("data.jsonl", "splits", group_by="conversation_id")

Development

PYTHONPATH=src python -m unittest discover -s tests -v

Metadata

Release files for smithtune 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smithtune 0.0.1
File Size Uploaded Provenance Actions
smithtune-0.0.1.tar.gz 6.1 kB Without provenance Details for smithtune-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smithtune 0.0.1
File Interpreter ABI Platform Actions
smithtune-0.0.1-py3-none-any.whl Python 3 none any Details for smithtune-0.0.1-py3-none-any.whl

Total release size: 11.2 kB

Release files / smithtune-0.0.1.tar.gz

Download URL smithtune-0.0.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d5f2ecbd908aca95ead6665b57b346730a8b9886d7d00179e8ffa638f6699613
BLAKE2b-256 checksum
How to use checksums
b209e5c7b603625bcdc11bf205b506cddfad63dc4ba45f04805b0c390e66bf55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / smithtune-0.0.1-py3-none-any.whl

Download URL smithtune-0.0.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b2f136800baa081649b0a08bd7cde002d45816cf178038343465b57a62cbf5c
BLAKE2b-256 checksum
How to use checksums
852ab4bb63fbd4a673a448531062e383f84eda4d9e069e505d83d5d829f3dce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for smithtune 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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