Skip to main content

text-case

Senior-grade Python CLI for converting text between identifier cases.

text-case converts a string between ten identifier cases — snake_case, camelCase, PascalCase, kebab-case, SCREAMING_SNAKE_CASE, Title Case, dot.case, flatcase, Train-Case, COBOL-CASE — accepting input as a CLI argument or via stdin. It detects word boundaries from any input format (camelCase, PascalCase, snake_case, kebab-case, SCREAMING_SNAKE_CASE, space-separated, or any mix).

Install

pip install text-case

Local development:

git clone https://github.com/brunoraniere2003/project-factory.git
cd project-factory/projects/text-case
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Usage

$ textcase to-snake "Hello World"
hello_world

$ textcase to-camel "hello world"
helloWorld

$ textcase to-pascal "hello world"
HelloWorld

$ textcase to-kebab "Hello World"
hello-world

$ textcase to-screaming "hello world"
HELLO_WORLD

$ textcase to-title "hello_world"
Hello World

$ textcase to-flat "Hello World"
helloworld

$ textcase to-train "hello_world"
Hello-World

$ textcase to-cobol "hello_world"
HELLO-WORLD

Stdin support

# implicit (omit the argument entirely)
$ echo "helloWorld" | textcase to-snake
hello_world

# explicit sentinel (POSIX convention)
$ echo "helloWorld" | textcase to-snake -
hello_world

Cross-format conversion

text-case detects word boundaries from any input format:

$ textcase to-snake "helloWorld"
hello_world

$ textcase to-camel "HELLO_WORLD"
helloWorld

$ textcase to-pascal "hello-world_test case"
HelloWorldTestCase

Edge cases

  • Idempotent: converting input that is already in the target format is a no-op.
  • Unicode preserved: Latin-1 characters (e.g., Olá, Á) round-trip correctly.
  • Empty input: rejected with a non-zero exit code.
  • - sentinel: passing - as the TEXT argument reads from piped stdin (POSIX convention); exits non-zero on an interactive TTY or empty pipe.

Development

# Run tests + coverage (must be 100%)
pytest

# Lint + format-check + type-check
ruff check .
black --check .
mypy --strict src

# All-in-one
pre-commit run --all-files

Architecture

See docs/adr/0001-typer-and-pytest.md for design rationale.

Three-layer module:

text_case/
├── __init__.py        # Public API (re-exports `convert`)
├── converter.py       # Pure functions: case conversions
└── cli.py             # Typer-based CLI (thin wrapper)

Methodology

Built by the Project Factory AI team following a 15-step methodology cycle on every change. See CLAUDE.md at the factory root.

  • 🗂️ Voyager (PM) — spec
  • 🧠 Apollo (TL) — design + review
  • 🌿💻♻️📚 Falcon (ENG) — branch, implement, refactor, document
  • 🧪 Hubble (QA) — failing tests first (RED)
  • 🚀 Atlas (DevOps) — ship

License

MIT

Metadata

Release files for racdev-textcase 0.9.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 racdev-textcase 0.9.1
File Size Uploaded Provenance Actions
racdev_textcase-0.9.1.tar.gz 14.4 kB Without provenance Details for racdev_textcase-0.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for racdev-textcase 0.9.1
File Interpreter ABI Platform Actions
racdev_textcase-0.9.1-py3-none-any.whl Python 3 none any Details for racdev_textcase-0.9.1-py3-none-any.whl

Total release size: 20.5 kB

Release files / racdev_textcase-0.9.1.tar.gz

Download URL racdev_textcase-0.9.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b983cea6df360979589924104eff714234205c3fb8c7f27166bf0350957ad8be
BLAKE2b-256 checksum
How to use checksums
4ffbe09ea5d008fe7129f0f7ff6d7412a9b12da579e063ec8478507018d7955d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / racdev_textcase-0.9.1-py3-none-any.whl

Download URL racdev_textcase-0.9.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2fe9354839f82e1f24cab838f80010ebe7ddccbce5f70492306c5f94d13d223
BLAKE2b-256 checksum
How to use checksums
fb121c321a5c1282c3fe25ae737db4d34a601ae4585fada8a170a962fca9fa65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for racdev-textcase 0.9.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