Skip to main content

nico579-commons

Shared building blocks for four small open-source apps: blink2video, lidar2map, watch2notif and gpxsolar.

Each of them grew its own copy of the same pieces: the system tray icon, the local web server, atomic file writes, the update check. Every fix had to be carried by hand into the other copies, and some were forgotten. This package gathers those pieces in one place, one module each, so that the four apps behave the same and a fix lands everywhere at once.

Modules

  • nico579_commons.tray: the tray icon, with the very same menu in all four apps: Open, "Update to x.y" only when a newer version is known, Restart, Stop, and "Create a Desktop shortcut". There is no room for app-specific entries on purpose: everything else lives in the page that Open brings up. The menu is rebuilt every five seconds, on the main thread under macOS; Restart, Stop and Update run off the icon's message loop, and the icon waits for them before returning.
  • nico579_commons.raccourci: a desktop shortcut in one call, as a .lnk on Windows, a small .app on macOS and a trusted .desktop file on Linux.
  • nico579_commons.maj: a light check for a newer GitHub release, asked at most once an hour by a background thread, so the tray menu and the page read the answer without waiting for the network.
  • nico579_commons.relance: what "Restart" needs. Under the app's own systemd user service, systemd itself restarts it, since a process spawned from inside the service would be killed along with it; elsewhere, a new detached process, in its own session so that launchd leaves it alone. hors_du_service() does the same for a second process that must outlive the app, such as lidar2map's "New instance": under the service, it starts in a scope of its own (systemd-run --user --scope).
  • nico579_commons.environnement: gives system programs (systemctl, xdg-open, the browser) the LD_LIBRARY_PATH they had before the PyInstaller bootloader prefixed it with the app's own libraries.
  • nico579_commons.atomique: atomic JSON writes, tolerant JSON reads (BOM, transient Windows refusals) and an inter-process file lock.
  • nico579_commons.dossiers: where an app keeps its state (the OS data folder) and its outputs (Documents), an <APP>_HOME override, and the one-time carry-over of the state an older version kept in its working folder. An app is a Dossiers("name", ...) with its own file names.
  • nico579_commons.serveweb: the local web server behind each app's page: static files, /api/* routes in JSON, and the checks on where a request comes from (Host, client address, Origin, Sec-Fetch-Site). An app subclasses Handler for its own variable and routes with query parameters. Also finds a free port and tells whether an instance of the app already answers.
  • nico579_commons.enfants: child processes that die with the app, however the app dies (closed console, killed process, crash). demarrer() is a subprocess.Popen and lancer() a subprocess.run. On Windows the child starts suspended, joins a job object that the kernel kills when the app's handle closes, then runs; on Linux and macOS it gets its own process group and a lifeline: a tiny sh reads a pipe that only the app can write to, and kills the group when the pipe breaks.

The inventory of what is shared, and where the work stands, lives in INVENTAIRE.md (in French). python outils/inventaire_communs.py re-measures what is still duplicated across the four repositories (read-only); ANALYSE-MUTUALISATION-2026-09-29.md is the analysis it produced.

Install

pip install nico579-commons          # relance, raccourci, maj, environnement, enfants
pip install "nico579-commons[tray]"  # plus pystray and Pillow, for the icon

The package on its own requires nothing: only tray needs pystray and Pillow (the tray extra, plus jeepney on Linux), and tray.disponible() says whether they, and a notification area, are there. An app that lists them itself does not need the extra.

On Linux, when the desktop offers a StatusNotifierItem host (GNOME with the AppIndicator extension, as on Ubuntu; KDE Plasma), the icon talks that protocol directly over D-Bus (nico579_commons.tray_sni, pure Python with jeepney, no GTK or PyGObject), because pystray's X11 fallback shows the icon under Wayland but opens no menu. Elsewhere pystray is used as before.

Use

from nico579_commons import tray

actions = tray.Actions(ouvrir=open_page, redemarrer=restart, arreter=stop,
                       version_disponible=cached_newer_version,
                       mettre_a_jour=start_update,
                       creer_raccourci=create_desktop_shortcut,
                       langue=current_language)
tray.Tray("myapp", Path("assets/myapp.ico"), actions).executer()

Python 3.8 or later: blink2video still ships a Windows 7 build on 3.8.

License

GPL-3.0-or-later, like the four apps.

Metadata

Release files for nico579-commons 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nico579-commons 0.6.0
File Size Uploaded Provenance Actions
nico579_commons-0.6.0.tar.gz 172.9 kB With provenance Details for nico579_commons-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nico579-commons 0.6.0
File Interpreter ABI Platform Actions
nico579_commons-0.6.0-py3-none-any.whl Python 3 none any Details for nico579_commons-0.6.0-py3-none-any.whl

Total release size: 288.0 kB

Release files / nico579_commons-0.6.0.tar.gz

Download URL nico579_commons-0.6.0.tar.gz
Size 172.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b5bf96416928c953b03de4ef2476fbc1513d34b7547c29f2a498f6279ede8951
BLAKE2b-256 checksum
How to use checksums
a18172d0e829f52e783fcf61cc8a6116d4ac3c12c6bff8394851ef692f569874
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 20, 2026.

Transparency log

Release files / nico579_commons-0.6.0-py3-none-any.whl

Download URL nico579_commons-0.6.0-py3-none-any.whl
Size 115.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9553c19fc415be1a4388b2ef024e2fda072b4abf9f58cdfb65a78f5415ea4ecb
BLAKE2b-256 checksum
How to use checksums
cbe887b48baaf89604b7d30b77771d70cb129ec09d13d5e98664466ce9d7bdd4
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 20, 2026.

Transparency log

Security for nico579-commons 0.6.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nico579_commons-0.6.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 20, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page