Proxies

User interface is separated among multiple proxy classes such as ProjectProxy, BuildProxy, etc, which provide API operations on given resource.

There are several methods available across majority (there are some corner cases where it wouldn’t make sense) of proxies. Naturally, all methods (e.g. auth_check) from BaseProxy are available everywhere. Moreover, proxies implement get method to get one specific object and get_list to get multiple objects that meet some criteria (e.g. all successful builds from a project). When it makes sense, proxies also implement an edit method that modifies an object. Exception for this is for example, a BuildProxy because it shouldn’t be possible to change a build. Similarly, most of the proxies have a delete method except for e.g. BuildChrootProxy.

Base

class copr.v3.proxies.BaseProxy(config)[source]

Parent class for all other proxies

home()[source]

Call the Copr APIv3 base URL

Returns:Munch
auth_check()[source]

Call an endpoint protected by login to check whether the user auth key is valid

Returns:Munch

Project

class copr.v3.proxies.project.ProjectProxy(config)[source]
get(ownername, projectname)[source]

Return a project

Parameters:
  • ownername (str) –
  • projectname (str) –
Returns:

Munch

get_list(ownername, pagination=None)[source]

Return a list of projects

Parameters:
  • ownername (str) –
  • pagination
Returns:

Munch

search(query, pagination=None)[source]

Return a list of projects based on fulltext search

Parameters:
  • query (str) –
  • pagination
Returns:

Munch

add(ownername, projectname, chroots, description=None, instructions=None, homepage=None, contact=None, additional_repos=None, unlisted_on_hp=False, enable_net=True, persistent=False, auto_prune=True, use_bootstrap_container=False, devel_mode=False)[source]

Create a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • chroots (list) –
  • description (str) –
  • instructions (str) –
  • homepage (str) –
  • contact (str) –
  • additional_repos (list) –
  • unlisted_on_hp (bool) – project will not be shown on Copr homepage
  • enable_net (bool) – if builder can access net for builds in this project
  • persistent (bool) – if builds and the project are undeletable
  • auto_prune (bool) – if backend auto-deletion script should be run for the project
  • use_bootstrap_container (bool) – if mock bootstrap container is used to initialize the buildroot
  • devel_mode (bool) – if createrepo should run automatically
Returns:

Munch

edit(ownername, projectname, chroots=None, description=None, instructions=None, homepage=None, contact=None, additional_repos=None, unlisted_on_hp=None, enable_net=None, auto_prune=None, use_bootstrap_container=None)[source]

Edit a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • chroots (list) –
  • description (str) –
  • instructions (str) –
  • homepage (str) –
  • contact (str) –
  • repos (list) –
  • unlisted_on_hp (bool) – project will not be shown on Copr homepage
  • enable_net (bool) – if builder can access net for builds in this project
  • auto_prune (bool) – if backend auto-deletion script should be run for the project
  • use_bootstrap_container (bool) – if mock bootstrap container is used to initialize the buildroot
Returns:

Munch

delete(ownername, projectname)[source]

Delete a project

Parameters:
  • ownername (str) –
  • projectname (str) –
Returns:

Munch

fork(ownername, projectname, dstownername, dstprojectname, confirm=False)[source]

Fork a project

Parameters:
  • ownername (str) – owner of a source project
  • projectname (str) – name of a source project
  • dstownername (str) – owner of a destination project
  • dstprojectname (str) – name of a destination project
  • confirm (bool) – if forking into a existing project, this needs to be set to True, to confirm that user is aware of that
Returns:

Munch

Build

class copr.v3.proxies.build.BuildProxy(config)[source]
get(build_id)[source]

Return a build

Parameters:build_id (int) –
Returns:Munch
get_source_chroot(build_id)[source]

Return a source build

Parameters:build_id (int) –
Returns:Munch
get_source_build_config(build_id)[source]

Return a config for source build

Parameters:build_id (int) –
Returns:Munch
get_list(ownername, projectname, packagename=None, status=None, pagination=None)[source]

Return a list of packages

Parameters:
  • ownername (str) –
  • projectname (str) –
  • packagename (str) –
  • status (str) –
  • pagination
Returns:

Munch

cancel(build_id)[source]

Cancel a build

Parameters:build_id (int) –
Returns:Munch
create_from_urls(ownername, projectname, urls, buildopts=None)[source]

Create builds from a list of URLs

Parameters:
Returns:

Munch

create_from_url(ownername, projectname, url, buildopts=None)[source]

Create a build from URL

Parameters:
Returns:

Munch

create_from_file(ownername, projectname, path, buildopts=None)[source]

Create a build from local SRPM file

Parameters:
Returns:

Munch

create_from_scm(ownername, projectname, clone_url, committish='', subdirectory='', spec='', scm_type='git', source_build_method='rpkg', buildopts=None)[source]

Create a build from SCM repository

