Skip to main content

code-normalizer-pro

PyPI Python License

code-normalizer-pro is a Python CLI for code normalization, whitespace cleanup, line ending normalization, and encoding normalization across entire repositories.

It helps clean source trees by converting supported text files to UTF-8, normalizing CRLF/LF line endings, removing trailing whitespace, and enforcing a final newline. It is designed for codebase cleanup, CI preparation, refactoring prep, and repository hygiene.

Install

pip install code-normalizer-pro

Quick Start

Preview changes:

code-normalizer-pro . --dry-run -e .py

Apply changes in place:

code-normalizer-pro . --in-place -e .py

Run syntax checks after normalization:

code-normalizer-pro . --dry-run -e .py --check

What This Tool Is For

Use code-normalizer-pro when you need:

  • code normalization across a repository
  • encoding normalization to UTF-8
  • line ending normalization to LF
  • whitespace cleanup before commits
  • consistent source files before CI or refactoring
  • reduced diff noise in Git history

Features

  • UTF-8 normalization for supported text encodings
  • line ending normalization
  • trailing whitespace removal
  • final newline enforcement
  • dry-run mode
  • in-place normalization
  • extension filtering
  • parallel processing
  • incremental caching
  • interactive approval mode
  • optional syntax checking
  • git pre-commit hook installation

Common Workflows

Normalize a full project:

code-normalizer-pro . --in-place

Normalize only Python and JavaScript files:

code-normalizer-pro . -e .py -e .js --in-place

Use parallel processing on a larger codebase:

code-normalizer-pro . --parallel --in-place

Install the pre-commit hook:

code-normalizer-pro --install-hook

Before and After

Before:

def add(a, b):    
    return a + b    

After:

def add(a, b):
    return a + b

CLI Options

Option Description
--dry-run preview changes without writing files
--in-place modify files directly
--check run syntax validation
--parallel enable multi-core processing
--workers set worker count
--interactive approve changes per file
--no-cache disable incremental cache
--no-backup disable backups
--install-hook install a git pre-commit hook
-e, --ext process only specific extensions
-v, --verbose show detailed output

Safety

  • deterministic, non-semantic cleanup only
  • binary files are skipped
  • dry-run mode allows safe preview
  • backups are enabled by default for in-place edits
  • syntax checks can validate normalized output

Supported Encodings

  • utf-8
  • utf-8-sig
  • utf-16
  • utf-16-le
  • utf-16-be
  • windows-1252
  • latin-1
  • iso-8859-1

Supported Syntax Checks

  • Python
  • JavaScript
  • TypeScript
  • Go
  • Rust
  • C
  • C++
  • Java

Use Cases

  • cleaning legacy repositories
  • standardizing source files before CI
  • preparing code for linting or formatting
  • reducing whitespace-only diffs
  • improving repository hygiene for teams
  • normalizing files before AI-assisted code workflows

License

MIT License

Metadata

Release files for code-normalizer-pro 3.0.4

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

Source distribution (sdist)

Source distribution for code-normalizer-pro 3.0.4
File Size Uploaded
code_normalizer_pro-3.0.4.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for code-normalizer-pro 3.0.4
File Interpreter ABI Platform
code_normalizer_pro-3.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 29.6 kB

Release files / code_normalizer_pro-3.0.4.tar.gz

Download URL code_normalizer_pro-3.0.4.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a5990c06b4d847fa402bd12f03b45b849bde3f7c0098b9ec56c74799a6653f4e
BLAKE2b-256 checksum
How to use checksums
a98e7a6940268d60a604fde871eb8c383cbbdea6ca9fb265697cd48d431ea363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / code_normalizer_pro-3.0.4-py3-none-any.whl

Download URL code_normalizer_pro-3.0.4-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a6c73ee77f7aba4c12d09bedd897aff887005b3b0719d5120c4ae69189f55bc
BLAKE2b-256 checksum
How to use checksums
61c53ce26dadb5c8184154411e3ebe0848fd0b8b7ef7aa58eb0ae319e9256554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

3.0.4 This release

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

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