Skip to main content

case-boss

PyPI version Python versions License

A Python package for string case conversion and manipulation, featuring a flexible CLI and extensible core.

Features

  • Convert dictionary/JSON keys between camelCase, snake_case, kebab-case, PascalCase, and more
  • Easy to use optional cli (command-line interface)

Installation

for core Python library

pip install case-boss

library + CLI (requires typer>=0.17.0)

pip install case-boss[cli]

Usage

⌨️ CLI (Command Line Interface)

basic commands

case-boss -v      # show version
case-boss --help  # show options and usage
case-boss cases   # show available target case types

# minimal transform command example; passing only file path, will convert to snake_case and print to standard output (stdout)

case-boss transform path-to/file.json

options for transform command

# passing path and selected target case type 
case-boss transform path-to/file.json --to pascal
# passing path and name of result file (will save to file instead of stdout)
case-boss transform path-to/file.json -o result.json
case-boss transform path-to/file.json --output result.json
case-boss transform path-to/file.json > result.json
# modifying file inplace instead of creating new one or printing to stdout
case-boss transform path-to/file.json --inplace
case-boss transform path-to/file.json -i
# using standard input (stdin), passing '-' as the source and piping JSON data.
echo '{"youShallNotPass": "ok"}' | case-boss transform - --to pascal
# output: {"YouShallNotPass": "ok"}
# passing --json directly instead of path to file
case-boss transform --json '{"youShallNotPass": "ok"}' --to pascal
# printing transformation time in seconds
case-boss transform path-to/file.json --benchmark
case-boss transform path-to/file.json -b
# preserving acronyms or custom words (e.g., keep 'ID' or 'HTTP' uppercase):
case-boss transform path-to/file.json --preserve ID,HTTP
# limiting recursion depth (e.g., only transform top-level keys)
case-boss transform path-to/file.json --limit 1
# excluding specific keys from transformation (stopping recursion on those keys)
case-boss transform path-to/file.json --exclude someKey,anotherKey
# rich example; passing path, selected target case type, name of result file and benchmark
case-boss transform path-to/file.json --to pascal --output result.json --benchmark --preserve ID,SQL
# help
case-boss transform --help  # show options and usage for the transform command

Note:
You must choose only one input source:

  • use - for stdin,
  • use file path to pass file
  • use --json to pass JSON directly as arg

You can only use one, either --inplace or --output

🐍 Python API

from case_boss import CaseBoss

boss = CaseBoss()
# Basic usage
result = boss.transform(source=my_dict, case="camel")
# assuming my_dict = { "you_shall_not_pass": True }, result will be: { "youShallNotPass": True }
# Clone mode: return a new dict, leaving the original untouched
result = boss.transform(source=my_dict, case="camel", clone=True)
# Preserving acronyms or custom words (e.g., keep 'ID' or 'HTTP' uppercase):
result = boss.transform(source=my_dict, case="camel", preserve_tokens=["ID", "HTTP"])
# assuming my_dict = { "user_ID": 1, "http_status": "ok" }, result will be: { "userID": 1, "HTTPStatus": "ok" }
# Limiting recursion depth (e.g., '1' only transform top-level keys):
result = boss.transform(source=my_dict, case="camel", recursion_limit=1)
# Excluding specific keys from transformation (stopping recursion on those keys):
result = boss.transform(source=my_dict, case="camel", exclude_keys=["metaData", "anotherKey"])
# For JSON strings (also returns JSON):
json_result = boss.transform_from_json(source=my_json_str, case="camel")

About clone

The clone argument (Python API only) determines whether the transformation mutates the original dictionary or returns a new, transformed copy. If clone=True, the original input is left unchanged and a new dict is returned. By default, clone=False and the input dict is modified in place.

About preserve_tokens

The --preserve CLI option and preserve_tokens Python argument allow you to specify a comma-separated list (CLI) or list of strings (Python) of words/acronyms to preserve in their original or uppercase form during case conversion. This is useful for things like ID, HTTP, etc., so they remain as intended (e.g., userID instead of userId).

About recursion_limit

The --limit CLI option and recursion_limit Python argument set the maximum recursion depth for nested JSON key transformation. For example, setting it to 1 will only transform top-level keys. Defaults to 0 (unlimited recursion).

About exclude_keys

The --exclude CLI option (comma-separated list) and exclude_keys Python argument (list of strings) let you specify keys to skip entirely during transformation, halting recursion on those keys and their nested values.

Supported Case Types

The following case types are supported:

Type Example Output Description
snake you_shall_not_pass Snake case
camel youShallNotPass Camel case
pascal YouShallNotPass Pascal case
kebab you-shall-not-pass Kebab case
space you shall not pass Space separated
start You Shall Not Pass Start case (title case)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/your-feature)
  3. Commit your changes
  4. Push to the branch
  5. Open a pull request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for case-boss 0.1.0

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

Source distribution (sdist)

Source distribution for case-boss 0.1.0
File Size Uploaded Provenance
case_boss-0.1.0.tar.gz 14.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for case-boss 0.1.0
File Interpreter ABI Platform
case_boss-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / case_boss-0.1.0.tar.gz

Download URL case_boss-0.1.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5a61f87370987ea9ef603e0ef9d6554c9a54f1b08125aff2c19889f79530aae2
BLAKE2b-256 checksum
How to use checksums
e9bb704a4c4fc8f471cc4172bdf49d0217a1ceb76c358cb041c945a668bfa990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.7

Release files / case_boss-0.1.0-py3-none-any.whl

Download URL case_boss-0.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e7cee4b021a57588345ff56a047dee62da76c8c98a289991d456c928dca419f
BLAKE2b-256 checksum
How to use checksums
783121ce72ae8bccef3365d9361f95a60b9bdaab93765ba199715feb0229ba7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.7

Security for case-boss 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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