Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.4.0

- Remove `pyqt_reactive.process_launch`. The background process launch policy
is runtime machinery and now lives in zmqruntime 0.6
(`zmqruntime.process_launch`); import it from there. Host families are
subclasses of `BackgroundProcessPlatform` (`WindowsBackgroundProcesses`,
`SessionBackgroundProcesses`) instead of enum members.
- Require zmqruntime 0.6 (`zmqruntime>=0.6,<0.7`).

## 0.3.30

- A flash registration waiting for its widget to reach a flash window is
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
"Pygments>=2.15",
"pyzmq>=22.0",
"python-introspect>=0.2.5",
"zmqruntime>=0.3.0,<0.6",
"zmqruntime>=0.6,<0.7",
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/pyqt_reactive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- Cross-window reactive updates
"""

__version__ = "0.3.30"
__version__ = "0.4.0"

# Public API will be populated as modules are added
__all__ = [
Expand Down
98 changes: 0 additions & 98 deletions src/pyqt_reactive/process_launch.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/pyqt_reactive/services/system_metrics_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import psutil
from python_introspect import validate_annotated_dataclass
from zmqruntime.config import PositiveFloat

from pyqt_reactive.process_launch import BackgroundProcessLaunchPolicy
from zmqruntime.process_launch import BackgroundProcessLaunchPolicy

try:
import GPUtil
Expand Down
2 changes: 1 addition & 1 deletion src/pyqt_reactive/utils/log_highlight_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import threading
from dataclasses import dataclass

from pyqt_reactive.process_launch import BackgroundProcessLaunchPolicy
from zmqruntime.process_launch import BackgroundProcessLaunchPolicy


@dataclass(frozen=True, slots=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,110 +1,13 @@
"""Contracts for noninteractive background subprocess creation."""
"""Background helpers launch through zmqruntime's background process policy."""

from __future__ import annotations

import subprocess
from pathlib import Path
from types import SimpleNamespace

from pyqt_reactive.process_launch import (
BackgroundProcessLaunchPolicy,
BackgroundProcessLaunchSpec,
BackgroundProcessPlatform,
)
from pyqt_reactive.services import system_metrics_sampler
from pyqt_reactive.utils import log_highlight_client


def test_windows_background_process_suppresses_console(monkeypatch) -> None:
no_window = 0x08000000
new_process_group = 0x00000200
monkeypatch.setattr(subprocess, "CREATE_NO_WINDOW", no_window, raising=False)
monkeypatch.setattr(
subprocess,
"CREATE_NEW_PROCESS_GROUP",
new_process_group,
raising=False,
)

attached = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.WINDOWS,
)
detached = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.WINDOWS,
detached=True,
)

assert attached.resolve() == BackgroundProcessLaunchSpec(
creationflags=no_window
)
assert detached.popen_arguments() == {
"creationflags": no_window | new_process_group
}


def test_non_windows_background_process_detaches_without_windows_flags() -> None:
attached = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.OTHER,
)
detached = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.OTHER,
detached=True,
)

assert attached.popen_arguments() == {}
assert detached.resolve() == BackgroundProcessLaunchSpec(
start_new_session=True
)


def test_windows_background_python_uses_windowed_interpreter(
tmp_path: Path,
) -> None:
python_executable = tmp_path / "python.exe"
windowed_executable = tmp_path / "pythonw.exe"
python_executable.touch()
windowed_executable.touch()

policy = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.WINDOWS,
)

assert policy.python_executable(str(python_executable)) == str(
windowed_executable
)


def test_background_python_keeps_original_when_windowed_interpreter_is_absent(
tmp_path: Path,
) -> None:
python_executable = tmp_path / "python.exe"
python_executable.touch()

policy = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.WINDOWS,
)

assert policy.python_executable(str(python_executable)) == str(
python_executable
)


def test_non_windows_background_python_keeps_requested_interpreter(
tmp_path: Path,
) -> None:
python_executable = tmp_path / "python"
python_executable.touch()
(tmp_path / "pythonw.exe").touch()

policy = BackgroundProcessLaunchPolicy(
platform=BackgroundProcessPlatform.OTHER,
)

assert policy.python_executable(str(python_executable)) == str(
python_executable
)


class _ConsumerLaunchPolicy:
@classmethod
def current(cls, *, detached=False):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_release_dependency_declarations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""The original publisher resolves declared public runtime and test inputs."""

from importlib.metadata import version
from pathlib import Path

import pytest
Expand All @@ -14,7 +15,7 @@ def test_published_runtime_is_not_overridden_by_a_source_candidate():
requirement for requirement in map(Requirement, metadata["project"]["dependencies"])
if requirement.name == "zmqruntime"
)
assert runtime.specifier.contains("0.3.0")
assert runtime.specifier.contains(version(runtime.name))
constraints = Path("requirements-ci.txt").read_text().splitlines()
assert not any(
Requirement(value).name == runtime.name
Expand Down
Loading