Newxt
⚠️ DISCLAIMER: This is a hobby/personal project. Not a commercial product. Not for production use.
Edit files in one pass with instructions via stdin
The replace command performs a simple string replacement on a file based on YAML instructions provided via stdin.
Quick installation (MacOS)
brew install pipx
pipx install newxt
Usage
newxt replace <file> < instructions.yaml
Or using a pipe:
echo "search: old\nreplace: new" | newxt replace myfile.txt
Arguments
file- Path to the file to perform replacement on (required)
Input Format
The command accepts YAML instructions via stdin with two required fields:
search- The text to search for in the filereplace- The text to replace it with
Simple Example
search: old_method
replace: new_method
Multiline Example
For multiline strings, use YAML's literal block scalar syntax:
search: |
def old_method():
print("old")
replace: |
def new_method():
print("new")
Behavior
- Only the first occurrence of the search string is replaced
- The file is not modified on disk - the result is returned to stdout
- The search is performed as an exact string match (not a regex)
- Both
searchandreplacevalues must be non-empty
Error Conditions
The command will raise an error if:
- The specified file does not exist
- The path points to a directory instead of a file
- No stdin is provided
- The stdin is not valid YAML
- The
searchfield is missing or blank - The
replacefield is missing or blank
Examples
Replace a function name
cat > instructions.yaml << EOF
search: calculate_total
replace: compute_sum
EOF
newxt replace mycode.py < instructions.yaml
Replace a multiline block
cat > instructions.yaml << EOF
search: |
if debug:
print("Debug mode")
replace: |
if self.debug:
self.logger.debug("Debug mode")
EOF
newxt replace app.py < instructions.yaml > app_updated.py
Using with pipes
echo "search: TODO\nreplace: DONE" | newxt replace notes.txt
Notes
- The command returns the modified content to stdout
- To save the result, redirect the output to a new file
- The original file remains unchanged
- Whitespace and indentation in the search string must match exactly
Metadata
Release files for newxt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| newxt-1.0.0.tar.gz | 3.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| newxt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / newxt-1.0.0.tar.gz
| Download URL | newxt-1.0.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48966491844b979da9aa0ccca02ad153e665f4910e601673021e8e8733fe6932
|
|
BLAKE2b-256 checksum How to use checksums |
cf350ef5d5dc6df509aa117898ba5c6403caa869b3cb2b0986b43ae5f8e59deb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logRelease files / newxt-1.0.0-py3-none-any.whl
| Download URL | newxt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e173615429c29cb55921e05e8dcdef05227a3317def225596ee8e8a40982d48
|
|
BLAKE2b-256 checksum How to use checksums |
895e0f61e046f4db245903fe0ce4fe6f1ff0e7f8638da77ed74be96b74ba2b76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logSecurity for newxt 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for newxt-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.