How to Update user-scanner to the Latest Version: Auto-Update and Manual Methods
user-scanner ships with a built-in auto-update mechanism that checks PyPI for newer releases, prompts for confirmation, and reinstalls via pip, or you can manually update using standard pip commands.
Keeping user-scanner current ensures you have the latest security checks and network scanning capabilities. Whether you prefer automated updates or manual control, the kaifcodec/user-scanner repository provides flexible options to maintain the latest version. This guide covers both the automatic update workflow implemented in the source code and manual pip-based alternatives.
How the Built-In Auto-Update Works
The auto-update system follows a five-stage pipeline that runs when the CLI starts. According to the source code, the entry point in user_scanner/__main__.py invokes check_for_updates() from user_scanner/utils/updater_logic.py, triggering the following sequence:
Configuration Check via check_for_updates()
The update process begins by loading global settings. The check_for_updates() function calls load_config() from user_scanner/core/helpers.py to verify the auto_update_status flag. If this boolean value is False, the update check exits immediately, respecting user preferences to skip automatic checks.
Version Retrieval from PyPI
When auto-updates are enabled, the system compares local and remote versions using functions defined in user_scanner/core/version.py:
load_local_version()reads the currently installed version from the package metadataget_pypi_version()fetches the latest release fromhttps://pypi.org/pypi/user-scanner/json
If the PyPI version differs from the local installation, the user receives an interactive prompt with three options: update now (y), skip this version (n), or disable future prompts (d).
The Self-Update Execution
Selecting the update option triggers update_self() from user_scanner/utils/update.py. This function executes two pip subprocesses sequentially:
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "user-scanner", "-y"])
subprocess.check_call([sys.executable, "-m", "pip", "install", "user-scanner"])
After successful completion, the program exits with a message prompting you to restart the tool to run the new version.
How to Update user-scanner Manually
If you prefer command-line control or need to update without running the tool first, use standard pip commands. The manual approach executes the same operations as the automatic updater.
To perform a clean reinstall (matching the auto-update behavior):
python -m pip uninstall -y user-scanner
python -m pip install --upgrade user-scanner
To upgrade without uninstalling (simpler one-liner):
python -m pip install --upgrade user-scanner
Configuring Auto-Update Settings
You can programmatically enable or disable automatic update checks by modifying the configuration stored via user_scanner/core/helpers.py. The save_config_value() function persists the auto_update_status boolean to disk.
To disable auto-updates (equivalent to selecting "don't ask again"):
from user_scanner.core.helpers import save_config_value
save_config_value("auto_update_status", False)
To re-enable automatic update checks:
from user_scanner.core.helpers import save_config_value
save_config_value("auto_update_status", True)
These changes affect subsequent runs of check_for_updates() without requiring code modifications.
Programmatic Update Control
For custom workflows or admin scripts, you can trigger the update logic directly from Python without relying on the automatic startup check.
To force an immediate update regardless of configuration settings:
from user_scanner.utils.update import update_self
update_self()
To manually invoke the version check (including the user prompt):
from user_scanner.utils.updater_logic import check_for_updates
check_for_updates()
Summary
- Automatic updates rely on
check_for_updates()inupdater_logic.py, which validates theauto_update_statusconfig flag, queries PyPI viaget_pypi_version(), and executesupdate_self()to reinstall the package - Manual updates use standard pip commands:
python -m pip install --upgrade user-scannerperforms a straightforward upgrade, while uninstalling first ensures a clean installation - Configuration management occurs through
save_config_value()incore/helpers.py, allowing you to toggleauto_update_statusbetweenTrueandFalse - Key source files include
user_scanner/utils/updater_logic.py(orchestration),user_scanner/utils/update.py(pip execution),user_scanner/core/version.py(version comparison), anduser_scanner/core/helpers.py(config persistence)
Frequently Asked Questions
How do I disable automatic update checks in user-scanner?
Set the auto_update_status configuration flag to False using save_config_value("auto_update_status", False) from user_scanner/core/helpers.py, or select the "don't ask again" (d) option when prompted during an automatic check. This persists the setting and prevents future check_for_updates() calls from querying PyPI.
Can I trigger an update without restarting user-scanner?
No. When update_self() executes successfully, it calls sys.exit() after reinstalling the package. You must restart the Python process or CLI session to load the newly installed version, as the running code cannot reload its own package files while executing.
What is the fastest way to update user-scanner manually?
Run python -m pip install --upgrade user-scanner in your terminal. This single command downloads and installs the latest PyPI release without requiring interaction. For a completely clean installation that matches the auto-update behavior, uninstall first with python -m pip uninstall -y user-scanner.
Where does user-scanner store its update configuration?
The configuration persists through functions in user_scanner/core/helpers.py. The load_config() and save_config_value() functions manage the auto_update_status boolean and other settings in the package's configuration storage, which check_for_updates() references at startup to determine whether to query PyPI.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →