API documentation¶
Configuration¶
- class enstaller.config.Configuration(**kw)[source]¶
-
- auth[source]¶
The auth object that may be passed to Session.authenticate
Returns: the auth instance, or None is configured. Return type: IAuth or None
- filename[source]¶
The filename this configuration was created from. May be None if the configuration was not created from a file.
- classmethod from_file(filename)[source]¶
Create a new Configuration instance from the given file.
- filename: str or file-like object
- If a string, is understood as a filename to open. Understood as a file-like object otherwise.
- indexed_repositories[source]¶
List of (old-style) repositories. Only actually used when use_webservice is False.
- indices[source]¶
Returns a list of pair (index_url, store_location) for this given configuration.
Takes into account webservice/no webservice and pypi True/False
- max_retries[source]¶
Max attempts to retry an http connection or re-fetching data whose checksum failed.
- proxy_dict[source]¶
A dictionary <scheme>:<proxy_string> that can be used as the proxies argument for requests.
Repository¶
- class enstaller.repository.Repository(packages=None)[source]¶
A Repository is a set of package, and knows about which package it contains.
- delete_package(package_metadata)[source]¶
Remove the given package.
Removing a non-existent package is an error.
Parameters: package_metadata (PackageMetadata) – The package to remove
- find_latest_package(name)[source]¶
Returns the latest package with the given name.
Parameters: name (str) – The package’s name Returns: package (PackageMetadata)
- find_package(name, version)[source]¶
Search for the first match of a package with the given name and version.
Parameters: - name (str) – The package name to look for.
- version (str) – The full version string to look for (e.g. ‘1.8.0-1’).
Returns: package (RepositoryPackageMetadata) – The corresponding metadata.
- find_package_from_requirement(requirement)[source]¶
Search for latest package matching the given requirement.
Parameters: requirement (Requirement) – The requirement to match for. Returns: package (RepositoryPackageMetadata) – The corresponding metadata.
- find_packages(name, version=None)[source]¶
Returns a list of package metadata with the given name and version
Parameters: - name (str) – The package’s name
- version (str or None) – If not None, the version to look for
Returns: packages (iterable) – Iterable of RepositoryPackageMetadata-like (order is unspecified)
- find_sorted_packages(name)[source]¶
Returns a list of package metadata with the given name and version, sorted from lowest to highest version (when possible).
Parameters: name (str) – The package’s name Returns: packages (iterable) – Iterable of RepositoryPackageMetadata.
- has_package(package_metadata)[source]¶
Returns True if the given package is available in this repository
Parameters: package_metadata (PackageMetadata) – The package to look for. Returns: ret (bool) – True if the package is in the repository, false otherwise.
Session¶
- class enstaller.session.Session(authenticator, cache_directory, proxies=None, verify=True, max_retries=0)[source]¶
Simple class to handle http session management
It also ensures connection settings such as proxy, SSL CA certification, etc... are handled consistently).
Parameters
- authenticator : IAuthManager
- An authenticator instance
- cache_directory : str
- A writeable directory to cache data and eggs.
- proxies : dict
- A proxy dict as expected by requests (and provided by Configuration.proxy_dict).
- verify : bool
- If True, SSL CA are verified (default).
- classmethod authenticated_from_configuration(configuration)[source]¶
Create a new authenticated session from a configuration.
Parameters: configuration (Configuration) – The configuration to use.