Skip to main content

High-performance line ending normalization for Python.

Project description

eolify

High-performance line ending normalization for Python, powered by Rust.

eolify provides fast and memory-efficient conversion between LF (\n) and CRLF (\r\n) line endings for text, files, and streams.

Features

  • Fast Rust implementation
  • Supports LF and CRLF normalization
  • Memory-efficient file processing
  • Cross-platform
  • Typed API with Python type hints

Installation

pip install eolify

Pre-built wheels are available for common platforms, so a Rust toolchain is usually not required.

Quick Start

Normalize text

import eolify

text = "hello\r\nworld\r\n"

normalized = eolify.normalize_text(
    text,
    eolify.Mode.LF,
)

print(repr(normalized))
# 'hello\nworld\n'

Normalize a file

import eolify

eolify.normalize_file(
    "input.txt",
    "output.txt",
    eolify.Mode.LF,
)

By default, the destination file must not already exist.

eolify.normalize_file(
    "input.txt",
    "output.txt",
    eolify.Mode.LF,
    overwrite=True,
)

Normalize a stream

import eolify

with open("input.txt", "rb") as source:
    with open("output.txt", "wb") as destination:
        eolify.normalize_stream(
            source,
            destination,
            eolify.Mode.LF,
        )

API

normalize_text(text, mode) -> str

Normalize line endings in a string.

Parameters:

  • text: Input text.
  • mode: Mode.LF or Mode.CRLF.

Returns:

  • The normalized string.

normalize_file(input, output, mode, overwrite=False) -> None

Normalize line endings while copying one file to another.

Parameters:

  • input: Source file path.
  • output: Destination file path.
  • mode: Mode.LF or Mode.CRLF.
  • overwrite: Whether an existing destination file may be replaced.

normalize_stream(input, output, mode) -> None

Normalize line endings while copying from one binary stream to another.

Parameters:

  • input: Binary file-like object opened for reading.
  • output: Binary file-like object opened for writing.
  • mode: Mode.LF or Mode.CRLF.

Modes

eolify.Mode.LF
eolify.Mode.CRLF

Why eolify?

Python's built-in newline handling is often sufficient, but there are situations where explicit normalization is desirable:

  • Converting files between platforms
  • Preparing source archives
  • Processing generated files
  • Build and CI pipelines
  • Working with mixed line endings

eolify uses the same Rust implementation as the eolify crate, providing predictable and efficient normalization behavior.

Project details


Download files

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

Source Distribution

eolify-0.1.5.tar.gz (8.9 kB view details)

Uploaded Source

Built Distributions

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

eolify-0.1.5-cp39-abi3-win_amd64.whl (126.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

eolify-0.1.5-cp39-abi3-manylinux_2_34_x86_64.whl (247.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

eolify-0.1.5-cp39-abi3-macosx_11_0_arm64.whl (219.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file eolify-0.1.5.tar.gz.

File metadata

  • Download URL: eolify-0.1.5.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eolify-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8c795ff181944eb39a3a95716a507ffd5f479818c5c2954859ec5665d47d1234
MD5 235a89682f8a7c2a2d15917fd4eb52eb
BLAKE2b-256 f7560da73fe5f5c7a6d9ed47641bcc12e462b92b5e5d090e5abe0a1404ff8d91

See more details on using hashes here.

Provenance

The following attestation bundles were made for eolify-0.1.5.tar.gz:

Publisher: publish.yml on cygnus9/eolify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eolify-0.1.5-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: eolify-0.1.5-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 126.1 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eolify-0.1.5-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f264284b350c05ff0eaea1962147b804d1f7853029aee3fdc62ed216a53d528a
MD5 10328cb4c476f47c44a40cee1c8f0367
BLAKE2b-256 a34536feb161e1eb914dfe573720df9698f621436ebdc3bba9bdf0b195c32cd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for eolify-0.1.5-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on cygnus9/eolify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eolify-0.1.5-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for eolify-0.1.5-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e2f94eabb0d9736cb84c4cae9331adf5ffd53f1a07c2858d38ccfeba9d825a4d
MD5 3ce3fd94a81f68bf5b9f6bd9305820a1
BLAKE2b-256 56d819ed3ba717d2a362df3c46e8bb21b47147c147bb65d929813beaa74d0358

See more details on using hashes here.

Provenance

The following attestation bundles were made for eolify-0.1.5-cp39-abi3-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on cygnus9/eolify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eolify-0.1.5-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: eolify-0.1.5-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 219.6 kB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eolify-0.1.5-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04ca26096b1df44666e906c7ea1b18359def7506067034f7b462caf15a85a6f8
MD5 b886abc4f2b70cfb2afd4b9fed14daf8
BLAKE2b-256 bc34ee3ce0be39b4b78437577784c0daa9396ef6cd2917dd918b85b4b1cd2425

See more details on using hashes here.

Provenance

The following attestation bundles were made for eolify-0.1.5-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on cygnus9/eolify-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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