Skip to content

Create a CIBW_ALLOW_EMPTY environment variable for --allow-empty #1922

@ConorMacBride

Description

@ConorMacBride

Description

Would it be possible to enable the CLI flag --allow-empty via an environment variable (e.g., CIBW_ALLOW_EMPTY)?

Here's our use case:

I'm thinking we could compute its value similarly to how CIBW_PRERELEASE_PYTHONS is handled:

prerelease_pythons = args.prerelease_pythons or strtobool(
self.env.get("CIBW_PRERELEASE_PYTHONS", "0")
)

This could be integrated within options.compute_options and added to options.GlobalOptions:

@dataclasses.dataclass(frozen=True)
class GlobalOptions:
package_dir: Path
output_dir: Path
build_selector: BuildSelector
test_selector: TestSelector
architectures: set[Architecture]

Alternatively, CIBW_ALLOW_EMPTY could be checked directly within __main__.py:

if args.allow_empty:
print(f"cibuildwheel: {message}", file=sys.stderr)

I'm happy to open a PR if you think a new environment variable would be appropriate for this option. Thanks!

Build log

No response

CI config

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions