xylem Python API

Experimental: the xylem Python library is still unstable.

The xylem Python module supports both the xylem command-line tool as well as libraries that wish to use xylem data files to resolve dependencies.

As a developer, you may wish to extend xylem to add new OS platforms or package managers.

Database

Implements the update functionality.

This includes the functions to collect and process source files. Part of this process is to load and run the spec parser, which are given by name in the source files.

xylem.update.handle_spec_urls(spec, urls)

Load a given spec parser by spec name and processed all urls.

Returns a list of new rules from parsed urls

Parameters:
  • spec (str) – name of a spec parser to load
  • urls (list of str) – list of urls to load for the given spec parser
xylem.update.load_url(url, retry=2, retry_period=1, timeout=10)

Load a given url with retries, retry_periods, and timeouts.

Based on https://github.com/ros-infrastructure/rosdistro/blob/master/src/rosdistro/loader.py

Parameters:
  • url (str) – URL to load and return contents of
  • retry (int) – number of times to retry the url on 503 or timeout
  • retry_period (float) – time to wait between retries in seconds
  • timeout (float) – timeout for opening the URL in seconds
xylem.update.update(prefix=None, dry_run=False)

Update the xylem cache.

If the prefix is set then the source lists are searched for in the prefix. If the prefix is not set (None) or the source lists are not found in the prefix, then the default, builtin source list is used.

Parameters:
  • prefix (str or None) – The config and cache prefix, usually ‘/’ or someother prefix
  • dry_run (bool) – If True, then no actual action is taken, only pretend to
xylem.update.verify_rules(rules, spec)

Verify that a set of rules are valid for internal storage.

Parameters:rules (dict) – set of nested dictionaries which is the internal DB format