Skip to content

Commit

Permalink
v0.4.1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
isd-project committed Feb 1, 2025
1 parent 81a03f7 commit 2480a1b
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 19 deletions.
50 changes: 44 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@
# python = pkgs.python313;

# Construct package set
pythonSetFor = eachSystem (
pythonSet311For = eachSystem (
system:
let
# injecting cairosvg from upstream nixpkgs, as it is currently not
# supported by the uv2nix_hammer project and is still in the todo list.
# https://pyproject-nix.github.io/pyproject.nix/builders/hacks.html
pkgs = pkgsFor.${system};
python = pkgs.python312;
# python = pkgs.python312;
python = pkgs.python311;
hacks = pkgs.callPackage inputs.pyproject-nix.build.hacks { };
in
# Use base package set from pyproject.nix builders
Expand All @@ -108,11 +109,44 @@
pyprojectOverrides
(_final: prev: {
cairosvg = hacks.nixpkgsPrebuilt {
from = pkgs.python312Packages.cairosvg;
from = pkgs.python311Packages.cairosvg;
prev = prev.cairosvg;
};
cairocffi = hacks.nixpkgsPrebuilt {
from = pkgs.python312Packages.cairocffi;
from = pkgs.python311Packages.cairocffi;
prev = prev.cairocffi;
};
})
]
)
);
pythonSet313For = eachSystem (
system:
let
# injecting cairosvg from upstream nixpkgs, as it is currently not
# supported by the uv2nix_hammer project and is still in the todo list.
# https://pyproject-nix.github.io/pyproject.nix/builders/hacks.html
pkgs = pkgsFor.${system};
# python = pkgs.python312;
python = pkgs.python313;
hacks = pkgs.callPackage inputs.pyproject-nix.build.hacks { };
in
# Use base package set from pyproject.nix builders
(pkgs.callPackage inputs.pyproject-nix.build.packages {
inherit python;
}).overrideScope
(
lib.composeManyExtensions [
inputs.pyproject-build-systems.overlays.default
overlay
pyprojectOverrides
(_final: prev: {
cairosvg = hacks.nixpkgsPrebuilt {
from = pkgs.python313Packages.cairosvg;
prev = prev.cairosvg;
};
cairocffi = hacks.nixpkgsPrebuilt {
from = pkgs.python313Packages.cairocffi;
prev = prev.cairocffi;
};
})
Expand All @@ -137,11 +171,13 @@
// self.packages.${system}
);

# use the newest python version to build packages
# -> get the benefit of improvements to CPython for free.
packages = eachSystem (
system:
let
pkgs = pkgsFor.${system};
pythonSet = pythonSetFor.${system};
pythonSet = pythonSet313For.${system};
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).project.version;
in
rec {
Expand Down Expand Up @@ -247,11 +283,13 @@
# This example provides two different modes of development:
# - Impurely using uv to manage virtual environments
# - Pure development using uv2nix to manage virtual environments
#
# Use Python311 (oldest supported Python) for local development and testing.
devShells = eachSystem (
system:
let
pkgs = pkgsFor.${system};
pythonSet = pythonSetFor.${system};
pythonSet = pythonSet311For.${system};
lib = pkgs.lib;
in
{
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "isd-tui"
requires-python = ">=3.12"
requires-python = ">=3.11"
license = "GPL-3.0-or-later"
license-files = ["LICENSE"]
readme = "README.md"
Expand All @@ -27,7 +27,7 @@ dependencies = [
"pydantic>=2.10.4",
"types-pyyaml>=6.0.12.20241221",
]
version = "0.4.0"
version = "0.4.1"

# # versioningit was great in theory
# # but it comes with too many issues for packaging
Expand Down Expand Up @@ -92,7 +92,7 @@ exclude = [
"share/" = "share/"

[tool.bumpversion]
current_version = "0.4.0"
current_version = "0.4.1"
parse = """
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.
Expand All @@ -118,7 +118,7 @@ tag = false
sign_tags = false
tag_name = "v{new_version}"
tag_message = "Bump version: {current_version} → {new_version}"
allow_dirty = false
allow_dirty = true
commit = false
message = "Bump version: {current_version} → {new_version}"
moveable_tags = []
Expand Down
18 changes: 10 additions & 8 deletions src/isd_tui/isd.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from enum import Enum, StrEnum, auto
from functools import partial
from itertools import chain, repeat
from importlib.resources import as_file, files, as_file
from importlib.resources import as_file, files
from pathlib import Path
from textwrap import dedent, indent
from typing import (
Expand Down Expand Up @@ -88,7 +88,9 @@

from . import __version__

CSS_RESOURCE = files(__name__).joinpath("dom.tcss")
# make type checker happy.
assert __package__ is not None
CSS_RESOURCE = files(__package__).joinpath("dom.tcss")

with as_file(CSS_RESOURCE) as f:
_CSS_RESOURCE_PATH = f
Expand Down Expand Up @@ -1775,11 +1777,11 @@ async def action_systemctl_command(self, unsplit_command: str) -> None:
self.refresh()

async def watch_mode(self, mode: str) -> None:
self.query_one(PreviewArea).mode = self.mode
self.query_one(PreviewArea).mode = mode
# clear current selection
sel = cast(SelectionList, self.query_one(SelectionList))
sel.deselect_all()
self.query_one(Fluid).border_title = " " + self.mode + " "
self.query_one(Fluid).border_title = " " + mode + " "
await self.new_unit_to_state_dict()
# self.query_one(Vertical).border_title = self.mode
# await self.update_unit_to_state_dict()
Expand Down Expand Up @@ -1936,7 +1938,7 @@ def on_input_changed(self, event: CustomInput.Changed) -> None:
self.search_term = event.value
self.debounced_search_units(self.search_term)

def on_input_submitted(self, value: CustomInput.Submitted) -> None:
def on_input_submitted(self, _: CustomInput.Submitted) -> None:
sel = self.query_one(CustomSelectionList)
sel.focus()

Expand Down Expand Up @@ -2059,7 +2061,7 @@ async def refresh_selection(self) -> None:
initial_state=d["value"] in prev_selected,
id=d["value"],
)
for i, d in enumerate(match_dicts)
for d in match_dicts
]
matched_units = [d["value"] for d in match_dicts]
# first show the now "unmatched" selected units,
Expand Down Expand Up @@ -2227,7 +2229,7 @@ def __init__(self, *args, **kwargs):
self.settings = Settings()
self.settings_error = None
except Exception as e:
self.settings = Settings.construct()
self.settings = Settings.model_construct()
self.settings_error = e
# only show the following bindings in the footer
show_bindings = ["toggle_systemctl_modal"]
Expand Down Expand Up @@ -2475,7 +2477,7 @@ def render_model_as_yaml(model: Settings) -> str:
"""
text = ""
model_fields = model.model_fields
for key, value in model.model_dump().items():
for key in model.model_dump().keys():
field = model_fields[key]
text += render_field(key, field)
return text
Expand Down
Loading

0 comments on commit 2480a1b

Please sign in to comment.