From 86fa3bab1a433646e3eb87c3c12e240bdcccb811 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Fri, 17 Oct 2025 13:16:45 +0100 Subject: [PATCH] Fix optional dependencies to avoid forcing installation of both httpx and requests - Move httpx and requests from core dependencies to optional extras - Add 'all' extra for users who want both libraries - Update README to reflect new installation instructions - Update noxfile to install both extras for testing Previously, both httpx and requests were always installed even when users only wanted one library. Now users can install only what they need: - retryhttp[all] for both libraries - retryhttp[httpx] for httpx only - retryhttp[requests] for requests only --- README.md | 2 +- noxfile.py | 2 +- pyproject.toml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2d21657..eb2d436 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Supports both [`requests`](https://docs.python-requests.org/en/latest/index.html Install from PyPI: ```sh -pip install retryhttp # Supports both HTTPX and requests +pip install retryhttp[all] # Supports both HTTPX and requests ``` You can also install support for only HTTPX or requests, if you would rather not install unnecessary dependencies: diff --git a/noxfile.py b/noxfile.py index 38f48f2..e78e50d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -3,5 +3,5 @@ @nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"], tags=["test"]) def test(session: nox.Session) -> None: - session.install(".", ".[dev]") + session.install(".[all,dev]") session.run("pytest", "-n", "4") diff --git a/pyproject.toml b/pyproject.toml index b08b963..3676f8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,10 +28,7 @@ classifiers = [ "Topic :: Utilities", ] dependencies = [ - "httpx", "pydantic", - "requests", - "types-requests", "tenacity" ] @@ -39,12 +36,15 @@ dependencies = [ [project.optional-dependencies] httpx = [ "httpx", - "tenacity", ] requests = [ "requests", "types-requests", - "tenacity", +] +all = [ + "httpx", + "requests", + "types-requests", ] dev = [ "pytest",