Skip to content

refactor(connectors)!: let download return one value of any type - #822

Merged
masquare merged 3 commits into
feature/tnet-175-add-the-autonlabtimeseriesexam1-connectorfrom
refactor/connector-download-result
Nov 20, 2026
Merged

masquare merged 3 commits into
feature/tnet-175-add-the-autonlabtimeseriesexam1-connectorfrom
refactor/connector-download-result

Conversation

@masquare

@masquare masquare commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This PR and the one above sit on top of the TimeSeriesExam connector PR.

BaseConnector is now generic over the whole download result, not over the item type of a list. A connector that fetches one handle returns the handle and takes it in convert.

What changes

  • download returns one value of any type. ptb_xl, sleep_edfx, ecg_qa_cot and sleep_cot return their handle, so return [source] and raw_refs[0] are gone. test_mean returns None.
  • Connectors that handle a list keep list[...]: the Hugging Face base (list[HubFileRef]), har_cot and hello_world.
  • The raw argument of compose and convert is positional-only, so a connector can give it its own name.
  • The engine, the CLI, the testing helpers and the docs follow the new contract.
# before
async def download_async(self, cache_dir: Path) -> list[PtbXlSource]:
    return [PtbXlSource(root, root / "ptbxl_database.csv")]

def convert(self, raw_refs: list[PtbXlSource]) -> TimeFDataset:
    source = raw_refs[0]

# after
async def download_async(self, cache_dir: Path) -> PtbXlSource:
    return PtbXlSource(root, root / "ptbxl_database.csv")

def convert(self, source: PtbXlSource) -> TimeFDataset:
    ...

Breaking changes

A connector outside this repository that subclasses BaseConnector[T] must change its type argument to list[T], or return one value.

Checks

  • make check and make test-connectors pass.
  • The core, registry and torch tests pass.

@masquare
masquare added this pull request to stack #825 November 19, 2026 16:18
@masquare
masquare removed this pull request from stack #825 November 19, 2026 17:34
@masquare
masquare force-pushed the refactor/connector-download-result branch from 584e088 to 54855d3 Compare November 19, 2026 17:34
@masquare
masquare changed the base branch from main to feature/tnet-175-add-the-autonlabtimeseriesexam1-connector November 19, 2026 17:34
@masquare
masquare added this pull request to stack #826 November 19, 2026 17:34
@masquare
masquare force-pushed the refactor/connector-download-result branch 2 times, most recently from 73e14ef to 9cfe435 Compare November 19, 2026 17:48
@masquare
masquare requested a review from karhu November 19, 2026 18:53
@masquare
masquare marked this pull request as ready for review November 19, 2026 18:53
@karhu karhu added area:connectors Changes packages/timenet-connectors area:core Changes packages/timenet breaking:api Breaks callers of the Python API or the CLI labels Nov 19, 2026

@karhu karhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added labels on GH, other than that, LGTM

@masquare
masquare force-pushed the refactor/connector-download-result branch from 9cfe435 to 90bd9a6 Compare November 20, 2026 07:25
@masquare
masquare removed this pull request from stack #826 November 20, 2026 07:25
@masquare
masquare added this pull request to stack #829 November 20, 2026 07:25
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

✅ CI checks passed

Check Status
Quick checks ✅ Passed
Tests (Python 3.13) ✅ Passed
Tests (Python 3.11) ✅ Passed

Updated for d70e749 · run #8648

BaseConnector is generic over the whole download result, not over the
item type of a list. A connector that fetches one handle returns the
handle and takes it in convert, so the list with one item and the
raw_refs[0] lookup are gone. The raw argument of compose and convert is
positional-only, so a connector can name it.
@masquare
masquare force-pushed the refactor/connector-download-result branch from 90bd9a6 to d70e749 Compare November 20, 2026 15:31
@masquare
masquare merged commit f9a2b3e into main Nov 20, 2026
4 of 8 checks passed
@masquare
masquare deleted the refactor/connector-download-result branch November 20, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:connectors Changes packages/timenet-connectors area:core Changes packages/timenet breaking:api Breaks callers of the Python API or the CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants