frankier / gerb

Override dependencies in Python wheels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GERB: Override dependencies in Python wheels

GERB downloads Python wheels, overrides dependency information in them, and store the overriden artifacts in a specified directory (aka "wheelhouse"). Those wheels can then be installed with:

pip install --find-links=<wheelhouse-path> ...

Specification

Specify packages to override in a TOML file named gerb.toml:

[gerb]
# Relative to the directory containing gerb.toml.
wheelhouse = "./wheelhouse"
# Specify alternative PEP 503 repository URLs to use.
# This is the default value.
repositories = ["https://pypi.org/simple"]
# Wheels generated by GERB use this as the "local version" to
# distinguish themselves from the publicly-available ones.
# Change this version when you update the override information.
# Read more about local versions in PEP 440.
override-version = "1"

[[gerb.packages]]
requirement = "pkg-a ==1.0.0"

[gerb.package.override-dependencies]
dep-a = "~=3.0"  # Override dep-a to use this.
dep-b = "@ https://example.com/dep-b.zip ; os_name != 'nt'"
# Key and value are joined as a PEP 508 requirement string,
# so you can use markers and URL specs freely.

[[gerb.packages]]
requirement = "pkg-b ~=2.1.0,!=2.1.3"
remove-dependencies = ["dep-a"]  # Remove this dependency.
# By default, all wheels will be fetched. These can be used to
# filter. Valid keys are "python", "abi", and "platform".
# Read more about tags in PEP 427.
include-tags = [{python = "cp36", abi = "cp36m"}]
exclude-tags = [{platform = "win32"}]

[[gerb.packages]]
requirement = "pkg-c ==3.0.1"
# If "override-dependencies" is an array (instead of a table),
# its content overrides the dependency list entirely.
override-dependencies = [
    "dep-x ==1.0.2",
    "dep-y ==2.0.0",
]

Invocation

This creates the wheelhouse in the default directory:

gerb

Configurations wheelhouse and repositories can be overriden:

gerb --wheelhouse=/path/to/my/global/wheelhouse
     --repository=https://example.com/simple
     --repository=https://my-domain.dev/python/simple

About

Override dependencies in Python wheels


Languages

Language:Python 100.0%