Parameters:
  • ownername (str) –
  • projectname (str) –
  • clone_url (str) – url to a project versioned by Git or SVN
  • committish (str) – name of a branch, tag, or a git hash
  • subdirectory (str) – path to a subdirectory with package content
  • spec (str) – path to spec file, relative to ‘subdirectory’
  • scm_type (str) –
  • source_build_method (str) –
  • buildoptshttp://python-copr.readthedocs.io/en/latest/client_v3/build_options.html
Returns:

Munch

create_from_pypi(ownername, projectname, pypi_package_name, pypi_package_version=None, python_versions=None, buildopts=None)[source]

Create a build from PyPI - https://pypi.org/

Parameters:
Returns:

Munch

create_from_rubygems(ownername, projectname, gem_name, buildopts=None)[source]

Create a build from RubyGems - https://rubygems.org/

Parameters:
Returns:

Munch

create_from_custom(ownername, projectname, script, script_chroot=None, script_builddeps=None, script_resultdir=None, buildopts=None)[source]

Create a build from custom script.

Parameters:
  • ownername (str) –
  • projectname (str) –
  • script – script to execute to generate sources
  • script_chroot – [optional] what chroot to use to generate sources (defaults to fedora-latest-x86_64)
  • script_builddeps – [optional] list of script’s dependencies
  • script_resultdir – [optional] where script generates results (relative to cwd)
Returns:

Munch

delete(build_id)[source]

Delete a build

Parameters:build_id (int) –
Returns:Munch

Package

class copr.v3.proxies.package.PackageProxy(config)[source]
get(ownername, projectname, packagename)[source]

Return a package

Parameters:
  • ownername (str) –
  • projectname (str) –
  • packagename (str) –
Returns:

Munch

get_list(ownername, projectname, pagination=None)[source]

Return a list of packages

Parameters:
  • ownername (str) –
  • projectname (str) –
  • pagination
Returns:

Munch

add(ownername, projectname, packagename, source_type, source_dict)[source]

Add a package to a project

Parameters:
Returns:

Munch

edit(ownername, projectname, packagename, source_type=None, source_dict=None)[source]

Edit a package in a project

Parameters:
Returns:

Munch

reset(ownername, projectname, packagename)[source]

Reset a package configuration, meaning that previously selected source_type for the package and also all the source configuration previously defined by source_dict will be nulled.

Parameters:
  • ownername (str) –
  • projectname (str) –
  • packagename (str) –
Returns:

Munch

build(ownername, projectname, packagename, buildopts=None)[source]

Create a build from a package configuration

Parameters:
Returns:

Munch

delete(ownername, projectname, packagename)[source]

Delete a package from a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • packagename (str) –
Returns:

Munch

Module

class copr.v3.proxies.module.ModuleProxy(config)[source]
build_from_url(ownername, projectname, url, branch='master')[source]

Build a module from a URL pointing to a modulemd YAML file

Parameters:
  • ownername (str) –
  • projectname (str) –
  • url (str) – URL pointing to a raw .yaml file
  • branch (str) –
Returns:

Munch

build_from_file(ownername, projectname, path)[source]

Build a module from a local modulemd YAML file

Parameters:
  • ownername (str) –
  • projectname (str) –
  • path (str) –
Returns:

Munch

Project Chroot

class copr.v3.proxies.project_chroot.ProjectChrootProxy(config)[source]
get(ownername, projectname, chrootname)[source]

Return a configuration of a chroot in a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • chrootname (str) –
Returns:

Munch

get_build_config(ownername, projectname, chrootname)[source]

Return a build configuration of a chroot in a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • chrootname (str) –
Returns:

Munch

edit(ownername, projectname, chrootname, additional_packages=None, additional_repos=None, comps=None, delete_comps=False, with_opts=None, without_opts=None)[source]

Edit a chroot configuration in a project

Parameters:
  • ownername (str) –
  • projectname (str) –
  • chrootname (str) –
  • additional_packages (list) – buildroot packages for the chroot
  • additional_repos (list) – buildroot additional additional_repos
  • comps (str) – file path to the comps.xml file
  • delete_comps (bool) – if True, current comps.xml will be removed
  • with_opts (list) – Mock –with option
  • without_opts (list) – Mock –without option
Returns:

Munch

Build Chroot

class copr.v3.proxies.build_chroot.BuildChrootProxy(config)[source]
get(build_id, chrootname)[source]

Return a build chroot

Parameters:
  • build_id (int) –
  • chrootname (str) –
Returns:

Munch

get_list(build_id, pagination=None)[source]

Return a list of build chroots

Parameters:
  • build_id (int) –
  • chrootname (str) –
  • pagination
Returns:

Munch

get_build_config(build_id, chrootname)[source]

Return a build config for a build chroot

Parameters:
  • build_id (int) –
  • chrootname (str) –
Returns:

Munch