Skip to content

Conversation

behnazh-w
Copy link
Member

@behnazh-w behnazh-w commented Oct 8, 2025

Summary

This PR adds basic support for Python projects to the gen-build-spec feature in Macaron. It also introduces a new approach for generic specification generation.

Description of changes

  • Refactors gen-build-spec to first generate a base specification in JSON format.
  • Enables conversion from the generic JSON spec to other supported formats, such as Reproducible Central (rc-buildspec).
  • By default, the gen-build-spec command now outputs the specification in JSON; users can still specify rc-buildspec if they require the Reproducible Central format.
  • Adds initial support for Python, allowing the tool to generate build specifications for Python projects.
  • Adjusts and extends unit tests.

TODO

  • Add an integration test and compare script for the base build spec.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 8, 2025
@behnazh-w behnazh-w force-pushed the behnazh/python-build-support branch from bb8c99d to 81d6f60 Compare October 8, 2025 09:22
AbhinavPradeep
AbhinavPradeep previously approved these changes Oct 9, 2025
Copy link

@AbhinavPradeep AbhinavPradeep left a comment

Choose a reason for hiding this comment

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

I think I understand build_spec_generator parts, but would need to understand the database bit in the larger context in more detail. My understanding is like this: We have a BaseBuildSpecDict, which is a typed dictionary storing inferred build data. We define BaseBuildSpec as an abstract base class which requires the resolve_fields method. MavenBuildSpec and PyPIBuildSpec implement BaseBuildSpec and will have their custom logic which populates BaseBuildSpecDict. From reading through the code, the most important functions seem to be src/macaron/build_spec_generator/build_spec_generator.py#gen_build_spec_for_purl , inside where we get a "session" from which we can query build data that macaron has inferred (this is the bit I should understand better). This session is passed to src/macaron/build_spec_generator/core.py#gen_generic_build_spec alongside the purl and patches, which then populates the base BaseBuildSpecDict, before looking up the ecosystem and calling resolve_fields. Back in gen_build_spec_for_purl, format for the output is chosen between RC buildspec and JSON, and then the output file is written. Is this high level understanding correct? Will look into the details more now, but from my understanding of the high level design it looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants