Metadata-Version: 2.4
Name: fastpluggy-update-checker
Version: 0.3.1
Summary: Update checker and usage telemetry plugin for FastPluggy
Author: FastPluggy Team
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: FastPluggy>=0.9.0
Requires-Dist: loguru
Requires-Dist: packaging
Provides-Extra: tests
Requires-Dist: pytest>=7.0; extra == "tests"
Requires-Dist: pytest-cov>=4.0; extra == "tests"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "tests"
Provides-Extra: e2e
Requires-Dist: fastpluggy-cli; extra == "e2e"
Dynamic: license-file

# Update Checker Plugin for FastPluggy

![Update Checker](https://img.shields.io/badge/FastPluggy-Update%20Checker-blue)
[![update_checker](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/-/badges/release.svg)](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/-/releases)
[![Pipeline Status](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/badges/main/pipeline.svg?key_text=CI)](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/-/pipelines?ignore_skipped=true)
[![Coverage](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/badges/main/coverage.svg)](https://gitlab.ggcorp.fr/open/fastpluggy/plugins/update_checker/-/pipelines)

Checks for available updates to installed FastPluggy packages and sends optional installation telemetry to the registry. Replaces the deprecated `usage-cli` plugin.

## Install

```bash
pip install fastpluggy-update-checker
```

## Settings

| Setting | Default | Description |
|---------|---------|-------------|
| `registry_url` | `"https://registry.fastpluggy.xyz"` | Registry base URL; empty turns off checks and telemetry |
| `check_interval` | `3600` | Seconds between checks |
| `enabled` | `True` | Enable/disable update checks and telemetry |
| `package_prefix` | `"fastpluggy-"` | Package name prefix filter |
| `send_telemetry` | `True` | Send installation telemetry |
| `installation_id` | `""` | Auto-generated UUID |

## Usage

`registry_url` points at the public FastPluggy registry by default; set it to your own registry if you run one. The plugin starts checking for updates automatically on startup, then every `check_interval` seconds. Saved settings apply without a restart.

The updates show in the core's admin (FastPluggy >= 0.9.0): the Plugins page (`installed → latest`, an *Updates* filter, *Check for updates*), the page of each plugin with a newer release, and the admin home (the core's version, the update count, one `info` advisory in *Needs attention*). The plugin has no menu entry; its own page, linked as *Details* from the Plugins page, is a diagnostic view: the registry asked, the last check and its error, and every package checked.

## API

- `GET /api/updates` — all packages with version comparison (supports `?available_only=true`)
- `GET /api/updates/{name}` — single package info
- `GET /api/summary` — `{total, updates_available, last_checked}`
- `POST /api/check` — trigger immediate check

## Events

The plugin emits `update_checker.updates_detected` via the EventBus when new updates are discovered. It carries a `title`, a `message` and a link: a `notification_center` rule on it notifies (bell, push, ntfy...), and the diagnostic page's *Notify me* button creates one. Other plugins (fp_deployer) can subscribe to react to updates. See `docs/update_checker.md` for payload schema.

## Integration

The plugin implements the core's `UpdateProvider` (`get_update_status()`, `check_for_updates()`), so the core finds it with no configuration. Other plugins read the core's view (`fast_pluggy.updates.status()`), or call `get_available_updates()` / `get_updates_summary()` on the plugin instance.

## Migration from usage-cli

The `update_checker` plugin replaces `usage-cli`. Key differences:

| usage-cli | update_checker |
|-----------|----------------|
| `api_url` setting | `registry_url` setting |
| `send_packages` | `send_telemetry` |
| Sends to separate usage-server | Sends to pypi_registry `/fastpluggy/` endpoints |
| No update checking | Full update checking, shown in the core's admin |
| Uses httpx | Uses stdlib urllib (no extra dependency) |

Remove `fastpluggy-usage-cli` from your dependencies and install `fastpluggy-update-checker` instead.
