Skip to content

Support opting out of strong inheritance vars #1324

@jrray

Description

@jrray

Our use case is how we have our python package inject an install requirement into downstream packages:

build:
  options:
  - var: abi/cp311
    choices:
    - cp311
    - cp311d
    inheritance: Strong
    description: The Python ABI flavor to use.

This helps prevent accidentally forgetting to add this to downstream packages in the general case but sometimes a package only uses python as a tool as part of the build script but has no runtime requirement on python.

What we lack is a way for those packages to prevent inheriting the var.

Attempting to declare the var in the downstream package doesn't work:

install:
  requirements:
    # block inheriting python.abi from python
    - var: python.abi/
ERROR   × Error: Cannot insert requirement: one already exists and only pkg requests can be merged: var: python.abi/ + var: python.abi/cp311

We could support this syntax but it is too easy to do something like this unintentionally. It would be more self-documenting to add a new attribute specifically for this opt-out purpose:

install:
  requirements:
    # block inheriting python.abi from python
    - var: python.abi
      suppress: "this package doesn't use python at runtime"

It could be a boolean field (or not care what the value is) but here I used the value position as a place to document why it is there.

Metadata

Metadata

Assignees

Labels

agenda itemItems to be brought up at the next dev meeting

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions