Skip to content

chore(pyproject): version bumping/relaxing #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
uses: actions/checkout@v4

- name: Execute Ruff format
uses: chartboost/ruff-action@v1
uses: astral-sh/ruff-action@v3
with:
version: 0.8.1
version: 0.11.0
args: format --check

ruff-check:
Expand All @@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v4

- name: Execute Ruff check
uses: chartboost/ruff-action@v1
uses: astral-sh/ruff-action@v3
with:
version: 0.8.1
version: 0.11.0
args: check
13 changes: 5 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,18 @@
{
packages =
let
pythonPackages = pkgs.python312Packages;
python3Packages = pkgs.python312Packages;

pillow-jxl-plugin = pythonPackages.callPackage ./nix/package/pillow-jxl-plugin.nix {
pillow-jxl-plugin = python3Packages.callPackage ./nix/package/pillow-jxl-plugin.nix {
inherit (pkgs) cmake;
inherit pyexiv2;
inherit (pkgs) rustPlatform;
};
pyexiv2 = pythonPackages.callPackage ./nix/package/pyexiv2.nix { inherit (pkgs) exiv2; };
vtf2img = pythonPackages.callPackage ./nix/package/vtf2img.nix { };
pyexiv2 = python3Packages.callPackage ./nix/package/pyexiv2.nix { inherit (pkgs) exiv2; };
vtf2img = python3Packages.callPackage ./nix/package/vtf2img.nix { };
in
rec {
default = tagstudio;
tagstudio = pythonPackages.callPackage ./nix/package {
inherit pillow-jxl-plugin vtf2img;
};
tagstudio = pkgs.callPackage ./nix/package { inherit pillow-jxl-plugin vtf2img; };
tagstudio-jxl = tagstudio.override { withJXLSupport = true; };

inherit pillow-jxl-plugin pyexiv2 vtf2img;
Expand Down
91 changes: 40 additions & 51 deletions nix/package/default.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,30 @@
{
buildPythonApplication,
chardet,
ffmpeg-headless,
ffmpeg-python,
hatchling,
humanfriendly,
lib,
mutagen,
numpy,
opencv-python,
pillow,
pillow-heif,
pillow-jxl-plugin,
pipewire,
pydantic,
pydub,
pyside6,
pytest-qt,
pytest-xdist,
pytestCheckHook,
pythonRelaxDepsHook,
python3Packages,
qt6,
rawpy,
send2trash,
sqlalchemy,
stdenv,
structlog,
syrupy,
toml,
ujson,
vtf2img,
wrapGAppsHook,

pillow-jxl-plugin,
vtf2img,

withJXLSupport ? false,
}:

let
pyproject = (lib.importTOML ../../pyproject.toml).project;
in
buildPythonApplication {
python3Packages.buildPythonApplication {
pname = pyproject.name;
inherit (pyproject) version;
pyproject = true;

src = ../../.;

nativeBuildInputs = [
pythonRelaxDepsHook
python3Packages.pythonRelaxDepsHook
qt6.wrapQtAppsHook

# INFO: Should be unnecessary once PR is pulled.
Expand All @@ -59,7 +37,7 @@ buildPythonApplication {
qt6.qtmultimedia
];

nativeCheckInputs = [
nativeCheckInputs = with python3Packages; [
pytest-qt
pytest-xdist
pytestCheckHook
Expand All @@ -80,30 +58,41 @@ buildPythonApplication {
lib.makeLibraryPath [ pipewire ]
}";

pythonRemoveDeps = true;
pythonRemoveDeps = lib.optional (!withJXLSupport) [ "pillow_jxl" ];
pythonRelaxDeps = [
"numpy"
"pillow"
"pillow-heif"
"pillow-jxl-plugin"
"structlog"
"typing-extensions"
];
pythonImportsCheck = [ "tagstudio" ];

build-system = [ hatchling ];
dependencies = [
chardet
ffmpeg-python
humanfriendly
mutagen
numpy
opencv-python
pillow
pillow-heif
pydantic
pydub
pyside6
rawpy
send2trash
sqlalchemy
structlog
toml
ujson
vtf2img
] ++ lib.optional withJXLSupport pillow-jxl-plugin;
build-system = with python3Packages; [ hatchling ];
dependencies =
with python3Packages;
[
chardet
ffmpeg-python
humanfriendly
mutagen
numpy
opencv-python
pillow
pillow-heif
pydantic
pydub
pyside6
rawpy
send2trash
sqlalchemy
structlog
toml
ujson
vtf2img
]
++ lib.optional withJXLSupport pillow-jxl-plugin;

disabledTests = [
# INFO: These tests require modifications to a library, which does not work
Expand Down
57 changes: 29 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,43 @@ description = "A User-Focused Photo & File Management System."
version = "9.5.2"
license = "GPL-3.0-only"
readme = "README.md"
requires-python = ">=3.12,<3.13"
dependencies = [
"chardet==5.2.0",
"ffmpeg-python==0.2.0",
"humanfriendly==10.0",
"mutagen==1.47.0",
"numpy==2.1.0",
"opencv_python==4.10.0.84",
"Pillow==10.3.0",
"pillow-heif==0.16.0",
"pillow-jxl-plugin==1.3.0",
"pydub==0.25.1",
"PySide6==6.8.0.1",
"rawpy==0.22.0",
"Send2Trash==1.8.3",
"SQLAlchemy==2.0.34",
"structlog==24.4.0",
"typing_extensions>=3.10.0.0,<4.11.0",
"ujson>=5.8.0,<5.9.0",
"vtf2img==0.1.0",
"toml==0.10.2",
"pydantic==2.9.2",
"chardet~=5.2",
"ffmpeg-python~=0.2",
"humanfriendly==10.*",
"mutagen~=1.47",
"numpy~=2.2",
"opencv_python~=4.11",
"Pillow~=11.1",
"pillow-heif~=0.22",
"pillow-jxl-plugin~=1.3",
"pydantic~=2.10",
"pydub~=0.25",
"PySide6==6.8.0.*",
"rawpy~=0.24",
"Send2Trash~=1.8",
"SQLAlchemy~=2.0",
"structlog~=25.2",
"toml~=0.10",
"typing_extensions~=4.12",
"ujson~=5.10",
"vtf2img~=0.1",
]

[project.optional-dependencies]
dev = ["tagstudio[mkdocs,mypy,pre-commit,pyinstaller,pytest,ruff]"]
mkdocs = ["mkdocs-material[imaging]==9.*"]
mypy = ["mypy==1.11.2", "mypy-extensions==1.*", "types-ujson>=5.8.0,<5.9.0"]
pre-commit = ["pre-commit==3.7.0"]
pyinstaller = ["Pyinstaller==6.6.0"]
mkdocs = ["mkdocs-material==9.*"]
mypy = ["mypy==1.15.0", "mypy-extensions==1.*", "types-ujson~=5.10"]
pre-commit = ["pre-commit~=4.1"]
pyinstaller = ["Pyinstaller~=6.12"]
pytest = [
"pytest==8.2.0",
"pytest-cov==5.0.0",
"pytest==8.3.5",
"pytest-cov==6.0.0",
"pytest-qt==4.4.0",
"syrupy==4.7.1",
"syrupy==4.9.0",
]
ruff = ["ruff==0.8.1"]
ruff = ["ruff==0.11.0"]

[project.gui-scripts]
tagstudio = "tagstudio.main:main"
Expand Down
4 changes: 2 additions & 2 deletions src/tagstudio/qt/modals/ffmpeg_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self):

red = get_ui_color(ColorType.PRIMARY, UiColor.RED)
green = get_ui_color(ColorType.PRIMARY, UiColor.GREEN)
missing = f"<span style='color:{red}'>{Translations["generic.missing"]}</span>"
missing = f"<span style='color:{red}'>{Translations['generic.missing']}</span>"
found = f"<span style='color:{green}'>{Translations['about.module.found']}</span>"
status = Translations.format(
"ffmpeg.missing.status",
Expand All @@ -50,4 +50,4 @@ def __init__(self):
ffprobe=ffprobe,
ffprobe_status=found if which(FFPROBE_CMD) else missing,
)
self.setText(f"{Translations["ffmpeg.missing.description"]}<br><br>{status}")
self.setText(f"{Translations['ffmpeg.missing.description']}<br><br>{status}")
3 changes: 2 additions & 1 deletion src/tagstudio/qt/modals/tag_color_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Licensed under the GPL-3.0 License.
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio

from typing import TYPE_CHECKING, Callable, override
from collections.abc import Callable
from typing import TYPE_CHECKING, override

import structlog
from PySide6 import QtCore, QtGui
Expand Down
3 changes: 2 additions & 1 deletion src/tagstudio/qt/widgets/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@


import math
from collections.abc import Callable
from pathlib import Path
from typing import Callable, override
from typing import override
from warnings import catch_warnings

import structlog
Expand Down
2 changes: 1 addition & 1 deletion src/tagstudio/qt/widgets/migration_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def sanitize_json_field(value):

logger.info(
"[Field Comparison]",
fields="\n".join([str(x) for x in zip(json_fields, sql_fields)]),
fields="\n".join([str(x) for x in zip(json_fields, sql_fields, strict=False)]),
)

self.field_parity = True
Expand Down
3 changes: 2 additions & 1 deletion src/tagstudio/qt/widgets/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio


from typing import Callable, override
from collections.abc import Callable
from typing import override

import structlog
from PySide6 import QtCore, QtGui
Expand Down
6 changes: 3 additions & 3 deletions src/tagstudio/qt/widgets/preview/field_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def write_container(self, index: int, field: BaseField, is_mixed: bool = False):

# Normalize line endings in any text content.
if not is_mixed:
assert isinstance(field.value, (str, type(None)))
assert isinstance(field.value, str | type(None))
text = field.value or ""
else:
text = "<i>Mixed Data</i>"
Expand Down Expand Up @@ -344,7 +344,7 @@ def write_container(self, index: int, field: BaseField, is_mixed: bool = False):
container.set_inline(False)
# Normalize line endings in any text content.
if not is_mixed:
assert isinstance(field.value, (str, type(None)))
assert isinstance(field.value, str | type(None))
text = (field.value or "").replace("\r", "\n")
else:
text = "<i>Mixed Data</i>"
Expand Down Expand Up @@ -491,7 +491,7 @@ def update_field(self, field: BaseField, content: str) -> None:
"""Update a field in all selected Entries, given a field object."""
assert isinstance(
field,
(TextField, DatetimeField),
TextField | DatetimeField,
), f"instance: {type(field)}"

entry_ids = [e.id for e in self.cached_entries]
Expand Down
4 changes: 2 additions & 2 deletions src/tagstudio/qt/widgets/preview/file_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ def update_stats(self, filepath: Path | None = None, ext: str = ".", stats: dict
for i, part in enumerate(display_path.parts):
part_ = part.strip(os.path.sep)
if i != len(display_path.parts) - 1:
file_str += f"{"\u200b".join(part_)}{separator}</b>"
file_str += f"{'\u200b'.join(part_)}{separator}</b>"
else:
if file_str != "":
file_str += "<br>"
file_str += f"<b>{"\u200b".join(part_)}</b>"
file_str += f"<b>{'\u200b'.join(part_)}</b>"
self.file_label.setText(file_str)
self.file_label.setCursor(Qt.CursorShape.PointingHandCursor)
self.opener = FileOpenerHelper(filepath)
Expand Down
2 changes: 1 addition & 1 deletion src/tagstudio/qt/widgets/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio


from typing import Callable
from collections.abc import Callable

from PySide6.QtCore import Qt, QThreadPool
from PySide6.QtWidgets import QProgressDialog, QVBoxLayout, QWidget
Expand Down
2 changes: 1 addition & 1 deletion src/tagstudio/qt/widgets/text_line_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio


from typing import Callable
from collections.abc import Callable

from PySide6.QtWidgets import QLineEdit, QVBoxLayout

Expand Down
7 changes: 4 additions & 3 deletions src/tagstudio/qt/widgets/thumb_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from copy import deepcopy
from io import BytesIO
from pathlib import Path
from typing import cast
from warnings import catch_warnings

import cv2
Expand Down Expand Up @@ -754,8 +755,8 @@ def _font_short_thumb(self, filepath: Path, size: int) -> Image.Image:
data = np.asarray(raw.getchannel(0))

m, n = data.shape[:2]
col: np.ndarray = data.any(0)
row: np.ndarray = data.any(1)
col: np.ndarray = cast(np.ndarray, data.any(0))
row: np.ndarray = cast(np.ndarray, data.any(1))
cropped_data = np.asarray(raw)[
row.argmax() : m - row[::-1].argmax(),
col.argmax() : n - col[::-1].argmax(),
Expand Down Expand Up @@ -802,7 +803,7 @@ def _font_long_thumb(filepath: Path, size: int) -> Image.Image:
bg = Image.new("RGBA", (size, size), color="#00000000")
draw = ImageDraw.Draw(bg)
lines_of_padding = 2
y_offset = 0
y_offset = 0.0

for font_size in scaled_sizes:
font = ImageFont.truetype(filepath, size=font_size)
Expand Down
Loading