Skip to main content

About

A Cuty-Series Custom Python Formatter

Installation

pip install cutypy

Usage

Format a file or directory:

cutypy path/to/file_or_directory

Check if files need formatting (useful for CI or pre-commit):

cutypy --check path/to/project

If formatting changes are required in check mode, formatter exits with a non-zero status code.

About

The tool is a minimal and fast Python formatter designed to enforce consistent formatting rules across Python codebases.

Unlike large formatters that heavily restructure code, CutyPy focuses on deterministic formatting rules applied through a small rule engine. Each rule handles a specific formatting concern such as indentation, spacing, blank lines, or import ordering.

The formatter processes files using modular formatting rules, making the system easier to reason about, extend, and control.

Features

  • Deterministic Python formatting
  • Rule-based formatting system
  • Import sorting
  • Consistent indentation enforcement
  • Blank line normalization
  • Trailing space cleanup
  • Line ending normalization
  • Automatic EOF newline insertion
  • Optional check mode for CI pipelines

Project Structure

cutypy
├── __init__.py
├── __main__.py
├── checker
│   ├── __init__.py
│   └── check_line_length.py
├── cli
│   ├── __init__.py
│   ├── args_handler.py
│   └── version.py
├── common
│   ├── __init__.py
│   ├── compact.py
│   ├── expand.py
│   └── reset.py
├── core
│   ├── __init__.py
│   └── main.py
├── engine
│   ├── __init__.py
│   ├── discovery.py
│   ├── pipelines
│   │   ├── __init__.py
│   │   ├── check.py
│   │   └── solve.py
│   └── worker.py
├── models
│   ├── __init__.py
│   ├── args.py
│   └── content.py
└── solver
    ├── __init__.py
    ├── add_eof_double_blanks.py
    ├── add_keyword_blanks.py
    ├── fix_double_blanks.py
    ├── fix_import_order.py
    ├── fix_indentation.py
    ├── fix_line_ends.py
    └── remove_blanks.py

Design Philosophy

The formatter is built around a few core ideas:

  • Minimal implementation
  • Explicit formatting rules
  • Predictable output
  • Easy extensibility
  • Suitable for automation (CI / pre-commit)

Rather than trying to cover every stylistic decision, the formatter focuses on enforcing a small set of reliable formatting guarantees.

Links

Made with <3 by AttAditya

Download files

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

Source Distribution

cutypy-0.3.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

cutypy-0.3.3-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file cutypy-0.3.3.tar.gz.

File metadata

  • Download URL: cutypy-0.3.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for cutypy-0.3.3.tar.gz
Algorithm Hash digest
SHA256 1e3c704cfa1b182902255f5ff653c25f37e854671451421b77827a16d2f8d9f6
MD5 c3b9d96243f84026156f9c81d2c38a14
BLAKE2b-256 60b87f5282bab98037cfb1f52a35e5c0f84af159a0f09a56d25a0ead64ef4140

See more details on using hashes here.

File details

Details for the file cutypy-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: cutypy-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for cutypy-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e018c1646392717101a80c3879bd51da34d5efb82dfad353b6cfc23830155818
MD5 a3d8d1a52c3c1557c56a633cecb1ceab
BLAKE2b-256 b3d2d8ae94dd8b36dd2cf9b67d0f4ea43dda21488a200740b3793d16e2f487cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page