nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 backports-zstd,
3 buildPythonPackage,
4 fetchFromGitHub,
5 lib,
6 hatchling,
7 hatch-vcs,
8 pytestCheckHook,
9 pythonOlder,
10 typing-extensions,
11 zstd-c,
12}:
13
14buildPythonPackage rec {
15 pname = "pyzstd";
16 version = "0.19.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "Rogdham";
21 repo = "pyzstd";
22 tag = version;
23 hash = "sha256-1oUqnZCBJYu8haFIQ+T2KaSQaa1xnZyJHLzOQg4Fdw8=";
24 };
25
26 postPatch = ''
27 # pyzst needs a copy of upstream zstd's license
28 ln -s ${zstd-c.src}/LICENSE zstd
29 '';
30
31 build-system = [
32 hatchling
33 hatch-vcs
34 ];
35
36 dependencies = [
37 backports-zstd
38 ]
39 ++ lib.optionals (pythonOlder "3.13") [
40 typing-extensions
41 ];
42
43 pythonRelaxDeps = [
44 "typing-extensions"
45 ];
46
47 buildInputs = [
48 zstd-c
49 ];
50
51 pypaBuildFlags = [
52 "--config-setting=--global-option=--dynamic-link-zstd"
53 ];
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 ];
58
59 pythonImportsCheck = [
60 "pyzstd"
61 ];
62
63 meta = {
64 description = "Python bindings to Zstandard (zstd) compression library";
65 homepage = "https://pyzstd.readthedocs.io";
66 changelog = "https://github.com/Rogdham/pyzstd/blob/${src.tag}/CHANGELOG.md";
67 license = lib.licenses.bsd3;
68 maintainers = with lib.maintainers; [
69 MattSturgeon
70 pitkling
71 PopeRigby
72 ];
73 };
74}