Skip to content

PrefixPaths#

PrefixPathType #

directory: bool property #

This is a directory

Whether the path should be hardlinked (the default) (once installed)

pyc_file: bool property #

This is a file compiled from Python code when a noarch package was installed

Whether the path should be softlinked (once installed)

unix_python_entrypoint: bool property #

A Unix entry point python script (a Python script file)

windows_python_entrypoint_exe: bool property #

A Windows entry point python script (a .exe executable)

windows_python_entrypoint_script: bool property #

A Windows entry point python script (a -script.py Python script file)

__init__(path_type) #

Create a new PrefixPathType instance.

Parameters#

path_type : str The type of path. Must be one of: "hardlink", "softlink", "directory"

Examples#
>>> path_type = PrefixPathType("hardlink")
>>> path_type.hardlink
True
>>>

from_py_path_type(py_path_type) classmethod #

Construct Rattler PathType from FFI PyPathType object.

PrefixPaths #

paths: List[PrefixPathsEntry] property writable #

All entries included in the package.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> paths.paths # doctest:+ELLIPSIS
[...]
>>>

paths_version: int property writable #

The version of the file.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> paths.paths_version
1
>>>

__init__(paths_version=1) #

Create a new PrefixPaths instance.

Parameters#

paths_version : int, optional The version of the paths file format, by default 1

Examples#
>>> paths = PrefixPaths()
>>> paths.paths_version
1
>>>

__repr__() #

Returns a representation of the PrefixPaths.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> r.paths_data # doctest:+ELLIPSIS
PrefixPaths(paths=[...])
>>>

PrefixPathsEntry #

Bases: BasePathLike

file_mode: FileMode property writable #

The file mode of the path.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> file_mode = paths.paths[0].file_mode
>>>

Whether this file should be linked

>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> no_link = paths.paths[0].no_link
>>>

path_type: PrefixPathType property writable #

The type of the path.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> path_type = paths.paths[0].path_type
>>>

prefix_placeholder: str | None property writable #

The prefix placeholder for the path.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> prefix_placeholder = paths.paths[0].prefix_placeholder
>>>

relative_path: os.PathLike[str] property writable #

The relative path of the entry.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/tk-8.6.12-h8ffe710_0.json"
... )
>>> paths = r.paths_data
>>> relative_path = paths.paths[0].relative_path
>>>
...

sha256: bytes property writable #

The sha256 of the path.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> sha256 = paths.paths[0].sha256
>>>

sha256_in_prefix: bytes property writable #

The sha256 of the path in the prefix.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> sha256_in_prefix = paths.paths[0].sha256_in_prefix
>>>

size_in_bytes: int property writable #

The size of the path in bytes.

Examples#
>>> from rattler.prefix.prefix_record import PrefixRecord
>>> r = PrefixRecord.from_path(
...     "../test-data/conda-meta/requests-2.28.2-pyhd8ed1ab_0.json"
... )
>>> paths = r.paths_data
>>> size_in_bytes = paths.paths[0].size_in_bytes
>>>

__init__(relative_path, path_type, prefix_placeholder=None, file_mode=None, sha256=None, sha256_in_prefix=None, size_in_bytes=None, original_path=None) #

Create a new PrefixPathsEntry instance.

Parameters#

relative_path : os.PathLike[str] The relative path from the root of the package path_type : PrefixPathType Determines how to include the file when installing the package prefix_placeholder : Optional[str], optional The placeholder prefix used in the file, by default None file_mode : Optional[FileMode], optional The file mode of the path, by default None sha256 : Optional[bytes], optional The sha256 of the path, by default None sha256_in_prefix : Optional[bytes], optional The sha256 of the path in the prefix, by default None size_in_bytes : Optional[int], optional The size of the path in bytes, by default None original_path : Optional[os.PathLike[str]], optional The original path of the file, by default None