Skip to content
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
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
# Harbor is pinned: task content hashes are computed with its packager, and the
# tasks target its configuration schema. huggingface-hub provides `hf download`.
dependencies = ["harbor==0.25.0", "huggingface-hub>=1.0"]
# tasks target its configuration schema. huggingface-hub provides `hf download`,
# whose command-line flags download.py builds; it stays on the 1.x CLI until a
# new major version is tested.
dependencies = ["harbor==0.25.0", "huggingface-hub>=1.0,<2"]

[project.scripts]
websitebench = "websitebench.cli:main"
Expand Down
31 changes: 31 additions & 0 deletions tests/test_download_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import io
import json
import shutil
import subprocess
import tarfile
import tempfile
import tomllib
import unittest
from pathlib import Path
from unittest import mock

from harbor.publisher.packager import Packager

Expand Down Expand Up @@ -102,6 +104,35 @@ def test_packed_directory_is_restored_before_the_check(self):
download.verify_task(self.task, entry)


class HuggingFaceCli(unittest.TestCase):
def test_hf_download_accepts_every_flag_fetch_hf_passes(self):
"""The locked huggingface-hub CLI still takes the flags download.py builds."""
commands = []
with (
tempfile.TemporaryDirectory() as staging,
mock.patch.object(
download.subprocess,
"run",
side_effect=lambda command, **_: commands.append(command),
),
):
index = {"hf_dataset": "org/data", "hf_revision": "main"}
index["tasks"] = {"sample": {}}
download.fetch_hf(index, ["sample"], Path(staging), None)
flags = {part for part in commands[0] if part.startswith("--")}
self.assertEqual(
flags, {"--repo-type", "--local-dir", "--revision", "--include"}
)
usage = subprocess.run(
[commands[0][0], "download", "--help"],
capture_output=True,
text=True,
check=True,
).stdout
for flag in sorted(flags):
self.assertIn(flag, usage)


class ReleaseIndex(unittest.TestCase):
def test_index_lists_exactly_the_repository_tasks(self):
index = download.load_index()
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading