API Reference

Zoo Config Manager

class Zoo(zooPath)

Bases: object

Zoo class is the main entry point for operating on any part of zoo tools.

Parameters:

zooPath (str) – The root location of zootools root folder ie. the one above the installation folder.

Raise:

errors.FileNotFoundError

coreVersion()

Returns core(this) package version string.

Returns:

coreVersion ie. “1.0.0”

Return type:

str

buildVersion()

Returns the Zoo Tools build version string.

Returns:

buildVersion ie. “1.0.0”

Return type:

str

buildPackagePath()

Returns the fullPath to the zoo_package.json which is the build package.

Returns:

str

property isAdmin

Returns whether the current user is in admin mode.

Returns:

True if admin.

Return type:

bool

property commands

Returns the executable cli commands dict cache.

Returns:

Plugin manager instance

Return type:

dict

property rootPath

Returns the root path of zootools.

The root path directory is the folder above the installation folder

Returns:

The root folder of zootools.

Return type:

str

property configPath

Returns the config folder which sits below the root.

Returns:

The config folder for zootools.

Return type:

str

property corePath

The core folder of zootools which is relative to the root under the installation folder.

The core folder houses internal logic of zootools package management.

Returns:

The core folder

Return type:

str

property packagesPath

Returns the package repository path under the zootools/install folder.

This folder is the location for all installed packages. Each package Housed here is in the form of:

Packages
    - packageName
        - packageVersion(LooseVersion)
            -code
Returns:

The package’s folder.

Return type:

str

property pythonPath

Returns the python folder path under the core installation.

Returns:

The “python” folder path.

Return type:

str

property resolver

Returns the environment resolver instance which contains the package cache.

Returns:

The Environment Resolver instance

Return type:

resolver.Environment

property commandLibrary

Returns the CLI command plugin manager instance.

Only one is created per Zoo session

Return type:

pluginmanager.PluginManager

property descriptorLibrary

Returns the descriptor types plugin manager instance.

Only one is created per Zoo session

Return type:

descriptor.DescriptorRegistry

preferenceRootsPath()

Returns the preferences roots config file path in the installRoot/config/env folder.

Return type:

str

preferenceRootsConfig()

Loads and returns the preference_roots file contents as a dict

Return type:

dict

cacheFolderPath()

Returns the current Zoo tools cache folder.

The cache folder is used to store temporary data like pip installed libraries, logs, temp export files etc.

Return type:

str

sitePackagesPath()

Returns the site packages folder path where zootools installs pip packages when needed. This path is python version dependent.

Return type:

str

descriptorFromDict(descriptorDict)

Helper method which calls for zoo.core.descriptors.descriptor.descriptorFromDict()

Parameters:

descriptorDict (dict) – See zoo.core.descriptors.descriptor.descriptorFromDict() for more info

Returns:

The corresponding Descriptor instance

Return type:

zoo.core.descriptors.descriptor.Descriptor

descriptorForPackageName(name)

Returns the matching descriptor instance for the package name.

Parameters:

name (str) – The zoo package name to find.

Returns:

The descriptor or None

Return type:

zoo.core.descriptors.descriptor.Descriptor or None

descriptorsForPackageNames(*names)

Returns the matching descriptor instances for the package names.

Parameters:

names (tuple[str]) – The zoo package names to find.

Returns:

The descriptor or None

Return type:

list[zoo.core.descriptors.descriptor.Descriptor or None]

descriptorFromPath(location, descriptorDict)

Given absolute path and descriptor dict return the matching Descriptor instance.

Parameters:
  • location (str) – The absolute path to the package.

  • descriptorDict (dict) – The descriptor

Return type:

zoo.core.descriptors.descriptor.Descriptor or None

runCommand(commandName, arguments)

Run’s the specified CLI command.

User runCommand(“commandName”, [”–help”]) to get the command help.

Parameters:
  • commandName (str) – The command ID name.

  • arguments (list[str]) – List of cls commands to pass to the command.

Returns:

True if the command was run.

Return type:

bool

shutdown()

Shutdown Method for zootools excluding Host application plugin related code.

reload()

Reloads all of zootools python packages, libraries, environment variables.

Returns:

A New Zoo Manager instance.

Return type:

Zoo

currentConfig()

Returns the Zoo instance currently initialized globally.

If this func returns None call zooFromPath().

Returns:

The currently initialized Zoo

Return type:

Zoo or None

setCurrentConfig(config)

Sets the Zoo global instance.

Warning:

This overrides the global instanced Zoo instance.

If you need to run multiple instances in parallel use zooConfig()

zooFromPath(path)

Returns the zootools instance for the given root path.

Parameters:

path (str) – The root path of zootools to initialize, See Zoo for more information.

Returns:

The zoo instance.

Return type:

Zoo

Exception Types

exception PackageAlreadyExists

Bases: Exception

Raised when the package requested already exist.

exception MissingPackageVersion

Bases: Exception

Raised when the requested package doesn’t exist in the packages location

exception MissingPackage

Bases: Exception

exception DescriptorMissingKeys

Bases: Exception

Raised when the provided descriptor keys doesn’t meet the required descriptor keys

exception UnsupportedDescriptorType

Bases: Exception

Raised when the provided descriptor information doesn’t match any existing descriptors

exception MissingGitPython(*args, **kwargs)

Bases: Exception

Error Raised when git python installed in the current python environment

exception InvalidPackagePath

Bases: Exception

Raised when The package path requested isn’t compatible with zootools.

exception MissingEnvironmentPath

Bases: Exception

Raised when the package_version.config doesn’t exist

exception GitTagAlreadyExists

Bases: Exception

Raised request for tag creation already exists

exception MissingCliArgument

Bases: Exception

Constants