Skip to content

Commit f76dc44

Browse files
authored
Finished migration from setup.cfg to pyproject.toml (#1971)
* Moved to tool.ruff.lint as is modern * Moved from setup.cfg to pyproject.toml * Replaced 'flake8: noqa' comment with 'ruff: noqa' and ran ruff on the file
1 parent 13fd190 commit f76dc44

File tree

3 files changed

+25
-86
lines changed

3 files changed

+25
-86
lines changed

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,19 @@ exclude = [
3333
"venv",
3434
]
3535

36-
[tool.ruff.isort]
36+
[tool.ruff.lint.isort]
3737
lines-after-imports = 2
3838
known-first-party = ["huggingface_hub"]
3939

40+
[tool.pytest.ini_options]
41+
# Add the specified `OPTS` to the set of command line arguments as if they had
42+
# been specified by the user.
43+
addopts = "-Werror::FutureWarning --log-cli-level=INFO -sv --durations=0"
44+
# The defined variables will be added to the environment before any tests are
45+
# run, part of pytest-env plugin
46+
env = [
47+
"HF_TOKEN=",
48+
"HUGGING_FACE_HUB_TOKEN=",
49+
"HUGGINGFACE_CO_STAGING=1",
50+
"DISABLE_SYMLINKS_IN_WINDOWS_TESTS=1",
51+
]

setup.cfg

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/huggingface_hub/utils/__init__.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# flake8: noqa
21
#!/usr/bin/env python
32
# coding=utf-8
43
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
@@ -15,6 +14,8 @@
1514
# See the License for the specific language governing permissions and
1615
# limitations under the License
1716

17+
# ruff: noqa: F401
18+
1819
from . import tqdm as _tqdm # _tqdm is the module
1920
from ._cache_assets import cached_assets_path
2021
from ._cache_manager import (
@@ -31,25 +32,24 @@
3132
from ._datetime import parse_datetime
3233
from ._errors import (
3334
BadRequestError,
35+
DisabledRepoError,
3436
EntryNotFoundError,
3537
FileMetadataError,
3638
GatedRepoError,
3739
HfHubHTTPError,
3840
LocalEntryNotFoundError,
39-
DisabledRepoError,
4041
RepositoryNotFoundError,
4142
RevisionNotFoundError,
4243
hf_raise_for_status,
4344
)
44-
from ._token import get_token
45+
from ._experimental import experimental
4546
from ._fixes import SoftTemporaryDirectory, yaml_dump
4647
from ._git_credential import list_credential_helpers, set_git_credential, unset_git_credential
47-
from ._headers import build_hf_headers, get_token_to_send, LocalTokenNotFoundError
48+
from ._headers import LocalTokenNotFoundError, build_hf_headers, get_token_to_send
4849
from ._hf_folder import HfFolder
49-
from ._http import configure_http_backend, get_session, http_backoff, reset_sessions, OfflineModeIsEnabled
50+
from ._http import OfflineModeIsEnabled, configure_http_backend, get_session, http_backoff, reset_sessions
5051
from ._pagination import paginate
51-
from ._paths import filter_repo_objects, IGNORE_GIT_FOLDER_PATTERNS
52-
from ._experimental import experimental
52+
from ._paths import IGNORE_GIT_FOLDER_PATTERNS, filter_repo_objects
5353
from ._runtime import (
5454
dump_environment_info,
5555
get_aiohttp_version,
@@ -71,13 +71,13 @@
7171
is_aiohttp_available,
7272
is_fastai_available,
7373
is_fastcore_available,
74-
is_numpy_available,
7574
is_google_colab,
7675
is_gradio_available,
7776
is_graphviz_available,
7877
is_hf_transfer_available,
7978
is_jinja_available,
8079
is_notebook,
80+
is_numpy_available,
8181
is_pillow_available,
8282
is_pydantic_available,
8383
is_pydot_available,
@@ -86,13 +86,15 @@
8686
is_torch_available,
8787
)
8888
from ._safetensors import (
89+
NotASafetensorsRepoError,
8990
SafetensorsFileMetadata,
91+
SafetensorsParsingError,
9092
SafetensorsRepoMetadata,
9193
TensorInfo,
92-
SafetensorsParsingError,
93-
NotASafetensorsRepoError,
9494
)
9595
from ._subprocess import capture_output, run_interactive_subprocess, run_subprocess
96+
from ._telemetry import send_telemetry
97+
from ._token import get_token
9698
from ._validators import (
9799
HFValidationError,
98100
smoothly_deprecate_use_auth_token,
@@ -106,4 +108,3 @@
106108
tqdm,
107109
tqdm_stream_file,
108110
)
109-
from ._telemetry import send_telemetry

0 commit comments

Comments
 (0)