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

feat: metadata will render recipe with context #41

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

nichmor
Copy link
Collaborator

@nichmor nichmor commented Aug 2, 2024

This PR aims to give Metadata ability to render recipe using context values.

It will be used by conda-smithy to ask metadata.name() and metadata.version()

Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

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

Does this reflect the same API that CondaMetaData has? Or would you access the name and version differently?

name = _get_recipe_metadata(self.meta, "name")

if not name:
sys.exit(f"Error: package/name missing in: {self.meta_path!r}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please just raise and let the user determine whether or not the application should exit or not!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This wasn't my implementation - I tried to reuse the same approach as conda_build does - so I decided to not move from sys.exit. Let me know if you think that it's worth to change it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed.

version = _get_recipe_metadata(self.meta, "version")

if not version:
sys.exit(f"Error: package/version missing in: {self.meta_path!r}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

^ same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

src/rattler_build_conda_compat/render.py Show resolved Hide resolved
@nichmor
Copy link
Collaborator Author

nichmor commented Aug 2, 2024

Does this reflect the same API that CondaMetaData has? Or would you access the name and version differently?

it's the same API - I just override it because we extract them from recipe/package depending on outputs field

@nichmor nichmor requested a review from baszalmstra August 2, 2024 09:07
src/rattler_build_conda_compat/render.py Outdated Show resolved Hide resolved
@nichmor nichmor merged commit 2dba8d5 into prefix-dev:main Aug 2, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants