diff --git a/pkgs/development/python-modules/anthropic/default.nix b/pkgs/development/python-modules/anthropic/default.nix index 35089a8f7ada..ca24a783d0c3 100644 --- a/pkgs/development/python-modules/anthropic/default.nix +++ b/pkgs/development/python-modules/anthropic/default.nix @@ -16,7 +16,6 @@ jiter, pydantic, sniffio, - tokenizers, typing-extensions, # optional dependencies @@ -28,6 +27,7 @@ # test dirty-equals, + http-snapshot, inline-snapshot, nest-asyncio, pytest-asyncio, @@ -66,7 +66,6 @@ buildPythonPackage (finalAttrs: { jiter pydantic sniffio - tokenizers typing-extensions ]; @@ -84,6 +83,7 @@ buildPythonPackage (finalAttrs: { nativeCheckInputs = [ dirty-equals + http-snapshot inline-snapshot nest-asyncio pytest-asyncio diff --git a/pkgs/development/python-modules/http-snapshot/default.nix b/pkgs/development/python-modules/http-snapshot/default.nix new file mode 100644 index 000000000000..bc9de5346d70 --- /dev/null +++ b/pkgs/development/python-modules/http-snapshot/default.nix @@ -0,0 +1,58 @@ +{ + buildPythonPackage, + fetchFromGitHub, + httpx, + inline-snapshot, + lib, + pytest, + pytestCheckHook, + requests, + setuptools, +}: + +buildPythonPackage (finalAttrs: { + pname = "http-snapshot"; + version = "0.1.9"; + pyproject = true; + + src = fetchFromGitHub { + owner = "karpetrosyan"; + repo = "http-snapshot"; + tag = finalAttrs.version; + hash = "sha256-4roxtwzB3HXwvlBqjdHEit4flXlogVwzlYNgQE8vFwE="; + }; + + build-system = [ setuptools ]; + + buildInputs = [ + pytest + ]; + + dependencies = [ + inline-snapshot + ]; + + optional-dependencies = { + httpx = [ httpx ]; + requests = [ requests ]; + }; + + pythonImportsCheck = [ "http_snapshot" ]; + + nativeCheckInputs = [ + pytestCheckHook + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; + + pytestFlags = [ + "--inline-snapshot=disable" + ]; + + meta = { + changelog = "https://github.com/karpetrosyan/http-snapshot/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + description = "Pytest plugin that snapshots requests made with popular Python HTTP clients"; + homepage = "https://github.com/karpetrosyan/http-snapshot"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.dotlambda ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 387e863819c2..2ac4dacd5ea6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7156,6 +7156,8 @@ self: super: with self; { http-sfv = callPackage ../development/python-modules/http-sfv { }; + http-snapshot = callPackage ../development/python-modules/http-snapshot { }; + httpagentparser = callPackage ../development/python-modules/httpagentparser { }; httpauth = callPackage ../development/python-modules/httpauth { };