{"id":22944555,"url":"https://github.com/8451/labrea","last_synced_at":"2025-07-07T18:35:24.763Z","repository":{"id":241591682,"uuid":"807220055","full_name":"8451/labrea","owner":"8451","description":"A framework for declarative, functional dataset definitions.","archived":false,"fork":false,"pushed_at":"2024-05-28T18:08:51.000Z","size":2985,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-29T07:08:55.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/8451.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-28T17:24:55.000Z","updated_at":"2024-08-05T14:20:44.847Z","dependencies_parsed_at":"2024-05-30T15:07:14.086Z","dependency_job_id":null,"html_url":"https://github.com/8451/labrea","commit_stats":null,"previous_names":["8451/labrea"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8451%2Flabrea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8451%2Flabrea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8451%2Flabrea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/8451%2Flabrea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/8451","download_url":"https://codeload.github.com/8451/labrea/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246712782,"owners_count":20821790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T14:19:12.822Z","updated_at":"2025-07-07T18:35:24.744Z","avatar_url":"https://github.com/8451.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cpicture align=\"center\"\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/source/_static/labrea-logo-white.png\"\u003e\n  \u003cimg alt=\"Labrea Logo\" src=\"docs/source/_static/labrea-logo-black.png\"\u003e\n\u003c/picture\u003e\n\n-----------------\n\n# Labrea\nA framework for declarative, functional dataset definitions.\n\n![](https://img.shields.io/badge/version-2.1.2-blue.svg)\n[![lifecycle](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://www.tidyverse.org/lifecycle/#stable)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/labrea.svg?label=PyPI%20downloads)](https://pypi.org/project/labrea/)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Coverage](https://raw.githubusercontent.com/8451/labrea/meta/coverage/coverage.svg)](https://github.com/8451/labrea/tree/meta/coverage)\n[![docs](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://8451.github.io/labrea)\n\n## Installation\nLabrea is available for install via pip.\n\n```bash\npip install labrea\n````\n\nAlternatively, you can install the latest development version from GitHub.\n\n```bash\npip install git+https://github.com/8451/labrea@develop\n```\n\n## Usage\nSee our usage guide [here](docs/source/usage.md).\n\nLabrea exposes a `dataset` decorator that allows you to define datasets and their dependencies in a declarative manner.\nDependencies can either be other datasets or `Option`s, which are values that can be passed in at runtime via a\ndictionary.\n\n```python\nfrom labrea import dataset, Option\nimport pandas as pd\n\n\n@dataset\ndef stores(path: str = Option('PATHS.STORES')) -\u003e pd.DataFrame:\n    return pd.read_csv(path)\n\n\n@dataset\ndef transactions(path: str = Option('PATHS.SALES')) -\u003e pd.DataFrame:\n    return pd.read_csv(path)\n\n\n@dataset\ndef sales_by_region(\n        stores_: pd.DataFrame = stores,\n        transactions_: pd.DataFrame = transactions\n) -\u003e pd.DataFrame:\n    \"\"\"Merge stores to transactions, sum sales by region\"\"\"\n    return pd.merge(transactions_, stores_, on='store_id').groupby('region')['sales'].sum().reset_index()\n\n\noptions = {\n    'PATHS': {\n        'STORES': 'path/to/stores.csv',\n        'SALES': 'path/to/sales.csv'\n    }\n}\n\n\nstores(options)\n## +-----------------+-----------+\n## | store_id        | region    |\n## |-----------------+-----------|\n## | 1               | North     |\n## | 2               | North     |\n## | 3               | South     |\n## | 4               | South      |\n## +-----------------+-----------+\n\ntransactions(options)\n## +-----------------+-----------------+-----------------+\n## | store_id        | sales           | transaction_id  |\n## |-----------------+-----------------+-----------------|\n## | 1               | 100             | 1               |\n## | 2               | 200             | 2               |\n## | 3               | 300             | 3               |\n## | 4               | 400             | 4               |\n## +-----------------+-----------------+-----------------+\n\nsales_by_region(options)\n## +-----------------+-----------------+\n## | region          | sales           |\n## |-----------------+-----------------|\n## | North           | 300             |\n## | South           | 700             |\n## +-----------------+-----------------+\n```\n\n## Contributing\nIf you would like to contribute to **labrea**, please read the\n[Contributing Guide](docs/source/contributing.md).\n\n## Changelog\nA summary of recent updates to **labrea** can be found in the\n[Changelog](docs/source/changelog.md).\n\n## Maintainers\n\n| Maintainer                                                | Email                    |\n|-----------------------------------------------------------|--------------------------|\n| [Austin Warner](https://github.com/austinwarner-8451)     | austin.warner@8451.com   |\n| [Michael Stoepel](https://github.com/michaelstoepel-8451) | michael.stoepel@8451.com |\n\n## Links\n- Report a bug or request a feature: https://github.com/8451/labrea/issues/new/choose\n- Documentation: https://8451.github.io/labrea\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8451%2Flabrea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F8451%2Flabrea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F8451%2Flabrea/lists"}