{"categories":[{"label":"Filters","url":"https://skillfed.io/packages/category/text-processing-filters"},{"label":"Filesystems","url":"https://skillfed.io/packages/category/system-filesystems"}],"enrichment":{"capability":"Provides an InPlace class for reading and writing files in-place, handling temporary file management and optional backups automatically.","skillfed_tags":["file-io","in-place-editing","tempfile-wrapper"],"use_cases":["Transform text files (e.g., remove vowels, convert case, apply regex substitutions) while preserving the original path.","Process log files or configuration files with automatic backup creation for safety and auditability.","Implement sed-like filtering in Python without manual temporary file and rename logic.","Build command-line tools that modify files in-place with optional rollback on error.","Edit binary files (e.g., patch headers, strip metadata) with atomic replacement and optional backup."],"what_it_does":"in_place is a single-class module that wraps the common pattern of reading a file, transforming its contents, and writing back to the same path. Instead of manually juggling temporary files, backups, and atomic renames, you pass a filename to InPlace and get a context manager that yields a read-write filehandle; data you write replaces the original file, and the module handles all the temporary file cleanup and safe replacement. It supports both text and binary modes, custom encodings, and optional backup creation (either by appending an extension or saving to a separate path).\n\nCompared to Python's fileinput module, in_place returns a proper filehandle rather than hijacking sys.stdout, supports all standard I/O methods, allows full control over encoding and newline handling, and rolls back the original file if an exception occurs during processing. It's useful for command-line tools, log processors, configuration file editors, and any script that needs to safely modify files in place without risking data loss.","worth_installing":"Yes. Zero dependencies, permissive license, actively maintained, no known vulnerabilities, and solves a common file-handling problem cleanly. Use it whenever you need to safely read and write the same file without manual temporary file management."},"id":"in-place","links":{"html":"https://skillfed.io/packages/in-place","md":"https://skillfed.io/packages/in-place.md","pypi":"https://pypi.org/project/in-place/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2024-12-01","license_spdx":null,"license_treatment":"permissive","name":"in-place","python_support":"supports_current","summary":"In-place file processing"},"popularity":{"monthly_downloads":80443,"position":14292,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"1.0.1"}
