Python Client API

slicer_package_manager_client package

class slicer_package_manager_client.Constant

Bases: object

A bunch of utilities constant, as to handle Error or set default parameters.

CURRENT_FOLDER = '/home/docs/checkouts/readthedocs.org/user_builds/slicer-package-manager/checkouts/latest/docs'
DEFAULT_LIMIT = 50
DRAFT_RELEASE_NAME = 'draft'
EXTENSION_AREADY_UP_TO_DATE = 32
EXTENSION_NOW_UP_TO_DATE = 33
PACKAGE_NOW_UP_TO_DATE = 31
WIDTH = 25
class slicer_package_manager_client.SlicerPackageClient(host=None, port=None, apiRoot=None, scheme=None, apiUrl=None, progressReporterCls=None)

Bases: GirderClient

The SlicerPackageClient allows to use the slicer_package_manager plugin of Girder, which allows you to manage the following top-level entities:

  • Application

  • Release

  • Draft

  • Package

  • Extension

You may also choose the collection in which to create the application. It’s also possible to provide a collection ID to use as the parent collection for creating the application.

In this case, you must provide the coll_id argument to use all the commands on these applications. By default, all commands look for applications that are under a collection named Applications.

createApp(name, desc=None, coll_id=None, coll_name=None, coll_desc=None, public=None)

Create a new application in the collection which correspond to coll_id, by default it will create the application in the collection named Applications. The application will contain a draft folder. Two templates names will be set as a metadata of this new application. One for determine each future uploaded application package and the other to determine each future uploaded extension. It’s also possible to create a new collection by specifying “coll_name”. If this collection already exist it will use it.

Parameters:
  • name – name of the new application

  • desc – Optional description of the application

  • coll_id – Id of an existing collection

  • coll_name – Name of the collection

  • coll_desc – Optional description of the new collection

  • public – Whether the collection should be publicly visible

Returns:

The new application

createRelease(app_name, name, revision, coll_id=None, desc=None)

Create a new release within the application corresponding to app_name.

Parameters:
  • app_name – Name of the application

  • name – Name of the release

  • revision – Revision of the application

  • coll_id – Collection ID

  • desc – Description of the release

Returns:

The new release

deleteApp(name, coll_id=None)

Delete the application by ID.

Parameters:
  • name – application name

  • coll_id – Collection ID

Returns:

The deleted application

deleteApplicationPackage(app_name, id_or_name, coll_id=None)

Delete an application package within an application.

Parameters:
  • app_name – Name of the application

  • id_or_name – Package ID or name

  • coll_id – Collection ID

Returns:

The deleted application package

deleteDraftRelease(app_name, revision, coll_id=None)

Delete a specific revision within the Draft release.

Parameters:
  • app_name – Name of the application

  • revision – Revision of the release

  • coll_id – Collection ID

Returns:

The deleted release

deleteExtension(app_name, id_or_name, coll_id=None)

Delete an extension within an application.

Parameters:
  • app_name – Name of the application

  • id_or_name – Extension ID or name

  • coll_id – Collection ID

Returns:

The deleted extension

deleteRelease(app_name, name, coll_id=None)

Delete a release within an application.

Parameters:
  • app_name – Name of the application

  • name – Name of the release

  • coll_id – Collection ID

Returns:

The deleted release

downloadApplicationPackage(app_name, id_or_name, coll_id=None, dir_path='/home/docs/checkouts/readthedocs.org/user_builds/slicer-package-manager/checkouts/latest/docs')

Download an application package by ID and store it in the given option dir_path. When we use the package id in id_or_name, the parameter app_name is ignored.

Parameters:
  • app_name – Name of the application

  • id_or_name – ID or name of the package

  • coll_id – Collection ID

  • dir_path – Path of the directory where the application package has to be downloaded

Returns:

The downloaded package

downloadExtension(app_name, id_or_name, coll_id=None, dir_path='/home/docs/checkouts/readthedocs.org/user_builds/slicer-package-manager/checkouts/latest/docs')

Download an extension by ID and store it in the given option dir_path. When we use the extension id in id_or_name, the parameter app_name is ignored.

Parameters:
  • app_name – Name of the application

  • id_or_name – ID or name of the extension

  • coll_id – Collection ID

  • dir_path – Path of the directory where the extension has to be downloaded

Returns:

The downloaded extension

listApp(name=None, coll_id=None)

List all the applications within a specific collection by providing the option coll_id. By default it will list within the collection Applications. It can also lead to get the application by name.

Parameters:
  • name – application mame

  • coll_id – Collection ID

Returns:

A list of applications

listApplicationPackage(app_name, coll_id=None, name=None, pkg_os=None, arch=None, revision=None, version=None, release=None, limit=50)

