From f7cb3d5cb7eabe6dbaea25283e6bdec45e287b38 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 24 Jul 2025 19:44:55 -0400 Subject: [PATCH 1/3] python3.pkgs.coloraide: init at 4.7.2 --- .../python-modules/coloraide/default.nix | 41 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 43 insertions(+) create mode 100644 pkgs/development/python-modules/coloraide/default.nix diff --git a/pkgs/development/python-modules/coloraide/default.nix b/pkgs/development/python-modules/coloraide/default.nix new file mode 100644 index 000000000000..88605667912c --- /dev/null +++ b/pkgs/development/python-modules/coloraide/default.nix @@ -0,0 +1,41 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + hatchling, + typing-extensions, +}: +let + pname = "coloraide"; + version = "4.7.2"; +in +buildPythonPackage { + inherit pname version; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-fomOKtF3hzgJvR9f2x2QYYrYdASf6tlS/0Rw0VdmbUs="; + }; + + build-system = [ + hatchling + ]; + + dependencies = [ + typing-extensions + ]; + + pythonImportsCheck = [ + "coloraide" + ]; + + meta = { + description = "A color library for Python"; + homepage = "https://pypi.org/project/coloraide/"; + license = lib.licenses.mit; + maintainers = [ + lib.maintainers._9999years + ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index aafdab065454..b397360c29ed 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2801,6 +2801,8 @@ self: super: with self; { color-parser-py = callPackage ../development/python-modules/color-parser-py { }; + coloraide = callPackage ../development/python-modules/coloraide { }; + colorama = callPackage ../development/python-modules/colorama { }; colorcet = callPackage ../development/python-modules/colorcet { }; From 2a1374786a4deabfb1f5de093918504ab9b2ed2b Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 24 Jul 2025 19:44:55 -0400 Subject: [PATCH 2/3] python3.pkgs.rich-tables: init at 0.8.0 --- .../python-modules/rich-tables/default.nix | 66 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 68 insertions(+) create mode 100644 pkgs/development/python-modules/rich-tables/default.nix diff --git a/pkgs/development/python-modules/rich-tables/default.nix b/pkgs/development/python-modules/rich-tables/default.nix new file mode 100644 index 000000000000..2c7d29b51316 --- /dev/null +++ b/pkgs/development/python-modules/rich-tables/default.nix @@ -0,0 +1,66 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + poetry-core, + coloraide, + humanize, + multimethod, + platformdirs, + rich, + sqlparse, + typing-extensions, + rgbxy ? null, +}: +let + version = "0.8.0"; +in +buildPythonPackage { + pname = "rich-tables"; + inherit version; + pyproject = true; + + src = fetchPypi { + pname = "rich_tables"; + inherit version; + hash = "sha256-MN8QH6kLyogbcQ0VE9U034cwSFnaFDB2/Rnvy1DYyl4="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + coloraide + humanize + multimethod + platformdirs + rich + sqlparse + typing-extensions + ]; + + optional-dependencies = { + hue = [ + rgbxy + ]; + }; + + pythonRelaxDeps = [ + "multimethod" + ]; + + pythonImportsCheck = [ + "rich_tables" + ]; + + meta = { + description = "Ready-made rich tables for various purposes"; + homepage = "https://pypi.org/project/rich-tables/"; + license = lib.licenses.mit; + maintainers = [ + lib.maintainers._9999years + ]; + mainProgram = "table"; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b397360c29ed..58c4e5e209b1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15827,6 +15827,8 @@ self: super: with self; { rich-rst = callPackage ../development/python-modules/rich-rst { }; + rich-tables = callPackage ../development/python-modules/rich-tables { }; + rich-theme-manager = callPackage ../development/python-modules/rich-theme-manager { }; rich-toolkit = callPackage ../development/python-modules/rich-toolkit { }; From 290fffd834980daec436dfde3dea455053a4a558 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 24 Jul 2025 19:59:34 -0400 Subject: [PATCH 3/3] python3.pkgs.beetcamp: init at 0.22.0 --- .../python-modules/beetcamp/default.nix | 67 +++++++++++++ .../beetcamp/remove-git-pytest-option.diff | 98 +++++++++++++++++++ .../python-modules/coloraide/default.nix | 2 +- pkgs/top-level/python-packages.nix | 2 + 4 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/beetcamp/default.nix create mode 100644 pkgs/development/python-modules/beetcamp/remove-git-pytest-option.diff diff --git a/pkgs/development/python-modules/beetcamp/default.nix b/pkgs/development/python-modules/beetcamp/default.nix new file mode 100644 index 000000000000..4d267ef0fd40 --- /dev/null +++ b/pkgs/development/python-modules/beetcamp/default.nix @@ -0,0 +1,67 @@ +{ + lib, + beets, + buildPythonPackage, + fetchFromGitHub, + httpx, + packaging, + poetry-core, + pycountry, + pytest-cov-stub, + pytestCheckHook, + rich-tables, + filelock, + writableTmpDirAsHomeHook, + nix-update-script, +}: + +let + version = "0.22.0"; +in +buildPythonPackage { + pname = "beetcamp"; + inherit version; + pyproject = true; + + src = fetchFromGitHub { + owner = "snejus"; + repo = "beetcamp"; + tag = version; + hash = "sha256-5tcQtvYmXT213mZnzKz2kwE5K22rro++lRF65PjC5X0="; + }; + + patches = [ + ./remove-git-pytest-option.diff + ]; + + build-system = [ + poetry-core + ]; + + dependencies = [ + beets + httpx + packaging + pycountry + ]; + + nativeCheckInputs = [ + writableTmpDirAsHomeHook + pytestCheckHook + pytest-cov-stub + rich-tables + filelock + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Bandcamp autotagger source for beets (http://beets.io)"; + homepage = "https://github.com/snejus/beetcamp"; + license = lib.licenses.gpl2Only; + maintainers = [ + lib.maintainers._9999years + ]; + mainProgram = "beetcamp"; + }; +} diff --git a/pkgs/development/python-modules/beetcamp/remove-git-pytest-option.diff b/pkgs/development/python-modules/beetcamp/remove-git-pytest-option.diff new file mode 100644 index 000000000000..21a4c2e23fac --- /dev/null +++ b/pkgs/development/python-modules/beetcamp/remove-git-pytest-option.diff @@ -0,0 +1,98 @@ +The test suite has support for comparing results against a base revision of the +repository. + +This requires that we run the tests from a Git checkout of the `beetcamp` repo, +which we do not do. We don't want to compare against a base revision, so we +just remove the option entirely. + +diff --git a/tests/conftest.py b/tests/conftest.py +index 04d81f66f0..018d9e3c0c 100644 +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -9,7 +9,6 @@ + + import pytest + from beets.autotag.hooks import AlbumInfo, TrackInfo +-from git import Repo + from rich_tables.diff import pretty_diff + from rich_tables.utils import make_console + +@@ -17,10 +16,8 @@ + from beetsplug.bandcamp.helpers import Helpers + + if TYPE_CHECKING: +- from _pytest.config import Config + from _pytest.config.argparsing import Parser + from _pytest.fixtures import SubRequest +- from _pytest.terminal import TerminalReporter + from rich.console import Console + + +@@ -29,28 +26,6 @@ + + + def pytest_addoption(parser: Parser) -> None: +- newest_folders = sorted( +- (p for p in Path("lib_tests").glob("*") if p.is_dir()), +- key=lambda p: p.stat().st_ctime, +- reverse=True, +- ) +- all_names = [f.name for f in newest_folders] +- names = [n for n in all_names if n != "dev"] +- names_set = set(names) +- +- base_name = "" +- for commit in Repo(".").iter_commits(paths=["./beetsplug"]): +- short_commit = str(commit)[:8] +- if short_commit in names_set: +- base_name = short_commit +- break +- +- parser.addoption( +- "--base", +- choices=all_names, +- default=base_name or "dev", +- help="base directory / comparing against", +- ) + parser.addoption( + "--target", + default="dev", +@@ -64,16 +39,6 @@ + ) + + +-def pytest_terminal_summary( +- terminalreporter: TerminalReporter, +- exitstatus: int, # noqa: ARG001 +- config: Config, +-) -> None: +- base = config.getoption("base") +- target = config.getoption("target") +- terminalreporter.write(f"--- Compared {target} against {base} ---\n") +- +- + def pytest_assertrepr_compare(op: str, left: Any, right: Any): # noqa: ARG001 + """Pretty print the difference between dict objects.""" + actual, expected = left, right +diff --git a/tests/test_lib.py b/tests/test_lib.py +index 665d5aa61d..0a81e42b24 100644 +--- a/tests/test_lib.py ++++ b/tests/test_lib.py +@@ -19,7 +19,6 @@ + + import pytest + from filelock import FileLock +-from git import Repo + from rich import box + from rich.console import Group + from rich.markup import escape +@@ -273,9 +272,6 @@ + return + + sections = [("Failed", summary["failed"], "red")] +- with suppress(TypeError): +- if Repo(pytestconfig.rootpath).active_branch.name == "dev": +- sections.append(("Fixed", summary["fixed"], "green")) + + columns = [] + for name, all_changes, color in sections: diff --git a/pkgs/development/python-modules/coloraide/default.nix b/pkgs/development/python-modules/coloraide/default.nix index 88605667912c..03c702dde374 100644 --- a/pkgs/development/python-modules/coloraide/default.nix +++ b/pkgs/development/python-modules/coloraide/default.nix @@ -31,7 +31,7 @@ buildPythonPackage { ]; meta = { - description = "A color library for Python"; + description = "Color library for Python"; homepage = "https://pypi.org/project/coloraide/"; license = lib.licenses.mit; maintainers = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 58c4e5e209b1..572598bac0b4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1801,6 +1801,8 @@ self: super: with self; { bech32 = callPackage ../development/python-modules/bech32 { }; + beetcamp = callPackage ../development/python-modules/beetcamp { }; + before-after = callPackage ../development/python-modules/before-after { }; behave = callPackage ../development/python-modules/behave { };