The hatcher.core package¶
Contents
hatcher.core.brood_client module¶
-
class
hatcher.core.brood_client.BroodClient(url_handler, api_version=0)¶ Bases:
objectBroodClientis the top level entry point into thehatcherAPI.-
create_api_token(name)¶ Create a new API token for the current user.
Parameters: name (str) – The name for the new token. Returns: token (dict) – Dict containing the token and its name.
-
create_organization(name, description)¶ Create a new organization called
namewith the descriptiondescription.Parameters: Returns
Organization
-
delete_api_token(name)¶ Delete the user’s named API token.
Parameters: name (str) – The name of the token to delete.
-
classmethod
from_session(url, session, api_version=0)¶ Create a
BroodClientfrom a Brood URL and pre-configuredrequests.Sessioninstance.
-
classmethod
from_url(url, auth=None, verify_ssl=True, api_version=0)¶ Create a
BroodClientfrom a Brood URL and authentication information.
-
list_api_tokens()¶ List the metadata of user’s API tokens.
Note
This does not list the actual token that can be used for authentication, just the metadata
name,createdandlast_used.Returns: tokens (list) – List of metadata for all of the user’s active tokens.
-
list_available_repositories()¶
-
list_organizations()¶ List all organizations in the brood server.
-
list_platforms()¶ List all platforms supported by the Brood server.
Returns: platforms (list) – List of platform names.
List PEP425 Python Tags supported by the Brood server.
Parameters: list_all (bool) – If False(default), will only list the tags that correspond to an actual Python implementation and version. IfTrue, list all possible tags.Returns: tags (list) – List of Python tags.
-
organization(name)¶ Get an existing organization.
Parameters: name (str) – The name of the organization. Returns
Organization
-
hatcher.core.brood_url_handler module¶
-
class
hatcher.core.brood_url_handler.BroodURLHandler(url, session)¶ Bases:
objectLow level handling of the interface between the Hatcher API and the Brood API.
-
api_root= '/api/v0/json'¶
-
delete(path, force=False)¶ Issue a DELETE request for the object referenced by
path.Parameters:
-
download_file(path, destination_directory, expected_sha256, filename=None)¶ Download the file specified by
pathand save it in thedestination_directory.Parameters: - path (str) – The resource path to use in the URL
- destination_directory (str) – The directory in which to save the downloaded file.
- expected_sha256 (str) – The expected SHA256 sum of the downloaded file.
- filename (str) – Optional name for the file being saved. If it is not
provided, the filename specified in the
Content-Dispositionheader of the response will be used.
-
classmethod
from_auth(url, auth=None, verify_ssl=True)¶ Create a BroodURLHandler from authentication information.
Parameters:
-
classmethod
from_session(url, session)¶ Create a BroodURLHandler from a pre-configured
requests.Session.Parameters: - url (str) – The root URL of a brood server in the form <scheme>://<host>
- session (requests.Session) – The configured Session to use for connected to the server.
-
get(path)¶ Issue a GET request to the given
path.Parameters: path (str) – The resource path to use in the URL
-
get_json(path)¶ Get the JOSN payload at
path.Parameters: path (str) – The resource path to use in the URL
-
iter_download(path, destination_directory, expected_sha256, filename=None)¶ Download the file specified by
pathand save it in thedestination_directory.This method returns a tuple of (content_length, iterator). The
content_lengthis the total size of the download. Theiteratoryields the size of each chunk as it is downloaded.Parameters: - path (str) – The resource path to use in the URL
- destination_directory (str) – The directory in which to save the downloaded file.
- expected_sha256 (str) – The expected SHA256 sum of the downloaded file.
- filename (str) – Optional name for the file being saved. If it is not
provided, the filename specified in the
Content-Dispositionheader of the response will be used.
-
post(path, data)¶ Issue a POST request to the given
pathcontaining the given jsondata.Parameters:
-
put(path, data=None)¶ Issue a PUT request to the given
pathcontaining the given jsondata.Parameters:
-
upload(path, data, filename, overwrite=False, enabled=None)¶ Issue a POST request to the given
pathcontaining the given jsondataand a file..Parameters: - path (str) – The resource path to use in the URL
- data (dict) – A dictionary of metadata to be passed as JSON-encoded data to the request.
- filename (str) – Path to the file to upload.
- overwrite (bool) – Overwrite an existing artefact specified by the same metadata.
- enabled (bool) – Only valid for egg uploads. If
False, egg will not be indexed on upload.
-
hatcher.core.organization module¶
-
class
hatcher.core.organization.Organization(name, url_handler)¶ Bases:
hatcher.core.v0.organization.Organization
hatcher.core.repository module¶
-
class
hatcher.core.repository.Repository(organization_name, name, url_handler)¶ Bases:
hatcher.core.v0.repository.Repository
-
class
hatcher.core.repository.SinglePlatformRepository(repository, platform, url_handler)¶ Bases:
hatcher.core.v0.repository.SinglePlatformRepository
hatcher.core.team module¶
-
class
hatcher.core.team.Team(organization_name, name, url_handler)¶ Bases:
hatcher.core.v0.team.Team
hatcher.core.utils module¶
-
class
hatcher.core.utils.AppSorter(name, version, python_tag)¶ Bases:
hatcher.core.utils._SorterMixin
-
class
hatcher.core.utils.EggMetadata(metadata, path)¶ Bases:
object-
classmethod
from_file(path)¶
-
full_version¶
-
name¶
-
python_tag¶
-
sha256¶
-
classmethod
-
class
hatcher.core.utils.EggNameSorter(egg_file_name)¶ Bases:
hatcher.core.utils._SorterMixin
-
class
hatcher.core.utils.NameVersionPairSorter(name, version, version_parser=<class 'okonomiyaki.versions.pep440.PEP440Version'>)¶ Bases:
hatcher.core.utils._SorterMixin
-
class
hatcher.core.utils.RuntimeMetadata(*args, **kwargs)¶
-
class
hatcher.core.utils.RuntimeMetadataV0(language, version, build, platform, build_system_version, file_format, path)¶ Bases:
object-
filename¶
-
classmethod
from_file(path, platform=None)¶
-
full_version¶
-
python_tag¶
-
sha256¶
-
-
class
hatcher.core.utils.RuntimeMetadataV1(path, metadata)¶ Bases:
object-
classmethod
from_file(path)¶
-
implementation¶
-
platform¶
-
sha256¶
-
version¶
-
classmethod
-
class
hatcher.core.utils.RuntimeV0Sorter(filename)¶ Bases:
hatcher.core.utils.AppSorter
-
hatcher.core.utils.compute_md5(filename, block_size=16384)¶
-
hatcher.core.utils.compute_sha256(filename, block_size=16384)¶
-
hatcher.core.utils.hatcher_user_agent()¶
-
hatcher.core.utils.python_tag_name(tag)¶