From ee6a01c985fb70f681af7a74d733e91c4ff531a9 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 22 Jan 2024 10:07:44 +0100 Subject: [PATCH] python311Packages.hishel: init at 0.0.21 HTTP Cache implementation for HTTPX and HTTP Core https://github.com/karpetrosyan/hishel --- .../python-modules/hishel/default.nix | 74 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 76 insertions(+) create mode 100644 pkgs/development/python-modules/hishel/default.nix diff --git a/pkgs/development/python-modules/hishel/default.nix b/pkgs/development/python-modules/hishel/default.nix new file mode 100644 index 000000000000..c07b55d765c1 --- /dev/null +++ b/pkgs/development/python-modules/hishel/default.nix @@ -0,0 +1,74 @@ +{ lib +, anysqlite +, buildPythonPackage +, fetchFromGitHub +, hatch-fancy-pypi-readme +, hatchling +, httpx +, pytest-asyncio +, pytestCheckHook +, pythonOlder +, pyyaml +, redis +, trio +}: + +buildPythonPackage rec { + pname = "hishel"; + version = "0.0.21"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "karpetrosyan"; + repo = "hishel"; + rev = "refs/tags/${version}"; + hash = "sha256-okNNYEq97qb2OoP3N+MvG7o3YADfd6LxP8EaNuWDGOM="; + }; + + nativeBuildInputs = [ + hatch-fancy-pypi-readme + hatchling + ]; + + propagatedBuildInputs = [ + httpx + ]; + + passthru.optional-dependencies = { + redis = [ + redis + ]; + sqlite = [ + anysqlite + ]; + yaml = [ + pyyaml + ]; + }; + + nativeCheckInputs = [ + pytest-asyncio + pytestCheckHook + trio + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + + pythonImportsCheck = [ + "hishel" + ]; + + disabledTests = [ + # Tests require a running Redis instance + "test_redis" + ]; + + meta = with lib; { + description = "HTTP Cache implementation for HTTPX and HTTP Core"; + homepage = "https://github.com/karpetrosyan/hishel"; + changelog = "https://github.com/karpetrosyan/hishel/blob/${version}/CHANGELOG.md"; + license = licenses.bsd3; + maintainers = with maintainers; [ fab ]; + }; +} + diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3b0bafbaae09..c9c3efeefcae 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5171,6 +5171,8 @@ self: super: with self; { hiro = callPackage ../development/python-modules/hiro { }; + hishel = callPackage ../development/python-modules/hishel { }; + hist = callPackage ../development/python-modules/hist { }; histoprint = callPackage ../development/python-modules/histoprint { };