Skip to content
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

Refactor catalog generation output paths for single feedstock #61

Merged
merged 1 commit into from
Oct 25, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/catalog-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ jobs:
run: |
leap-catalog --help
leap-catalog validate --single https://github.com/leap-stc/proto_feedstock/blob/main/feedstock/catalog.yaml
leap-catalog generate --single https://github.com/carbonplan/ocean-carbon-sink-data-feedstock/blob/main/feedstock/catalog.yaml --output catalog/
cat catalog/output/consolidated-web-catalog.json | jq
leap-catalog generate --single https://github.com/carbonplan/ocean-carbon-sink-data-feedstock/blob/main/feedstock/catalog.yaml --output ./
cat ./output/single-feedstock-web-catalog.json | jq
9 changes: 7 additions & 2 deletions leap_data_management_utils/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,14 @@ def generate(args):
catalog = validate_feedstocks(feedstocks=feedstocks)
output = upath.UPath(args.output).resolve() / 'output'
output.mkdir(parents=True, exist_ok=True)
with open(f'{output}/consolidated-web-catalog.json', 'w') as f:
path = (
output / 'single-feedstock-web-catalog.json'
if args.single
else output / 'consolidated-web-catalog.json'
)
with open(path, 'w') as f:
json.dump(catalog, f, indent=2, default=pydantic_core.to_jsonable_python)
print(f'Catalog written to {output}/consolidated-web-catalog.json')
print(f'Catalog written to {path}')


def main():
Expand Down