diff --git a/pkgs/development/python-modules/urllib3-future/default.nix b/pkgs/development/python-modules/urllib3-future/default.nix new file mode 100644 index 000000000000..15c374b1a7f5 --- /dev/null +++ b/pkgs/development/python-modules/urllib3-future/default.nix @@ -0,0 +1,95 @@ +{ + aiofile, + brotli, + brotlicffi, + buildPythonPackage, + fetchFromGitHub, + hatchling, + h11, + isPyPy, + jh2, + lib, + pytest-asyncio, + pytest-timeout, + pytestCheckHook, + python-socks, + pythonOlder, + qh3, + stdenv, + tornado, + trustme, + wsproto, + zstandard, +}: + +buildPythonPackage rec { + pname = "urllib3-future"; + version = "2.13.907"; + pyproject = true; + + src = fetchFromGitHub { + owner = "jawah"; + repo = "urllib3.future"; + tag = version; + hash = "sha256-JDN37PxeiJhlRFEJ8vkB/2Vt0Xmv0JTpD8LCsVwh3Q4="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "''''ignore:.*but not measured.*:coverage.exceptions.CoverageWarning''''," "" \ + --replace-fail "''''ignore:.*No data was collected.*:coverage.exceptions.CoverageWarning''''," "" + ''; + + build-system = [ hatchling ]; + + # prevents installing a urllib3 module and thereby shadow the urllib3 package + env.URLLIB3_NO_OVERRIDE = "true"; + + dependencies = [ + h11 + jh2 + qh3 + ]; + + optional-dependencies = { + brotli = [ (if isPyPy then brotlicffi else brotli) ]; + qh3 = [ qh3 ]; + secure = [ ]; + socks = [ python-socks ]; + ws = [ wsproto ]; + zstd = lib.optionals (pythonOlder "3.14") [ zstandard ]; + }; + + pythonImportsCheck = [ "urllib3_future" ]; + + # PermissionError: [Errno 1] Operation not permitted + doCheck = !stdenv.buildPlatform.isDarwin; + + nativeCheckInputs = [ + aiofile + pytest-asyncio + pytest-timeout + pytestCheckHook + tornado + trustme + ] + ++ lib.flatten (lib.attrValues optional-dependencies); + + disabledTestPaths = [ + # test connects to the internet + "test/contrib/test_resolver.py::test_url_resolver" + ]; + + disabledTests = [ + # test hangs + "test_proxy_rejection" + ]; + + meta = { + changelog = "https://github.com/jawah/urllib3.future/blob/${src.tag}/CHANGES.rst"; + description = "Powerful HTTP 1.1, 2, and 3 client with both sync and async interfaces"; + homepage = "https://github.com/jawah/urllib3.future"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ceabd9c713f5..3550018206e0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -19355,6 +19355,8 @@ self: super: with self; { urllib3 = callPackage ../development/python-modules/urllib3 { }; + urllib3-future = callPackage ../development/python-modules/urllib3-future { }; + urlman = callPackage ../development/python-modules/urlman { }; urlmatch = callPackage ../development/python-modules/urlmatch { };