Metadata-Version: 2.4
Name: cloverhub
Version: 0.1.0
Summary: Load open datasets from Project Clover (projectclover.org) with one line of Python.
Author-email: Project Clover <unsojo@gmail.com>
License: MIT
Project-URL: Homepage, https://projectclover.org
Project-URL: Datasets, https://projectclover.org/datasets/
Keywords: datasets,machine learning,open data,research,project clover
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: datasets>=2.14
Requires-Dist: pyyaml>=5.1
Dynamic: license-file

# cloverhub

Load open datasets from [Project Clover](https://projectclover.org/datasets/) with one line of Python.

```
pip install cloverhub
```

## Use it in Python

```python
import cloverhub

ds = cloverhub.load_dataset("unsojo/iris")            # all splits
train = cloverhub.load_dataset("unsojo/iris", split="train")

print(train[0])
```

You get back a normal Hugging Face `datasets` object, so everything you already know
(`.map`, `.filter`, `.to_pandas()`, `.train_test_split()`, ...) works as usual.
Column types (numbers, text, labels) come from the dataset's README on Project Clover.

Other handy functions:

```python
cloverhub.list_datasets()                  # every dataset on Project Clover
cloverhub.dataset_info("unsojo/iris")      # files, splits, version, license
cloverhub.download("unsojo/iris", "iris")  # save the raw files into a folder
```

## Use it from the terminal

```
cloverhub list
cloverhub info unsojo/iris
cloverhub download unsojo/iris --dir iris
```

## Pinning a version

Every dataset lives in a GitHub repo. To always get exactly the same data, pass a commit:

```python
cloverhub.load_dataset("unsojo/iris", revision="e53d2bc5f544a9a1fe2790e9e3f8af82ac233a25")
```

`cloverhub info` shows the current commit for any dataset.

## Settings

| Environment variable | What it does |
|---|---|
| `GITHUB_TOKEN` (or `CLOVER_GITHUB_TOKEN`) | Optional. GitHub allows 60 file-list lookups an hour without one. A free token raises that a lot. It is only ever sent to GitHub's API. |
| `CLOVER_ENDPOINT` | Use a different copy of the site (default `https://projectclover.org`). |

## Publishing a dataset so cloverhub can read it

- Put the data in a public GitHub repo.
- Name each file after its split: `train.csv`, `validation.csv`, `test.csv`
  (Parquet `.parquet` and JSON Lines `.jsonl` also work). Put them in a `data/` folder
  or at the top of the repo.
- Optionally describe the columns at the top of `README.md`:

```yaml
---
pretty_name: Iris Flower Measurements
license: cc0-1.0
features:
  Id: int64
  SepalLengthCm: float64
  Species:
    class_label: [Iris-setosa, Iris-versicolor, Iris-virginica]
---
```

Column types can be `string`, `int64`, `float64`, `bool`, or `class_label: [...]`.

## License

MIT
