Core API

zoo.core.api is the only supported entry point to the Zoo Tools core. Everything else under zoo.core can change without notice, so import from here.

from zoo.core import api

cfg = api.currentConfig()

Functions

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

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()

fromCli(cfg, arguments)

Run a Zoo CLI action based on the arguments passed.

Parameters:
  • cfg (Any) – The zoo configuration instance

  • arguments (List[str]) – The command line arguments

Returns:

The result of the command execution

Return type:

Any

Constants

The constants module is available as api.constants, see Constants.

Errors

These errors are available from the api, for example api.MissingPackage. They are documented with the rest of the errors in Errors.