pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/adobe-type-tools/skbuild_conditional_scripts

ous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-b55097560d244c08.css" /> GitHub - adobe-type-tools/skbuild_conditional_scripts: Conditional entry point script provider for scikit-build-core · GitHub
Skip to content

adobe-type-tools/skbuild_conditional_scripts

Repository files navigation

skbuild-conditional-scripts

License Python

Generic dynamic script metadata provider for scikit-build-core projects.

This micro-package provides a reusable metadata provider that can conditionally install entry point scripts based on environment variables. Originally developed for AFDKO to choose between installing a C++ binary or Python wrapper, it can be used by any scikit-build-core project that needs conditional entry point generation.

Features

  • Data-driven: All script definitions live in pyproject.toml, not code
  • Conditional installation: Install different scripts based on environment variables
  • Generic: Can be reused by other projects with similar needs
  • Simple: ~70 lines of code, easy to understand and maintain

Installation

pip install skbuild-conditional-scripts

Or include in your project locally using provider-path.

Quick Start

Add to your pyproject.toml:

[build-system]
requires = ["scikit-build-core", "skbuild-conditional-scripts"]
build-backend = "scikit_build_core.build"

[tool.scikit-build.metadata.scripts]
provider = "skbuild_conditional_scripts"

# Always installed scripts
scripts = {
    "my-command" = "mypackage:main",
    "my-tool" = "mypackage.tools:cli",
}

# Conditionally installed scripts (only when MY_ENV_VAR=ON)
conditional-scripts = {
    "my-debug-tool" = "mypackage.debug:main",
}

condition-env-var = "MY_ENV_VAR"
condition-env-value = "ON"

Then build your project:

# Normal build - only base scripts installed
pip install .

# With condition - both base and conditional scripts installed
MY_ENV_VAR=ON pip install .

Use Cases

  • Binary vs Python wrapper: Install C++ binary or Python wrapper based on build configuration
  • Platform-specific commands: Different entry points for different platforms (via env vars)
  • Debug builds: Install additional debug tools only when requested
  • Optional features: Install extra commands when feature flags are enabled

How It Works

The provider is called during the metadata generation phase (before building). It:

  1. Reads configuration from [tool.scikit-build.metadata.scripts]
  2. Checks the specified environment variable
  3. Merges base scripts with conditional scripts if the condition matches
  4. Returns the combined dictionary to scikit-build-core

Note: This is a build-time tool. End users installing from PyPI wheels don't need it.

Documentation

Example: AFDKO

AFDKO uses this provider to choose between a C++ binary and Python wrapper:

[tool.scikit-build.metadata.scripts]
provider = "skbuild_conditional_scripts"

scripts = {
    # 30+ deprecated wrapper scripts always installed
    "tx" = "afdko._deprecated:tx_wrapper",
    "makeotf" = "afdko._deprecated:makeotf_wrapper",
    # ... etc
}

conditional-scripts = {
    # Python wrapper only when requested
    "afdko" = "afdko.invoker:main"
}

condition-env-var = "AFDKO_COMMAND_USE_WRAPPER"
condition-env-value = "ON"

Normal builds install the fast C++ binary. When building in environments where the C++ build fails, setting AFDKO_COMMAND_USE_WRAPPER=ON installs the Python wrapper instead.

Requirements

  • Python >= 3.10
  • scikit-build-core (as your build backend)

License

Apache License 2.0 - See LICENSE for details.

Support

This project is maintained by the Adobe Type team.

Related Projects

About

Conditional entry point script provider for scikit-build-core

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy