Python package rules and candidate selection for nab
Actively maintained. Last release 6 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install nab-providernab-provider
Apply Python packaging rules during dependency resolution. This package supplies candidate versions
and their dependency constraints to nab-resolver,
including environment markers and build, distribution, and VCS policies.
It performs no networking, file access, or subprocess calls.
Package listings and metadata arrive through nab_provider.fetch_port.FetchPort, an interface
implemented by the application using the provider. That application is called the host;
nab-project supplies it for the nab CLI. nab_provider.testing supplies an in-memory
implementation for tests.
When to use it
Use nab-provider to embed nab's resolution in a host that already owns its networking and caching,
keeping nab-index out of the import graph. Most users want
nab instead.
Use nab_provider.ranges.VersionRange for root constraints and as the resolver's range_type. Pass
root_version="0" and format_range=provider.format_range when constructing the resolver.
The API is experimental. Pin an exact version when embedding it.
Wheel tags
wheel_tag_set(filename) caches repeated filename queries. parse_wheel_tag_set(filename) shares
parsing by tag suffix for bulk listings.
Value records
Nab's record constructors declare their fields explicitly. nab_provider.value shares value
comparison and copying across the provider, index and project layers. Fixed fields use Final
annotations; assignment is not checked at runtime. replace() calls the concrete constructor,
including validation and derived fields:
from nab_provider.tags import PlatformSpec
from nab_provider.value import replace
platform = PlatformSpec("linux_x86_64")
platform = replace(platform, runs_on_libc=(2, 28))