Skip to content
Merged
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
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ gh repo create NAME --template seedcase-project/template-data-package

To add uv:

1. Delete the `pyproject.toml` file.
2. In the terminal run `uv init`.
3. Look at the Git pane and take what was removed and move it over into
1. Delete the `pyproject.toml` file.
2. In the terminal run `uv init`.
3. Look at the Git pane and take what was removed and move it over into
the new `pyproject.toml` file. You can mimic what was done in
`example-seed-beetle` repo.

Then, in the terminal, run:

``` bash
uv add polars pyjanitor
uv add "seedcase-sprout @ git+<https://github.com/seedcase-project/seedcase-sprout>"
uv add polars pyjanitor seedcase-sprout
uv add --dev ruff commitizen pre-commit typos
```

Expand Down
3 changes: 0 additions & 3 deletions data-raw/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions data-raw/downloaded/.gitignore

This file was deleted.

62 changes: 62 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# import polars as pl
import seedcase_sprout as sp

from scripts.properties import properties

# from scripts.resource_properties import resource_properties


def main():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be the full script. You can't just uncomment and run everything at once because required properties need to be filled in, scripts/resource_properties.py needs to be created, etc.

"""Run the build pipeline of the data package."""
## PROPERTIES

## Create the properties script in default location if it doesn't already exist.
package_path = sp.PackagePath()
sp.create_properties_script()

## Load your raw, but tidy, data into a Polars DataFrame.
# raw_data = pl.read_csv(package_path.root() / "raw" / "data.csv")
## Extract field properties from the data.
# field_properties = sp.extract_field_properties(data=raw_data)

## Create the resource properties script if it doesn't already exist.
# sp.create_resource_properties_script(
# resource_name="",
# fields=field_properties,
# )

## Save the properties to `datapackage.json`.
sp.write_properties(properties=properties)

## README

## Create the README text for the data package.
readme_text = sp.as_readme_text(properties)
## Write the README text to a `README.md` file.
sp.write_file(readme_text, package_path.readme())

## BATCH DATA

## Save the batch data.
# sp.write_resource_batch(
# data=raw_data, resource_properties=resource_properties
# )

## RESOURCE DATA

## Read in all the batch data files for the resource as a list.
# batch_data = sp.read_resource_batches(
# resource_properties=resource_properties
# )
## Join them all together into a single Polars DataFrame.
# joined_data = sp.join_resource_batches(
# data_list=batch_data, resource_properties=resource_properties
# )
## Write the resource data file.
# sp.write_resource_data(
# data=joined_data, resource_properties=resource_properties
# )


if __name__ == "__main__":
main()
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires-python = ">=3.12"
dependencies = [
"polars>=1.27.0",
"pyjanitor>=0.31.0",
"seedcase-sprout",
"seedcase-sprout>=0.46.3",
]

[project.urls]
Expand All @@ -31,6 +31,3 @@ dev = [
"ruff>=0.11.4",
"typos>=1.32.0",
]

[tool.uv.sources]
seedcase-sprout = { git = "https://github.com/seedcase-project/seedcase-sprout" }
1 change: 1 addition & 0 deletions scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Processing and build pipeline scripts."""
53 changes: 53 additions & 0 deletions scripts/properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import seedcase_sprout as sp

# from .resource_properties import resource_properties

properties = sp.PackageProperties(
## Required:
name="template-data-package",
title="",
description="",
licenses=[
sp.LicenseProperties(
## Required:
name="",
## Optional:
# path="",
# title="",
),
],
## Optional:
# homepage="",
# contributors=[
# sp.ContributorProperties(
# ## Required:
# title="",
# ## Optional:
# path="",
# email="",
# given_name="",
# family_name="",
# organization="",
# roles=[""],
# ),
# ],
# keywords=[""],
# image="",
# sources=[
# sp.SourceProperties(
# ## Required:
# title="",
# ## Optional:
# path="",
# email="",
# version="",
# ),
# ],
# resources=[
# resource_properties,
# ],
## Autogenerated:
id="108e33ad-33f9-414f-a93c-bfed390be4e6",
version="0.1.0",
created="2025-07-04T15:17:28+01:00",
)
964 changes: 243 additions & 721 deletions uv.lock

Large diffs are not rendered by default.