jdxi_editor.update.checker ========================== .. py:module:: jdxi_editor.update.checker .. autoapi-nested-parse:: 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. .. rubric:: Example >>> checker = UpdateChecker(parent) >>> checker.update_available.connect(on_update) # (ReleaseInfo, manual) >>> checker.check(manual=True) Attributes ---------- .. autoapisummary:: jdxi_editor.update.checker.REPOSITORY jdxi_editor.update.checker.RELEASES_API_URL jdxi_editor.update.checker.RELEASES_PAGE_URL jdxi_editor.update.checker.PIP_UPGRADE_COMMAND jdxi_editor.update.checker.AUTO_CHECK_KEY jdxi_editor.update.checker.LAST_CHECK_KEY jdxi_editor.update.checker.SKIPPED_VERSION_KEY jdxi_editor.update.checker.AUTO_CHECK_DEFAULT jdxi_editor.update.checker.CHECK_INTERVAL jdxi_editor.update.checker.STARTUP_DELAY_MS jdxi_editor.update.checker.TRANSFER_TIMEOUT_MS jdxi_editor.update.checker.ASSET_SUFFIXES jdxi_editor.update.checker._PRE_RANK jdxi_editor.update.checker._VERSION Classes ------- .. autoapisummary:: jdxi_editor.update.checker.ReleaseInfo jdxi_editor.update.checker.UpdateChecker Functions --------- .. autoapisummary:: jdxi_editor.update.checker.parse_version jdxi_editor.update.checker.version_key jdxi_editor.update.checker.is_newer jdxi_editor.update.checker.install_kind jdxi_editor.update.checker._pick_asset jdxi_editor.update.checker.pick_release jdxi_editor.update.checker.settings_bool jdxi_editor.update.checker.app_settings jdxi_editor.update.checker.should_auto_check Module Contents --------------- .. py:data:: REPOSITORY :value: 'markxbrooks/JDXI-Editor' .. py:data:: RELEASES_API_URL :value: 'https://api.github.com/repos/markxbrooks/JDXI-Editor/releases?per_page=10' .. py:data:: RELEASES_PAGE_URL :value: 'https://github.com/markxbrooks/JDXI-Editor/releases' .. py:data:: PIP_UPGRADE_COMMAND :value: 'pip install -U jdxi-editor' .. py:data:: AUTO_CHECK_KEY :value: 'update/auto_check' .. py:data:: LAST_CHECK_KEY :value: 'update/last_check' .. py:data:: SKIPPED_VERSION_KEY :value: 'update/skipped_version' .. py:data:: AUTO_CHECK_DEFAULT :value: True .. py:data:: CHECK_INTERVAL .. py:data:: STARTUP_DELAY_MS :value: 10000 .. py:data:: TRANSFER_TIMEOUT_MS :value: 15000 .. py:data:: ASSET_SUFFIXES :type: dict[str, tuple[str, ...]] .. py:class:: ReleaseInfo A published release, with the download that suits this install. .. py:attribute:: version :type: str .. py:attribute:: tag :type: str .. py:attribute:: name :type: str .. py:attribute:: notes :type: str .. py:attribute:: page_url :type: str .. py:attribute:: asset_name :type: Optional[str] :value: None .. py:attribute:: asset_url :type: Optional[str] :value: None .. py:function:: parse_version(text: str) -> Optional[tuple[int, ...]] 'v0.9.10' or '0.9.10' -> (0, 9, 10); None if there is no version. .. py:data:: _PRE_RANK .. py:data:: _VERSION .. py:function:: version_key(text: str) -> Optional[tuple] 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. :param text: str a version or tag, e.g. "v1.0.0rc1" :return: tuple | None (release, is_final, pre rank, pre number), or None .. py:function:: is_newer(candidate: str, current: str) -> bool True if candidate is a later version than current (0.9.10 > 0.9.9). .. py:function:: install_kind() -> str How this copy was installed, which decides the download offered. .. py:function:: _pick_asset(assets: Iterable[dict], kind: str) -> Optional[dict] .. py:function:: pick_release(releases: Iterable[dict], kind: str) -> Optional[ReleaseInfo] The newest published release with a build for this kind of install. .. py:function:: settings_bool(settings: PySide6.QtCore.QSettings, key: str, default: bool) -> bool .. py:function:: app_settings() -> PySide6.QtCore.QSettings .. py:function:: should_auto_check(settings: Optional[PySide6.QtCore.QSettings] = None, now: Optional[datetime.datetime] = None) -> bool Automatic checks are on and the last one was over a day ago. .. py:class:: UpdateChecker(parent: Optional[PySide6.QtCore.QObject] = None, url: str = RELEASES_API_URL, current_version: str = __version__, kind: Optional[str] = None, settings: Optional[PySide6.QtCore.QSettings] = None, now: Callable[[], datetime.datetime] = lambda: datetime.now(timezone.utc)) Bases: :py:obj:`PySide6.QtCore.QObject` Checks GitHub Releases asynchronously; never blocks the UI. .. py:attribute:: update_available .. py:attribute:: up_to_date .. py:attribute:: failed .. py:attribute:: url :value: 'https://api.github.com/repos/markxbrooks/JDXI-Editor/releases?per_page=10' .. py:attribute:: current_version :value: '1.0.2' .. py:attribute:: kind :value: 'pip' .. py:attribute:: settings .. py:attribute:: _now .. py:attribute:: _manager .. py:attribute:: _reply :type: Optional[PySide6.QtNetwork.QNetworkReply] :value: None .. py:property:: is_checking :type: bool .. py:method:: check(manual: bool = False) -> None Start a check; the result arrives as one of the signals. .. py:method:: _on_finished(reply: PySide6.QtNetwork.QNetworkReply, manual: bool) -> None .. py:method:: _report(release: Optional[ReleaseInfo], manual: bool) -> None