python3.pkgs.beetcamp: init at 0.22.0

+168 -1
+67
pkgs/development/python-modules/beetcamp/default.nix
···
··· 1 + { 2 + lib, 3 + beets, 4 + buildPythonPackage, 5 + fetchFromGitHub, 6 + httpx, 7 + packaging, 8 + poetry-core, 9 + pycountry, 10 + pytest-cov-stub, 11 + pytestCheckHook, 12 + rich-tables, 13 + filelock, 14 + writableTmpDirAsHomeHook, 15 + nix-update-script, 16 + }: 17 + 18 + let 19 + version = "0.22.0"; 20 + in 21 + buildPythonPackage { 22 + pname = "beetcamp"; 23 + inherit version; 24 + pyproject = true; 25 + 26 + src = fetchFromGitHub { 27 + owner = "snejus"; 28 + repo = "beetcamp"; 29 + tag = version; 30 + hash = "sha256-5tcQtvYmXT213mZnzKz2kwE5K22rro++lRF65PjC5X0="; 31 + }; 32 + 33 + patches = [ 34 + ./remove-git-pytest-option.diff 35 + ]; 36 + 37 + build-system = [ 38 + poetry-core 39 + ]; 40 + 41 + dependencies = [ 42 + beets 43 + httpx 44 + packaging 45 + pycountry 46 + ]; 47 + 48 + nativeCheckInputs = [ 49 + writableTmpDirAsHomeHook 50 + pytestCheckHook 51 + pytest-cov-stub 52 + rich-tables 53 + filelock 54 + ]; 55 + 56 + passthru.updateScript = nix-update-script { }; 57 + 58 + meta = { 59 + description = "Bandcamp autotagger source for beets (http://beets.io)"; 60 + homepage = "https://github.com/snejus/beetcamp"; 61 + license = lib.licenses.gpl2Only; 62 + maintainers = [ 63 + lib.maintainers._9999years 64 + ]; 65 + mainProgram = "beetcamp"; 66 + }; 67 + }
+98
pkgs/development/python-modules/beetcamp/remove-git-pytest-option.diff
···
··· 1 + The test suite has support for comparing results against a base revision of the 2 + repository. 3 + 4 + This requires that we run the tests from a Git checkout of the `beetcamp` repo, 5 + which we do not do. We don't want to compare against a base revision, so we 6 + just remove the option entirely. 7 + 8 + diff --git a/tests/conftest.py b/tests/conftest.py 9 + index 04d81f66f0..018d9e3c0c 100644 10 + --- a/tests/conftest.py 11 + +++ b/tests/conftest.py 12 + @@ -9,7 +9,6 @@ 13 + 14 + import pytest 15 + from beets.autotag.hooks import AlbumInfo, TrackInfo 16 + -from git import Repo 17 + from rich_tables.diff import pretty_diff 18 + from rich_tables.utils import make_console 19 + 20 + @@ -17,10 +16,8 @@ 21 + from beetsplug.bandcamp.helpers import Helpers 22 + 23 + if TYPE_CHECKING: 24 + - from _pytest.config import Config 25 + from _pytest.config.argparsing import Parser 26 + from _pytest.fixtures import SubRequest 27 + - from _pytest.terminal import TerminalReporter 28 + from rich.console import Console 29 + 30 + 31 + @@ -29,28 +26,6 @@ 32 + 33 + 34 + def pytest_addoption(parser: Parser) -> None: 35 + - newest_folders = sorted( 36 + - (p for p in Path("lib_tests").glob("*") if p.is_dir()), 37 + - key=lambda p: p.stat().st_ctime, 38 + - reverse=True, 39 + - ) 40 + - all_names = [f.name for f in newest_folders] 41 + - names = [n for n in all_names if n != "dev"] 42 + - names_set = set(names) 43 + - 44 + - base_name = "" 45 + - for commit in Repo(".").iter_commits(paths=["./beetsplug"]): 46 + - short_commit = str(commit)[:8] 47 + - if short_commit in names_set: 48 + - base_name = short_commit 49 + - break 50 + - 51 + - parser.addoption( 52 + - "--base", 53 + - choices=all_names, 54 + - default=base_name or "dev", 55 + - help="base directory / comparing against", 56 + - ) 57 + parser.addoption( 58 + "--target", 59 + default="dev", 60 + @@ -64,16 +39,6 @@ 61 + ) 62 + 63 + 64 + -def pytest_terminal_summary( 65 + - terminalreporter: TerminalReporter, 66 + - exitstatus: int, # noqa: ARG001 67 + - config: Config, 68 + -) -> None: 69 + - base = config.getoption("base") 70 + - target = config.getoption("target") 71 + - terminalreporter.write(f"--- Compared {target} against {base} ---\n") 72 + - 73 + - 74 + def pytest_assertrepr_compare(op: str, left: Any, right: Any): # noqa: ARG001 75 + """Pretty print the difference between dict objects.""" 76 + actual, expected = left, right 77 + diff --git a/tests/test_lib.py b/tests/test_lib.py 78 + index 665d5aa61d..0a81e42b24 100644 79 + --- a/tests/test_lib.py 80 + +++ b/tests/test_lib.py 81 + @@ -19,7 +19,6 @@ 82 + 83 + import pytest 84 + from filelock import FileLock 85 + -from git import Repo 86 + from rich import box 87 + from rich.console import Group 88 + from rich.markup import escape 89 + @@ -273,9 +272,6 @@ 90 + return 91 + 92 + sections = [("Failed", summary["failed"], "red")] 93 + - with suppress(TypeError): 94 + - if Repo(pytestconfig.rootpath).active_branch.name == "dev": 95 + - sections.append(("Fixed", summary["fixed"], "green")) 96 + 97 + columns = [] 98 + for name, all_changes, color in sections:
+1 -1
pkgs/development/python-modules/coloraide/default.nix
··· 31 ]; 32 33 meta = { 34 - description = "A color library for Python"; 35 homepage = "https://pypi.org/project/coloraide/"; 36 license = lib.licenses.mit; 37 maintainers = [
··· 31 ]; 32 33 meta = { 34 + description = "Color library for Python"; 35 homepage = "https://pypi.org/project/coloraide/"; 36 license = lib.licenses.mit; 37 maintainers = [
+2
pkgs/top-level/python-packages.nix
··· 1801 1802 bech32 = callPackage ../development/python-modules/bech32 { }; 1803 1804 before-after = callPackage ../development/python-modules/before-after { }; 1805 1806 behave = callPackage ../development/python-modules/behave { };
··· 1801 1802 bech32 = callPackage ../development/python-modules/bech32 { }; 1803 1804 + beetcamp = callPackage ../development/python-modules/beetcamp { }; 1805 + 1806 before-after = callPackage ../development/python-modules/before-after { }; 1807 1808 behave = callPackage ../development/python-modules/behave { };