Repository navigation
Self Update
sr update --check is there a newer release? sr update install it sr update --version 7.1.0 install a specific version sr update --channel prerelease sr update --source npm ask the npm registry instead of GitHub sr update --repo owner/name --path /usr/local/bin/sr
sr doctor prints the installation type. It decides how an update is applied:
standalone a single executable file (zipapp or installed script). sr can
update itself: download → verify → smoke test → replace.
pip / pipx the environment owns the files, so sr prints the exact upgrade
command instead of touching site-packages.
npm prints npm install -g sr-search-replace@latest.
source a git checkout — updating is refused, use git pull && make.
- ask the GitHub releases API for the newest release on the channel (SR_GITHUB_TOKEN/GITHUB_TOKEN raises the rate limit)
- compare versions with semver rules; stop if not newer (unless --version)
- download the
sr.pyzasset to a temporary directory - verify its SHA-256 against the published
sr.pyz.sha256— a mismatch aborts the update and installs nothing - smoke test: run
python3 <downloaded> --versionin a subprocess - copy the current file to
<file>.bak - atomically replace the file (write sibling + rename) and keep its mode
Every step either succeeds or leaves the current installation untouched.
At most once per 24h, sr looks for a newer release on a daemon thread with a 2.5s budget and caches the answer under $XDG_CACHE_HOME/sr/update-check.json. It never blocks a run: if the network is slow or absent, nothing is printed and the cache is used next time. Turn it off with --no-update-check or SR_NO_UPDATE_CHECK=1 (a good idea in CI and on air-gapped machines).
Install a specific version and disable the check to pin:
sr update --version 7.0.0
export SR_NO_UPDATE_CHECK=1
Download the two release assets on a connected machine, copy them over, then:
sha256sum -c sr.pyz.sha256
install -m 0755 sr.pyz /usr/local/bin/sr
Страница сгенерирована из встроенной справки sr 7.0.1 (sr help <topic>).
Первоисточник — sr/help_system.py; он же питает man sr и sr help --all.
Если страница и вывод sr help расходятся, верить нужно sr help: он всегда
соответствует установленной версии.