Skip to main content

Report urgency of package upgrades

Project description

siun

PyPI - Version PyPI - Python Version


Table of Contents

Usage

The most basic way to use siun is to simply run the check command:

siun check

Check command

The check command runs a configurable console command to find which packages can be updated and checks them against various criteria to determine how urgent it is to apply those updates.

Options

The check command supports a few options:

  • --quiet: Suppress regular output; Useful if you only want to update the cache file
  • --no-update: Don't refresh available updates, only read from cache if available
  • --no-cache: Don't read or write cache file
  • --output-format: Pick output format for urgency report; Available formats are [plain|fancy|json|i3status]

Installation

pip install siun

Install dev env

pip install -e .[dev]

Configuration

Configuration happens through a toml file.

The default configuration looks like this:

# command which returns list of available updates
cmd_available = "pacman -Quq; if [ $? == 1 ]; then :; fi"  # pacman returns exit code 1 if there are no updates
# weight required to consider updates to be of available, warning, or critical level
thresholds = { available = 1, warning = 2, critical = 3 }
# minimum age of cached update state before it will be refreshed
cache_min_age_minutes = 30

[criteria]
# setting for `critical` criterion
critical_pattern = "^archlinux-keyring$|^linux$|^pacman.*$"
# weight the criterion contributes to urgency score
critical_weight = 1
# setting for `count` criterion
count_threshold = 10
# setting weight to 0 disables check
count_weight = 0
# setting for `last_pacman_update` criterion
last_pacman_update_age_hours = 618  # 7 days
last_pacman_update_weight = 1

Criteria

siun checks various criteria to determine how urgent updates are. Each criterion has a weight which contributes to a total score. This score is then compared to a list of thresholds to determine wheter updates are available, recommended or required.

Built-in criteria

The following criteria are built-in:

  • available: Any updates are available
  • count: Number of available updates exceeds threshold
  • critical: Any of the available updates is considered a critical package
  • lastupdate: Time since last update has exceeded threshold

Custom criteria

You can also define your own criteria as Python code. Any python file in $XDG_CONFIG_DIR/siun/criteria will be checked for a class called SiunCriterion and run its is_fulfilled method.

Example custom criterion checking if any available updates are reported by arch-audit:

import subprocess


class SiunCriterion:
    """Custom criterion."""

    def is_fulfilled(self, criteria_settings: dict, available_updates: list):
        """Check if any available updates are in arch-audit list."""
        audit_packages = []
        arch_audit_run = subprocess.run(
            ["/usr/bin/arch-audit", "-q", "-u"],
            check=True,
            capture_output=True,
            text=True,
        )
        audit_packages = arch_audit_run.stdout.splitlines()

        return bool(set(available_updates) & set(audit_packages))

License

siun is distributed under the terms of the MIT license.

Name

siun stands for, and tries to answer, the question "Should I upgrade now?".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

siun-1.0.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

siun-1.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file siun-1.0.0.tar.gz.

File metadata

  • Download URL: siun-1.0.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for siun-1.0.0.tar.gz
Algorithm Hash digest
SHA256 27c327dfad913437ec63ce14b76b45d970df660b5447731d4c54245fec55f7fe
MD5 32e8c4b72fb3fea73b4d36f74254bcd2
BLAKE2b-256 014bd197272e0693181fb5be65626e4544dd8bddf881f2ef4bbe843d64a85195

See more details on using hashes here.

File details

Details for the file siun-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: siun-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for siun-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8fbf475e271a7f6d623e4ca6bd1df5d127d9d19cf4ba5da4d29e37418c579f
MD5 183d49902a864807b90b1b8e9398308f
BLAKE2b-256 382e2fa24e9294a9c44deaae7f45f0bd2314056ca931d1e5d31c17183f886e0c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page