Skip to content

Commit 2480a1b

Browse files
committed
v0.4.1
Not a "real" patch release but simply relaxing the minimal required Python version to 3.11. To support 3.11 only minor changes had to be made. But to provide the best experience for "upstream" users, the nix package and AppImage will use 3.13 for best performance.
1 parent 81a03f7 commit 2480a1b

File tree

4 files changed

+234
-19
lines changed

4 files changed

+234
-19
lines changed

flake.nix

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@
8787
# python = pkgs.python313;
8888

8989
# Construct package set
90-
pythonSetFor = eachSystem (
90+
pythonSet311For = eachSystem (
9191
system:
9292
let
9393
# injecting cairosvg from upstream nixpkgs, as it is currently not
9494
# supported by the uv2nix_hammer project and is still in the todo list.
9595
# https://pyproject-nix.github.io/pyproject.nix/builders/hacks.html
9696
pkgs = pkgsFor.${system};
97-
python = pkgs.python312;
97+
# python = pkgs.python312;
98+
python = pkgs.python311;
9899
hacks = pkgs.callPackage inputs.pyproject-nix.build.hacks { };
99100
in
100101
# Use base package set from pyproject.nix builders
@@ -108,11 +109,44 @@
108109
pyprojectOverrides
109110
(_final: prev: {
110111
cairosvg = hacks.nixpkgsPrebuilt {
111-
from = pkgs.python312Packages.cairosvg;
112+
from = pkgs.python311Packages.cairosvg;
112113
prev = prev.cairosvg;
113114
};
114115
cairocffi = hacks.nixpkgsPrebuilt {
115-
from = pkgs.python312Packages.cairocffi;
116+
from = pkgs.python311Packages.cairocffi;
117+
prev = prev.cairocffi;
118+
};
119+
})
120+
]
121+
)
122+
);
123+
pythonSet313For = eachSystem (
124+
system:
125+
let
126+
# injecting cairosvg from upstream nixpkgs, as it is currently not
127+
# supported by the uv2nix_hammer project and is still in the todo list.
128+
# https://pyproject-nix.github.io/pyproject.nix/builders/hacks.html
129+
pkgs = pkgsFor.${system};
130+
# python = pkgs.python312;
131+
python = pkgs.python313;
132+
hacks = pkgs.callPackage inputs.pyproject-nix.build.hacks { };
133+
in
134+
# Use base package set from pyproject.nix builders
135+
(pkgs.callPackage inputs.pyproject-nix.build.packages {
136+
inherit python;
137+
}).overrideScope
138+
(
139+
lib.composeManyExtensions [
140+
inputs.pyproject-build-systems.overlays.default
141+
overlay
142+
pyprojectOverrides
143+
(_final: prev: {
144+
cairosvg = hacks.nixpkgsPrebuilt {
145+
from = pkgs.python313Packages.cairosvg;
146+
prev = prev.cairosvg;
147+
};
148+
cairocffi = hacks.nixpkgsPrebuilt {
149+
from = pkgs.python313Packages.cairocffi;
116150
prev = prev.cairocffi;
117151
};
118152
})
@@ -137,11 +171,13 @@
137171
// self.packages.${system}
138172
);
139173

174+
# use the newest python version to build packages
175+
# -> get the benefit of improvements to CPython for free.
140176
packages = eachSystem (
141177
system:
142178
let
143179
pkgs = pkgsFor.${system};
144-
pythonSet = pythonSetFor.${system};
180+
pythonSet = pythonSet313For.${system};
145181
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).project.version;
146182
in
147183
rec {
@@ -247,11 +283,13 @@
247283
# This example provides two different modes of development:
248284
# - Impurely using uv to manage virtual environments
249285
# - Pure development using uv2nix to manage virtual environments
286+
#
287+
# Use Python311 (oldest supported Python) for local development and testing.
250288
devShells = eachSystem (
251289
system:
252290
let
253291
pkgs = pkgsFor.${system};
254-
pythonSet = pythonSetFor.${system};
292+
pythonSet = pythonSet311For.${system};
255293
lib = pkgs.lib;
256294
in
257295
{

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "isd-tui"
3-
requires-python = ">=3.12"
3+
requires-python = ">=3.11"
44
license = "GPL-3.0-or-later"
55
license-files = ["LICENSE"]
66
readme = "README.md"
@@ -27,7 +27,7 @@ dependencies = [
2727
"pydantic>=2.10.4",
2828
"types-pyyaml>=6.0.12.20241221",
2929
]
30-
version = "0.4.0"
30+
version = "0.4.1"
3131

3232
# # versioningit was great in theory
3333
# # but it comes with too many issues for packaging
@@ -92,7 +92,7 @@ exclude = [
9292
"share/" = "share/"
9393

9494
[tool.bumpversion]
95-
current_version = "0.4.0"
95+
current_version = "0.4.1"
9696
parse = """
9797
(?P<major>0|[1-9]\\d*)\\.
9898
(?P<minor>0|[1-9]\\d*)\\.
@@ -118,7 +118,7 @@ tag = false
118118
sign_tags = false
119119
tag_name = "v{new_version}"
120120
tag_message = "Bump version: {current_version} → {new_version}"
121-
allow_dirty = false
121+
allow_dirty = true
122122
commit = false
123123
message = "Bump version: {current_version} → {new_version}"
124124
moveable_tags = []

src/isd_tui/isd.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from enum import Enum, StrEnum, auto
3030
from functools import partial
3131
from itertools import chain, repeat
32-
from importlib.resources import as_file, files, as_file
32+
from importlib.resources import as_file, files
3333
from pathlib import Path
3434
from textwrap import dedent, indent
3535
from typing import (
@@ -88,7 +88,9 @@
8888

8989
from . import __version__
9090

91-
CSS_RESOURCE = files(__name__).joinpath("dom.tcss")
91+
# make type checker happy.
92+
assert __package__ is not None
93+
CSS_RESOURCE = files(__package__).joinpath("dom.tcss")
9294

9395
with as_file(CSS_RESOURCE) as f:
9496
_CSS_RESOURCE_PATH = f
@@ -1775,11 +1777,11 @@ async def action_systemctl_command(self, unsplit_command: str) -> None:
17751777
self.refresh()
17761778

17771779
async def watch_mode(self, mode: str) -> None:
1778-
self.query_one(PreviewArea).mode = self.mode
1780+
self.query_one(PreviewArea).mode = mode
17791781
# clear current selection
17801782
sel = cast(SelectionList, self.query_one(SelectionList))
17811783
sel.deselect_all()
1782-
self.query_one(Fluid).border_title = " " + self.mode + " "
1784+
self.query_one(Fluid).border_title = " " + mode + " "
17831785
await self.new_unit_to_state_dict()
17841786
# self.query_one(Vertical).border_title = self.mode
17851787
# await self.update_unit_to_state_dict()
@@ -1936,7 +1938,7 @@ def on_input_changed(self, event: CustomInput.Changed) -> None:
19361938
self.search_term = event.value
19371939
self.debounced_search_units(self.search_term)
19381940

1939-
def on_input_submitted(self, value: CustomInput.Submitted) -> None:
1941+
def on_input_submitted(self, _: CustomInput.Submitted) -> None:
19401942
sel = self.query_one(CustomSelectionList)
19411943
sel.focus()
19421944

@@ -2059,7 +2061,7 @@ async def refresh_selection(self) -> None:
20592061
initial_state=d["value"] in prev_selected,
20602062
id=d["value"],
20612063
)
2062-
for i, d in enumerate(match_dicts)
2064+
for d in match_dicts
20632065
]
20642066
matched_units = [d["value"] for d in match_dicts]
20652067
# first show the now "unmatched" selected units,
@@ -2227,7 +2229,7 @@ def __init__(self, *args, **kwargs):
22272229
self.settings = Settings()
22282230
self.settings_error = None
22292231
except Exception as e:
2230-
self.settings = Settings.construct()
2232+
self.settings = Settings.model_construct()
22312233
self.settings_error = e
22322234
# only show the following bindings in the footer
22332235
show_bindings = ["toggle_systemctl_modal"]
@@ -2475,7 +2477,7 @@ def render_model_as_yaml(model: Settings) -> str:
24752477
"""
24762478
text = ""
24772479
model_fields = model.model_fields
2478-
for key, value in model.model_dump().items():
2480+
for key in model.model_dump().keys():
24792481
field = model_fields[key]
24802482
text += render_field(key, field)
24812483
return text

0 commit comments

Comments
 (0)