Skip to content

IndexJson#

IndexJson #

arch property writable #

arch

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 property writable #

build

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 property writable #

build_number

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 property writable #

constrains

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 property writable #

depends

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 property writable #

features

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 property writable #

license

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 property writable #

license_family

Optionally, the license.

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

name property writable #

name

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")
>>> idx_json.name = PackageName("rattler")
>>> idx_json.name
PackageName("rattler")
>>>

platform property writable #

platform

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 property writable #

subdir

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 property writable #

timestamp

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)
>>> idx_json.timestamp = datetime.datetime(2021, 1, 1, 1, 1, 1, 50000, tzinfo=datetime.timezone.utc)
>>> idx_json.timestamp
datetime.datetime(2021, 1, 1, 1, 1, 1, 50000, tzinfo=datetime.timezone.utc)
>>>

track_features property writable #

track_features

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
[]
>>>

version property writable #

version

The version of the package.

Examples#
>>> idx_json = IndexJson.from_path(
...     "../test-data/conda-22.11.1-py38haa244fe_1-index.json"
... )
>>> idx_json.version
VersionWithSource(version="22.11.1", source="22.11.1")
>>> idx_json.version = VersionWithSource("1.02.3")
>>> idx_json.version
VersionWithSource(version="1.2.3", source="1.02.3")
>>>

__repr__ #

__repr__()

Returns a representation of the IndexJson.

from_package_archive staticmethod #

from_package_archive(path)

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 staticmethod #

from_package_directory(path)

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 staticmethod #

from_path(path)

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 staticmethod #

from_str(string)

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 #

package_path()

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.