splurge-safe-io


Namesplurge-safe-io JSON
Version 2025.1.0 PyPI version JSON
download
home_pageNone
SummaryA safe, atomic, and cross-platform way to handle text file I/O in Python.
upload_time2025-10-15 03:45:22
maintainerNone
docs_urlNone
authorJim Schilling
requires_python>=3.10
licenseNone
keywords io file file-processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # splurge-safe-io

[![PyPI version](https://badge.fury.io/py/splurge-safe-io.svg)](https://pypi.org/project/splurge-safe-io/)
[![Python versions](https://img.shields.io/pypi/pyversions/splurge-safe-io.svg)](https://pypi.org/project/splurge-safe-io/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

[![CI](https://github.com/jim-schilling/splurge-safe-io/actions/workflows/ci-quick-test.yml/badge.svg)](https://github.com/jim-schilling/splurge-safe-io/actions/workflows/ci-quick-test.yml)
[![Coverage](https://img.shields.io/badge/coverage-93%25-brightgreen.svg)](https://github.com/jim-schilling/splurge-safe-io)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![mypy](https://img.shields.io/badge/mypy-checked-black)](https://mypy-lang.org/)


A small, secure, and deterministic text file I/O helper library.

Key features

- Deterministic newline normalization (LF) for text reads/writes.
- Secure path validation utilities to avoid traversal and dangerous characters.
- Streaming reader with incremental decoding and a safe fallback for tricky encodings.
- Clear, small exception hierarchy for stable error handling.

Quick start

```py
from splurge_safe_io.safe_text_file_reader import SafeTextFileReader
from splurge_safe_io.safe_text_file_writer import open_safe_text_writer

# Read lines
reader = SafeTextFileReader('data.csv')
rows = reader.readlines()

# Write via context manager
with open_safe_text_writer('out.txt') as buf:
    buf.write('\n'.join(['one','two','three']))
```


> **⚠️ BREAKING CHANGE for v2025.1.0:** `SafeTextFileReader.read()` now returns a `str` containing the entire normalized file content instead of a `list[str]` of lines. Use `SafeTextFileReader.readlines()` to get a list of lines.


See `docs/README-DETAILS.md` for a complete guide and usage examples.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "splurge-safe-io",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "io, file, file-processing",
    "author": "Jim Schilling",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/14/16/9bce3302546613c1a6a8d3a95236d8766aa76173488b8adb64f6a57f1c31/splurge_safe_io-2025.1.0.tar.gz",
    "platform": null,
    "description": "# splurge-safe-io\r\n\r\n[![PyPI version](https://badge.fury.io/py/splurge-safe-io.svg)](https://pypi.org/project/splurge-safe-io/)\r\n[![Python versions](https://img.shields.io/pypi/pyversions/splurge-safe-io.svg)](https://pypi.org/project/splurge-safe-io/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\r\n\r\n[![CI](https://github.com/jim-schilling/splurge-safe-io/actions/workflows/ci-quick-test.yml/badge.svg)](https://github.com/jim-schilling/splurge-safe-io/actions/workflows/ci-quick-test.yml)\r\n[![Coverage](https://img.shields.io/badge/coverage-93%25-brightgreen.svg)](https://github.com/jim-schilling/splurge-safe-io)\r\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\r\n[![mypy](https://img.shields.io/badge/mypy-checked-black)](https://mypy-lang.org/)\r\n\r\n\r\nA small, secure, and deterministic text file I/O helper library.\r\n\r\nKey features\r\n\r\n- Deterministic newline normalization (LF) for text reads/writes.\r\n- Secure path validation utilities to avoid traversal and dangerous characters.\r\n- Streaming reader with incremental decoding and a safe fallback for tricky encodings.\r\n- Clear, small exception hierarchy for stable error handling.\r\n\r\nQuick start\r\n\r\n```py\r\nfrom splurge_safe_io.safe_text_file_reader import SafeTextFileReader\r\nfrom splurge_safe_io.safe_text_file_writer import open_safe_text_writer\r\n\r\n# Read lines\r\nreader = SafeTextFileReader('data.csv')\r\nrows = reader.readlines()\r\n\r\n# Write via context manager\r\nwith open_safe_text_writer('out.txt') as buf:\r\n    buf.write('\\n'.join(['one','two','three']))\r\n```\r\n\r\n\r\n> **\u26a0\ufe0f BREAKING CHANGE for v2025.1.0:** `SafeTextFileReader.read()` now returns a `str` containing the entire normalized file content instead of a `list[str]` of lines. Use `SafeTextFileReader.readlines()` to get a list of lines.\r\n\r\n\r\nSee `docs/README-DETAILS.md` for a complete guide and usage examples.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A safe, atomic, and cross-platform way to handle text file I/O in Python.",
    "version": "2025.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/jim-schilling/splurge-safe-io/issues",
        "Documentation": "https://github.com/jim-schilling/splurge-safe-io#readme",
        "Homepage": "https://github.com/jim-schilling/splurge-safe-io",
        "Repository": "https://github.com/jim-schilling/splurge-safe-io"
    },
    "split_keywords": [
        "io",
        " file",
        " file-processing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f1199335c47cfb1e46cd4fb1e738109b300591a9a14f2d18b134be885c0af487",
                "md5": "433876fc9fd24a7e8a8cd2cc47c1c715",
                "sha256": "b7bf6af5433cd062efd5d8c825adb2afafc3f8a9442e8624da91cbe528062aad"
            },
            "downloads": -1,
            "filename": "splurge_safe_io-2025.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "433876fc9fd24a7e8a8cd2cc47c1c715",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 21352,
            "upload_time": "2025-10-15T03:45:21",
            "upload_time_iso_8601": "2025-10-15T03:45:21.694908Z",
            "url": "https://files.pythonhosted.org/packages/f1/19/9335c47cfb1e46cd4fb1e738109b300591a9a14f2d18b134be885c0af487/splurge_safe_io-2025.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "14169bce3302546613c1a6a8d3a95236d8766aa76173488b8adb64f6a57f1c31",
                "md5": "2434f1988d869d283237df7da5c87e11",
                "sha256": "762e572024f514491b05594b7afea460638b111656a43e26cda699078af82016"
            },
            "downloads": -1,
            "filename": "splurge_safe_io-2025.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2434f1988d869d283237df7da5c87e11",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 19779,
            "upload_time": "2025-10-15T03:45:22",
            "upload_time_iso_8601": "2025-10-15T03:45:22.745695Z",
            "url": "https://files.pythonhosted.org/packages/14/16/9bce3302546613c1a6a8d3a95236d8766aa76173488b8adb64f6a57f1c31/splurge_safe_io-2025.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-15 03:45:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jim-schilling",
    "github_project": "splurge-safe-io",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "splurge-safe-io"
}
        
Elapsed time: 1.76208s