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: add extra metadata files while building wheels #329

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

shubhbapna
Copy link
Collaborator

fixes #319

We will create a BUILD file in the .dist-info directory of the wheel. This file is of TOML format and contains the entire settings of the package by default. There is an option for the user to include more data in this file by defining a plugin.

Additionally, I added the build system, build backend and build sdist requirements file (hope is that we can use this later to speedup bootstrapping)

src/fromager/wheels.py Outdated Show resolved Hide resolved
src/fromager/wheels.py Show resolved Hide resolved
src/fromager/wheels.py Show resolved Hide resolved
tomlkit.dumps(ctx.settings.get_package_settings(req.name))
)
if data_to_add:
build_file.write_text(tomlkit.dumps(data_to_add))
Copy link
Member

Choose a reason for hiding this comment

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

Does this over-write the file, or append to it? Maybe what we really want to do is add the extra data from the plugin to the other settings as a key in the other dict. Something like custom-metadata-extensions? It's a long name, so something shorter that captures the meaning might be better.

Does TOML impose any restrictions on the syntax for keys? (no spaces, case-insensitive, etc.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

okay I can either add the custom metadata in some key or another option is that i make the settings data as the default function. If a plugin is specified then all the data is added only from there?

TOML does have some restrictions: https://github.com/toml-lang/toml/blob/main/toml.md#keys

Copy link
Member

Choose a reason for hiding this comment

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

How likely is it that data we are pulling from YAML or other places won't be compatible with TOML?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think the tomlkit handles it for us. It was able to successfully convert this yaml without an error:

packages:
  stevedore:
    download_source:
      url: https://files.pythonhosted.org/packages/e7/c1/b210bf1071c96ecfcd24c2eeb4c828a2a24bf74b38af13896d02203b1eec/stevedore-${version}.tar.gz
      destination_filename: stevedore-custom-${version}.tar.gz
    resolver_dist:
      sdist_server_url: "https://pypi.org/simple"
      include_sdist: false
      include_wheels: true
    changelog:
      "1.0.0 hahaha":
        - test hello world

src/fromager/wheels.py Outdated Show resolved Hide resolved
@mergify mergify bot merged commit 70c8af6 into python-wheel-build:main Aug 16, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add extra build-log metadata to wheel content
2 participants