nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 isPyPy,
6 setuptools,
7 setuptools-scm,
8 backports-zstd,
9 flask,
10 flask-caching,
11 zstandard,
12 brotli,
13 brotlicffi,
14 pytestCheckHook,
15}:
16
17buildPythonPackage rec {
18 version = "1.23";
19 pname = "flask-compress";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "colour-science";
24 repo = "flask-compress";
25 tag = "v${version}";
26 hash = "sha256-iKZfwSFvNrG/ApbqBuDgoUHz296nr+ZMrAX97pMgNTQ=";
27 };
28
29 build-system = [
30 setuptools
31 setuptools-scm
32 ];
33
34 dependencies = [
35 backports-zstd
36 flask
37 ]
38 ++ lib.optionals (!isPyPy) [ brotli ]
39 ++ lib.optionals isPyPy [ brotlicffi ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 flask-caching
44 ];
45
46 pythonImportsCheck = [ "flask_compress" ];
47
48 postPatch = ''
49 substituteInPlace pyproject.toml \
50 --replace-fail "setuptools_scm[toml]<8" "setuptools_scm"
51 '';
52
53 meta = {
54 description = "Compress responses in your Flask app with gzip, deflate or brotli";
55 homepage = "https://github.com/colour-science/flask-compress";
56 changelog = "https://github.com/colour-science/flask-compress/blob/${src.tag}/CHANGELOG.md";
57 license = lib.licenses.mit;
58 maintainers = with lib.maintainers; [ nickcao ];
59 };
60}