Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove aiohttp from direct dependencies #7294

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ requirements:
- fsspec
- huggingface_hub >=0.23.0,<1.0.0
- packaging
- aiohttp
run:
- python
- pip
Expand All @@ -42,7 +41,6 @@ requirements:
- fsspec
- huggingface_hub >=0.23.0,<1.0.0
- packaging
- aiohttp

test:
imports:
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@
# to save datasets locally or on any filesystem
# minimum 2023.1.0 to support protocol=kwargs in fsspec's `open`, `get_fs_token_paths`, etc.: see https://github.com/fsspec/filesystem_spec/pull/1143
"fsspec[http]>=2023.1.0,<=2024.9.0",
# for data streaming via http
"aiohttp",
# To get datasets from the Datasets Hub on huggingface.co
"huggingface-hub>=0.23.0",
# Utilities from PyPA to e.g., compare versions
Expand Down
12 changes: 10 additions & 2 deletions src/datasets/utils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from urllib.parse import urlparse
from xml.etree import ElementTree as ET

import aiohttp.client_exceptions
import fsspec
import huggingface_hub
import huggingface_hub.errors
Expand All @@ -45,6 +44,15 @@
from .extract import ExtractManager
from .track import TrackedIterableFromGenerator

try:
from aiohttp.client_exceptions import ClientError as _AiohttpClientError
except ImportError:
# aiohttp is not available; synthesize an exception type
# that will never be raised by any actual code for use in the `except`
# clause only.
class _AiohttpClientError(Exception):
pass


logger = logging.get_logger(__name__) # pylint: disable=invalid-name

Expand Down Expand Up @@ -826,7 +834,7 @@ def read_with_retries(*args, **kwargs):
out = read(*args, **kwargs)
break
except (
aiohttp.client_exceptions.ClientError,
_AiohttpClientError,
asyncio.TimeoutError,
requests.exceptions.ConnectionError,
requests.exceptions.Timeout,
Expand Down