python-wheel-build / fromager

Build your own wheels
https://pypi.org/project/fromager/
Apache License 2.0
3 stars 9 forks source link

configuration options to control rust vendoring #224

Open dhellmann opened 1 month ago

dhellmann commented 1 month ago

We need some options to control how we vendor rust code, because some packages have bad settings that don't let us vendor properly.

We could have a broad on/off switch, per package.

We could have a set of exclusion rules, using glob or other pattern syntax to match paths or filenames.

Other ideas?

shubhbapna commented 1 month ago

We could have a broad on/off switch, per package.

This should be easy tom implement. Something like:

packages:
    numpy:
        vendor_rust: false

and then in sources.py we can add a simple if check https://github.com/python-wheel-build/fromager/blob/main/src/fromager/sources.py#L341:

def _default_prepare_source(
    ctx: context.WorkContext,
    req: Requirement,
    source_filename: pathlib.Path,
    version: Version,
) -> pathlib.Path:
    source_root_dir, is_new = unpack_source(ctx, source_filename)
    if is_new:
        patch_source(ctx, source_root_dir)
        if ctx.settings.vendor_rust(req.name):
             vendor_rust.vendor_rust(req, source_root_dir)
    return source_root_dir
shubhbapna commented 1 month ago

We could have a set of exclusion rules, using glob or other pattern syntax to match paths or filenames.

I am not exactly sure how this would work? Would we add just remove paths that we get here: https://github.com/python-wheel-build/fromager/issues/224#issue-2425158720 if they match the exclusion rules?

dhellmann commented 1 month ago

We could have a set of exclusion rules, using glob or other pattern syntax to match paths or filenames.

I am not exactly sure how this would work? Would we add just remove paths that we get here: #224 (comment) if they match the exclusion rules?

I should have linked to #223 as an example.