Skip to content

NamelessMatchSpec#

NamelessMatchSpec #

Similar to a MatchSpec but does not include the package name. This is useful in places where the package name is already known (e.g. foo = "3.4.1 *cuda").

build property #

build

The build string of the package (e.g. py37_0, py37h6de7cb9_0, py*)

build_number property #

build_number

The build number of the package.

channel property #

channel

The channel of the package.

condition property #

condition

The condition under which this match spec applies.

extras property #

extras

The extras (optional dependencies) of the package.

file_name property #

file_name

Match the specific filename of the package.

md5 property #

md5

The md5 hash of the package.

namespace property #

namespace

The namespace of the package.

sha256 property #

sha256

The sha256 hash of the package.

subdir property #

subdir

The subdir of the channel.

version property #

version

The version spec of the package (e.g. 1.2.3, >=1.2.3, 1.2.*)

__init__ #

__init__(
    spec,
    strict=False,
    experimental_extras=False,
    experimental_conditionals=False,
)

Create a new version spec.

When strict is True, some ambiguous version specs are rejected.

When experimental_extras is True, extras syntax is enabled (e.g., [extras=[foo,bar]]).

When experimental_conditionals is True, conditionals syntax is enabled (e.g., >=1.0; if python >=3.6).

>>> NamelessMatchSpec(">=24.0")
NamelessMatchSpec(">=24.0")
>>> NamelessMatchSpec("24")
NamelessMatchSpec("==24")
>>>

__repr__ #

__repr__()

Returns a representation of the NamelessMatchSpec.

Examples#
>>> NamelessMatchSpec("3.4")
NamelessMatchSpec("==3.4")
>>>

__str__ #

__str__()

Returns a string representation of the NamelessMatchSpec.

Examples#
>>> str(NamelessMatchSpec("3.4"))
'==3.4'
>>>

from_match_spec classmethod #

from_match_spec(spec)

Constructs a NamelessMatchSpec from a MatchSpec.

Examples#
>>> from rattler import MatchSpec
>>> NamelessMatchSpec.from_match_spec(MatchSpec("foo ==3.4"))
NamelessMatchSpec("==3.4")
>>>

matches #

matches(package_record)

Match a MatchSpec against a PackageRecord