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: Optional[str] property #

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

build_number: Optional[str] property #

The build number of the package.

channel: Optional[Channel] property #

The channel of the package.

file_name: Optional[str] property #

Match the specific filename of the package.

md5: Optional[bytes] property #

The md5 hash of the package.

namespace: Optional[str] property #

The namespace of the package.

sha256: Optional[bytes] property #

The sha256 hash of the package.

subdir: Optional[str] property #

The subdir of the channel.

version: Optional[str] property #

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

__init__(spec, strict=False) #

Create a new version spec.

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

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

__repr__() #

Returns a representation of the NamelessMatchSpec.

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

__str__() #

Returns a string representation of the NamelessMatchSpec.

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

from_match_spec(spec) classmethod #

Constructs a NamelessMatchSpec from a MatchSpec.

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

matches(package_record) #

Match a MatchSpec against a PackageRecord