List the application packages filtered by some optional parameters (os, arch, …).

By default only the first N application packages are listed. Setting the limit parameter to 0 removes this restriction.

It’s also possible to specify the --release option to list all the package from a specific release.

Parameters:
  • app_name – Name of the application

  • coll_id – Collection ID

  • name – Base name of the application package

  • pkg_os – The target operating system of the package

  • arch – The os chip architecture

  • revision – Revision of the application

  • version – Version of the application

  • release – Name or ID of the release

  • limit – Limit of the number of applications listed (see Constant.DEFAULT_LIMIT)

Returns:

A list of application package filtered by optional parameters

listDraftRelease(app_name, coll_id=None, revision=None, limit=50, offset=0)

List the draft releases with an offset option to list only the older ones.

By default only the first N releases are listed. Setting limit parameter to 0 removes this restriction.

It’s also possible to list one release within the Draft release by providing its specific revision.

Parameters:
  • app_name – Name of the application

  • coll_id – Collection ID

  • revision – Revision of the release

  • limit – Limit of the number of draft releases listed (see Constant.DEFAULT_LIMIT)

  • offset – offset to list only older revisions

Returns:

The list of draft release

listExtension(app_name, coll_id=None, name=None, ext_os=None, arch=None, app_revision=None, release='draft', query=None, limit=50, all=False)

List the extensions of a specific application app_name.

By default only the first N extensions within the draft release are listed. Setting limit parameter to 0 removes this restriction.

Specifying optional parameters like ext_os or arch allows to return the corresponding subset.

Passing all=True option allow to list all the extensions from all the releases of an application.

Parameters:
  • app_name – Name of the application

  • coll_id – Collection ID

  • name – Base name of the extension

  • ext_os – The target operating system of the package

  • arch – The os chip architecture

  • app_revision – Revision of the application

  • release – Name of the release

  • query – Text expected to be found in the extension name or description

  • limit – Limit of the number of extensions listed (see Constant.DEFAULT_LIMIT)

  • all – Boolean that allow to list extensions from all the release

Returns:

A list of extensions filtered by optional parameters

listRelease(app_name, name=None, coll_id=None)

List all the release within an application. It’s also able to get one specific release by name.

Parameters:
  • app_name – Name of the application

  • name – Name of the release

  • coll_id – Collection ID

Returns:

A list of all the release within the application

uploadApplicationPackage(filepath, app_name, pkg_os, arch, name, repo_type, repo_url, revision, version, build_date=None, coll_id=None, desc='', pre_release=False)

Upload an application package by providing a path to the file. It can also be used to update an existing one.

Parameters:
  • filepath – The path to the file

  • app_name – The name of the application

  • pkg_os – The target operating system of the package

  • arch – The os chip architecture

  • name – The baseName of the package

  • repo_type – Type of the repository

  • repo_url – Url of the repository

  • revision – The revision of the application

  • version – The version of the application

  • build_date – The build timestamp specified as a datetime string. Default set to current date and time.

  • coll_id – Collection ID

  • desc – The description of the application package

  • pre_release – Boolean to specify if the package is ready to be distributed

Returns:

The uploaded application package

uploadExtension(filepath, app_name, ext_os, arch, name, repo_type, repo_url, revision, app_revision, desc='', icon_url='', category=None, homepage='', screenshots=None, contributors=None, dependency=None, coll_id=None, force=False)

Upload an extension by providing a path to the file. It can also be used to update an existing one, in this case the upload is done only if the extension has a different revision than the old one.

Parameters:
  • filepath – The path to the file

  • app_name – The name of the application

  • ext_os – The target operating system of the package

  • arch – The os chip architecture

  • name – The baseName of the extension

  • repo_type – Type of the repository

  • repo_url – Url of the repository

  • revision – The revision of the extension

  • app_revision – The revision of the application supported by the extension

  • desc – The description of the extension

  • icon_url – Url of the extension’s logo

  • category – Category of the extension

  • homepage – Url of the extension’s homepage

  • screenshots – Space-separate list of URLs of screenshots for the extension.

  • contributors – List of contributors of the extension.

  • dependency – List of the required extensions to use this one.

  • coll_id – Collection ID

  • force – To force update the binary file

Returns:

The uploaded extension

exception slicer_package_manager_client.SlicerPackageManagerError

Bases: Exception

Submodules

slicer_package_manager_client.cli module

class slicer_package_manager_client.cli.SlicerPackageCli(username, password, host=None, port=None, apiRoot=None, scheme=None, apiUrl=None, apiKey=None)

Bases: SlicerPackageClient

A command line Python client for interacting with a Girder instance’s RESTful api, specifically for performing uploads into a Girder instance.