Skip to content

IndexJson#

IndexJson #

arch: Optional[str] property #

Optionally, the architecture the package is build for.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.arch
'x86_64'
>>>

build: str property #

The build string of the package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.build
'py38haa244fe_1'
>>>

build_number: int property #

The build number of the package. This is also included in the build string.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.build_number
1
>>>

constrains: List[str] property #

The package constraints of the package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.constrains # doctest: +ELLIPSIS
['conda-content-trust >=0.1.1', ..., 'conda-env >=2.6', 'conda-build >=3']
>>>

depends: List[str] property #

The dependencies of the package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.depends # doctest: +ELLIPSIS
['conda-package-handling >=1.3.0', ..., 'tqdm >=4']
>>>

features: Optional[str] property #

Features are a deprecated way to specify different feature sets for the conda solver. This is not supported anymore and should not be used. Instead, mutex packages should be used to specify mutually exclusive features.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.features
>>>

license: Optional[str] property #

Optionally, the license.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.license
'BSD-3-Clause'
>>>

license_family: Optional[str] property #

Optionally, the license.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.license_family
>>>

name: PackageName property #

The lowercase name of the package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.name
PackageName("conda")
>>>

platform: Optional[str] property #

Optionally, the OS the package is build for.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.platform
'win'
>>>

subdir: Optional[str] property #

The subdirectory that contains this package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.subdir
'win-64'
>>>

timestamp: Optional[datetime.datetime] property #

The timestamp when this package was created

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.timestamp
datetime.datetime(2022, 12, 7, 23, 45, 42, 50000, tzinfo=datetime.timezone.utc)
>>>

track_features: List[str] property #

Track features are nowadays only used to downweight packages (ie. give them less priority). To that effect, the number of track features is counted (number of commas) and the package is downweighted by the number of track_features.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.track_features
[]
>>>

__repr__() #

Returns a representation of the IndexJson.

from_package_archive(path) staticmethod #

Parses the package file from archive. Note: If you want to extract multiple info/* files then this will be slightly slower than manually iterating over the archive entries with custom logic as this skips over the rest of the archive

from_package_directory(path) staticmethod #

Parses the object by looking up the appropriate file from the root of the specified Conda archive directory, using a format appropriate for the file type.

For example, if the file is in JSON format, this function reads the appropriate file from the archive, parse the JSON string and return the resulting object. If the file is not in a parsable format or if the file could not be read, this function returns an error.

from_path(path) staticmethod #

Parses an index.json file pointed to by the path.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json
IndexJson()
>>>

from_str(string) staticmethod #

Parses the object from a string, using a format appropriate for the file type.

For example, if the file is in JSON format, this function parses the JSON string and returns the resulting object. If the file is not in a parsable format, this function returns an error.

package_path() staticmethod #

Returns the path to the file within the Conda archive.

The path is relative to the root of the archive and includes any necessary directories.