generated from seedcase-project/template-python-package
-
Couldn't load subscription status.
- Fork 0
refactor: ♻️ match Sprout #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9cd2630
build: :wrench: update Sprout version
martonvago d9e9120
feat: :sparkles: add main.py file
martonvago ef88b22
build: :wrench: specify latest Sprout version
martonvago 560fc1b
build: :wrench: add Sprout from pypi
martonvago 65c5734
feat: :sparkles: add properties.py with init
martonvago 0bf1d10
feat: :sparkles: fill in main.py based on guides
martonvago db1fb76
docs: :memo: add docstring in init file
martonvago 80e21d7
docs: :memo: update README
martonvago 9197b5a
docs: :pencil2: suggestions from review
lwjohnst86 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(): | ||
| """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() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Processing and build pipeline scripts.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| ) |
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.