Metadata-Version: 2.4
Name: cutypy
Version: 0.1.0
Summary: A lightweight rule-based Python code formatter
Author: AttAditya
License: MIT License
        
        Copyright (c) 2026 AttAditya
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/AttAditya/cutypy
Project-URL: Repository, https://github.com/AttAditya/cutypy
Project-URL: Issues, https://github.com/AttAditya/cutypy/issues
Keywords: python,formatter,code-formatter,lint,formatting
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# [CutyPy](https://pypi.org/project/cutypy/)

> CutyPy currently doesn't obey PEP 8 in many cases. It is a work in progress and may not be ready for production use. Use with caution and report any issues you encounter.

A lightweight Python code formatter.

## Installation

`pip install cutypy`

## About

CutyPy 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

## 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, CutyPy exits with a non-zero status code.

## Formatting Rules

CutyPy applies a set of focused formatting rules:

- Blank line normalization
- Declaration spacing adjustments
- Removal of excessive blank lines
- End-of-file newline enforcement
- Import ordering
- Indentation consistency
- Leading blank line cleanup
- Line ending normalization
- Trailing comma formatting
- Removal of trailing spaces

Each rule operates independently, allowing the formatter to remain simple and predictable.

## Project Structure

```tree
cutypy
├── __init__.py
├── fmt.py
├── format_file.py
└── rules
    └── format
        ├── blank_lines.py
        ├── declaration_spacing.py
        ├── double_blanks.py
        ├── eof_newline.py
        ├── import_sort.py
        ├── indentation.py
        ├── leading_blank_lines.py
        ├── line_endings.py
        ├── trailing_commas.py
        └── trailing_spaces.py
```

- **fmt.py** provides the CLI entrypoint.
- **format_file.py** handles formatting of individual files.
- **rules/format** contains independent formatting rules applied sequentially.

## Design Philosophy

CutyPy 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, CutyPy focuses on enforcing a small set of reliable formatting guarantees.

## Status

Experimental and under active development.

## Links

- [PyPI](https://pypi.org/project/cutypy/)
- [GitHub](https://github.com/AttAditya/cutypy)

> Made by AttAditya
