jdxi_editor.update.checker

Update checker

Asks GitHub Releases whether a newer JD-Xi Editor has been published, with one unauthenticated request (GitHub allows 60 an hour per IP address; the automatic check runs at most once a day). Drafts, pre-releases and releases without a build for this platform are ignored.

Example

>>> checker = UpdateChecker(parent)
>>> checker.update_available.connect(on_update)  # (ReleaseInfo, manual)
>>> checker.check(manual=True)

Attributes

REPOSITORY

RELEASES_API_URL

RELEASES_PAGE_URL

PIP_UPGRADE_COMMAND

AUTO_CHECK_KEY

LAST_CHECK_KEY

SKIPPED_VERSION_KEY

AUTO_CHECK_DEFAULT

CHECK_INTERVAL

STARTUP_DELAY_MS

TRANSFER_TIMEOUT_MS

ASSET_SUFFIXES

_PRE_RANK

_VERSION

Classes

ReleaseInfo

A published release, with the download that suits this install.

UpdateChecker

Checks GitHub Releases asynchronously; never blocks the UI.

Functions

parse_version(text) → Optional[tuple[int, ...]]

'v0.9.10' or '0.9.10' -> (0, 9, 10); None if there is no version.

version_key(text) → Optional[tuple]

A comparable key that orders pre-releases before their own release.

is_newer(candidate, current) → bool

True if candidate is a later version than current (0.9.10 > 0.9.9).

install_kind() → str

How this copy was installed, which decides the download offered.

_pick_asset(assets, kind) → Optional[dict]

pick_release(releases, kind) → Optional[ReleaseInfo]

The newest published release with a build for this kind of install.

settings_bool(settings, key, default) → bool

app_settings() → PySide6.QtCore.QSettings

should_auto_check([settings, now]) → bool

Automatic checks are on and the last one was over a day ago.

Module Contents

jdxi_editor.update.checker.REPOSITORY = 'markxbrooks/JDXI-Editor'[source]
jdxi_editor.update.checker.RELEASES_API_URL = 'https://api.github.com/repos/markxbrooks/JDXI-Editor/releases?per_page=10'[source]
jdxi_editor.update.checker.RELEASES_PAGE_URL = 'https://github.com/markxbrooks/JDXI-Editor/releases'[source]
jdxi_editor.update.checker.PIP_UPGRADE_COMMAND = 'pip install -U jdxi-editor'[source]
jdxi_editor.update.checker.AUTO_CHECK_KEY = 'update/auto_check'[source]
jdxi_editor.update.checker.LAST_CHECK_KEY = 'update/last_check'[source]
jdxi_editor.update.checker.SKIPPED_VERSION_KEY = 'update/skipped_version'[source]
jdxi_editor.update.checker.AUTO_CHECK_DEFAULT = True[source]
jdxi_editor.update.checker.CHECK_INTERVAL[source]
jdxi_editor.update.checker.STARTUP_DELAY_MS = 10000[source]
jdxi_editor.update.checker.TRANSFER_TIMEOUT_MS = 15000[source]
jdxi_editor.update.checker.ASSET_SUFFIXES: dict[str, tuple[str, ...]][source]
class jdxi_editor.update.checker.ReleaseInfo[source]

A published release, with the download that suits this install.

version: str[source]
tag: str[source]
name: str[source]
notes: str[source]
page_url: str[source]
asset_name: str | None = None[source]
asset_url: str | None = None[source]
jdxi_editor.update.checker.parse_version(text: str) → tuple[int, ...] | None[source]

‘v0.9.10’ or ‘0.9.10’ -> (0, 9, 10); None if there is no version.

jdxi_editor.update.checker._PRE_RANK[source]
jdxi_editor.update.checker._VERSION[source]
jdxi_editor.update.checker.version_key(text: str) → tuple | None[source]

A comparable key that orders pre-releases before their own release.

1.0.0rc1 < 1.0.0rc2 < 1.0.0, as PEP 440 orders them, so a tester running a candidate is still offered the final build. parse_version cannot do this: it reads the numbers only, which makes 1.0.0rc1 and 1.0.0 indistinguishable.

Parameters:

text – str a version or tag, e.g. “v1.0.0rc1”

Returns:

tuple | None (release, is_final, pre rank, pre number), or None

jdxi_editor.update.checker.is_newer(candidate: str, current: str) → bool[source]

True if candidate is a later version than current (0.9.10 > 0.9.9).

jdxi_editor.update.checker.install_kind() → str[source]

How this copy was installed, which decides the download offered.

jdxi_editor.update.checker._pick_asset(assets: Iterable[dict], kind: str) → dict | None[source]
jdxi_editor.update.checker.pick_release(releases: Iterable[dict], kind: str) → ReleaseInfo | None[source]

The newest published release with a build for this kind of install.

jdxi_editor.update.checker.settings_bool(settings: PySide6.QtCore.QSettings, key: str, default: bool) → bool[source]
jdxi_editor.update.checker.app_settings() → PySide6.QtCore.QSettings[source]
jdxi_editor.update.checker.should_auto_check(settings: PySide6.QtCore.QSettings | None = None, now: datetime.datetime | None = None) → bool[source]

Automatic checks are on and the last one was over a day ago.

class jdxi_editor.update.checker.UpdateChecker(parent: PySide6.QtCore.QObject | None = None, url: str = RELEASES_API_URL, current_version: str = __version__, kind: str | None = None, settings: PySide6.QtCore.QSettings | None = None, now: Callable[[], datetime.datetime] = lambda : ...)[source]

Bases: PySide6.QtCore.QObject

Checks GitHub Releases asynchronously; never blocks the UI.

update_available[source]
up_to_date[source]
failed[source]
url = 'https://api.github.com/repos/markxbrooks/JDXI-Editor/releases?per_page=10'[source]
current_version = '1.0.2'[source]
kind = 'pip'[source]
settings[source]
_now[source]
_manager[source]
_reply: PySide6.QtNetwork.QNetworkReply | None = None[source]
property is_checking: bool[source]
check(manual: bool = False) → None[source]

Start a check; the result arrives as one of the signals.

_on_finished(reply: PySide6.QtNetwork.QNetworkReply, manual: bool) → None[source]
_report(release: ReleaseInfo | None, manual: bool) → None[source]