Metadata-Version: 2.4
Name: signfetch
Version: 0.2.0a1
Summary: Download data resources discovered via FAIR Signposting item links.
Author: Adam Biśta
License-Expression: MIT
Project-URL: Homepage, https://github.com/adbista/signfetch
Project-URL: Repository, https://github.com/adbista/signfetch
Project-URL: Issues, https://github.com/adbista/signfetch/issues
Keywords: signposting,fair,download,data,linkset
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27.0
Requires-Dist: beautifulsoup4>=4.12.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: respx>=0.21.0; extra == "dev"
Requires-Dist: build>=1.2.0; extra == "dev"
Requires-Dist: twine>=5.1.0; extra == "dev"
Dynamic: license-file

# signfetch v0.2.0a1

Python package focused on **discovering and downloading data via FAIR Signposting**.

## Scope

Version `0.2.0a1` exposes two public APIs:

* `list_item_links(target)` – discover `item` links without downloading
* `download_data(target, output_dir=...)` – discover and download data resources

Both functions use FAIR Signposting discovery mechanisms.

The package discovers `item` links from the three main Signposting delivery mechanisms:

1. HTTP `Link` headers
2. HTML `<link>` elements
3. Link Sets discoverable with the `linkset` relation

Link sets are automatically retrieved and parsed when present.

---

# Example – discover data resources

You can inspect available data resources without downloading them.

```python
from signfetch import list_item_links

links = list_item_links(
    "https://doi.org/10.5281/zenodo.12542566"
)

for link in links:
    print(link.url, link.source)
```
---

# Example – download discovered data

`download_data()` performs discovery and downloads all discovered resources.

```python
from pathlib import Path
from signfetch import download_data

result = download_data(
    "https://doi.org/10.5281/zenodo.12542566",
    output_dir=Path("downloads")
)

print(result.unique_item_count)

for item in result.items:
    print(item.url, item.saved_path)
```
---

# Design notes

Main components:

**Signposting discovery**

* `SignpostingHarvester` – orchestrates discovery
* `LinkHeaderParser` – parses HTTP `Link` headers
* `HtmlLinkParser` – parses HTML `<link>` elements
* `LinksetParser` – parses linkset documents

**Downloading**

* `DataDownloader` – downloads resources discovered via `item` links
* downloads are executed concurrently

**Public API**

* `list_item_links()` – discovery only
* `download_data()` – discovery + download

---

# Installation

```bash
pip install signfetch
```


