nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 anysqlite,
4 boto3,
5 buildPythonPackage,
6 fetchFromGitHub,
7 hatch-fancy-pypi-readme,
8 hatchling,
9 httpx,
10 inline-snapshot,
11 moto,
12 msgpack,
13 pytest-asyncio,
14 pytestCheckHook,
15 pyyaml,
16 redis,
17 redisTestHook,
18 time-machine,
19 trio,
20 typing-extensions,
21}:
22
23buildPythonPackage rec {
24 pname = "hishel";
25 version = "1.1.8";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "karpetrosyan";
30 repo = "hishel";
31 tag = version;
32 hash = "sha256-VuUt1M0+ZztWoFZomAR5s1YQ4suIN3uEq54gLTjBLeY=";
33 };
34
35 postPatch = ''
36 sed -i "/addopts/d" pyproject.toml
37 '';
38
39 build-system = [
40 hatch-fancy-pypi-readme
41 hatchling
42 ];
43
44 dependencies = [
45 httpx
46 msgpack
47 typing-extensions
48 ];
49
50 optional-dependencies = {
51 redis = [ redis ];
52 s3 = [ boto3 ];
53 sqlite = [ anysqlite ];
54 yaml = [ pyyaml ];
55 };
56
57 nativeCheckInputs = [
58 inline-snapshot
59 moto
60 pytest-asyncio
61 pytestCheckHook
62 redisTestHook
63 time-machine
64 trio
65 ]
66 ++ lib.concatAttrValues optional-dependencies;
67
68 disabledTests = [
69 # network access
70 "test_encoded_content_caching"
71 "test_simple_caching"
72 "test_simple_caching_ignoring_spec"
73 ];
74
75 pythonImportsCheck = [ "hishel" ];
76
77 meta = {
78 description = "HTTP Cache implementation for HTTPX and HTTP Core";
79 homepage = "https://github.com/karpetrosyan/hishel";
80 changelog = "https://github.com/karpetrosyan/hishel/blob/${src.tag}/CHANGELOG.md";
81 license = lib.licenses.bsd3;
82 maintainers = with lib.maintainers; [ fab ];
83 };
84}