nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromCodeberg,
5 fetchpatch,
6 ffmpeg-headless,
7 mediainfo,
8 oxipng,
9 python3Packages,
10}:
11let
12 # Taken from `docker/alpine/Dockerfile`
13 runtimeDeps = [
14 ffmpeg-headless
15 mediainfo
16 oxipng
17 ];
18in
19python3Packages.buildPythonApplication (finalAttrs: {
20 pname = "upsies";
21 version = "2026.01.03";
22 pyproject = true;
23
24 src = fetchFromCodeberg {
25 owner = "plotski";
26 repo = "upsies";
27 tag = "v${finalAttrs.version}";
28 hash = "sha256-Ya1v0DR5a4fPsFVJKVSDbgy+hWE136aRV3pFMExlRhU=";
29 };
30
31 patches = [
32 (fetchpatch {
33 name = "use-pytest-timeout.patch";
34 url = "https://codeberg.org/plotski/upsies/commit/db6b564f8575c913a6fbabb61d5326a073c9b52c.patch";
35 hash = "sha256-UeUrZ6ogUSS0FvyNQwwwp8q+FArEK61o+Y2Uh7mrPtw=";
36 revert = true;
37 })
38 ];
39
40 build-system = with python3Packages; [ setuptools ];
41
42 dependencies = with python3Packages; [
43 aiobtclientapi
44 async-lru
45 beautifulsoup4
46 countryguess
47 guessit
48 httpx
49 langcodes
50 natsort
51 packaging
52 prompt-toolkit
53 pydantic
54 pyimgbox
55 pyparsebluray
56 pyxdg
57 term-image
58 torf
59 unidecode
60 ];
61
62 nativeCheckInputs =
63 with python3Packages;
64 [
65 pytest-asyncio
66 pytest-cov-stub
67 pytest-httpserver
68 pytest-mock
69 pytest-timeout
70 pytestCheckHook
71 trustme
72 ]
73 ++ finalAttrs.passthru.runtimeDeps;
74
75 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
76 # Fail during object comparisons on Darwin
77 "test_group"
78 "test_has_commentary"
79 "test_special_case"
80 "test_set_release_info"
81 "test_Query_from_release"
82 # Depend on directory format
83 "test_home_directory_property"
84 # Depends on specific cocdecs not available on Darwin
85 "test_generate_episode_queries"
86 # Assert false == true
87 "test_is_mixed_scene_release"
88 # Fails due to expecting a non-darwin path format
89 "test_search"
90 ];
91
92 disabledTestPaths = [
93 # DNS resolution errors in the sandbox on some of the tests
94 "tests/utils_test/http_test/http_test.py"
95 "tests/utils_test/http_test/http_tls_test.py"
96 ]
97 ++ lib.optionals stdenv.hostPlatform.isDarwin [
98 # Fail due to the different set of codecs on Darwin
99 "tests/utils_test/predbs_test/predbs_integration_test.py"
100 "tests/utils_test/release_info_test.py"
101 ];
102
103 preCheck = ''
104 # `utils.is_running_in_development_environment` expects it in tests
105 export VIRTUAL_ENV=1
106 '';
107
108 makeWrapperArgs = [
109 "--suffix"
110 "PATH"
111 ":"
112 (lib.makeBinPath finalAttrs.passthru.runtimeDeps)
113 ];
114
115 __darwinAllowLocalNetworking = true;
116
117 passthru = {
118 inherit runtimeDeps;
119 };
120
121 meta = {
122 description = "Toolkit for collecting, generating, normalizing and sharing video metadata";
123 homepage = "https://upsies.readthedocs.io/";
124 license = lib.licenses.gpl3Plus;
125 mainProgram = "upsies";
126 maintainers = with lib.maintainers; [ ambroisie ];
127 };
128})