idiap_devtools.profile#

Module Attributes

OLD_USER_CONFIGURATION

The previous default location for the user configuration file.

USER_CONFIGURATION

The default location for the user configuration file.

Functions

get_profile_path(name)

Returns the local directory of the named profile.

load(dir)

Loads a profile TOML file, returns a dictionary with contents.

Classes

Profile(name)

A class representing the development profile.

idiap_devtools.profile.OLD_USER_CONFIGURATION = PosixPath('/home/docs/.config/devtools.toml')#

The previous default location for the user configuration file.

idiap_devtools.profile.USER_CONFIGURATION = PosixPath('/home/docs/.config/idiap-devtools.toml')#

The default location for the user configuration file.

idiap_devtools.profile.load(dir)[source]#

Loads a profile TOML file, returns a dictionary with contents.

Return type:

dict[str, Any]

idiap_devtools.profile.get_profile_path(name)[source]#

Returns the local directory of the named profile.

If the input name corresponds to an existing directory, then that is returned. Otherwise, we lookup the said name inside the user configuration. If one exists, then the path pointed by that variable is returned. Otherwise, an exception is raised.

Parameters:

name (str | Path) – The name of the local profile to return - can be either an existing path, or any name from the user configuration file.

Return type:

Optional[Path]

Returns:

Either None, if the profile cannot be found, or a verified path, if one is found.

class idiap_devtools.profile.Profile(name)[source]#

Bases: object

A class representing the development profile.

Parameters:

path – The name of the local profile to return - can be either an existing path, or any name from the user configuration file.

data: dict[str, Any]#

A readout of the profile.toml file

conda_config(python, public, stable)[source]#

Builds the conda-configuration to use based on the profile.

Parameters:
  • python (str) – The python version in the format “X.Y” (e.g. “3.9” or “3.10”)

  • private – Set to True if we should use private channels/indexes to lookup dependencies. Should be False otherwise

  • stable (bool) – Set to True if we should only consider stable versions of packages, as opposed to pre-release ones (beta packages). Set to False otherwise.

Return type:

Any

return_type:
conda_build.config.Config: A dictionary containing the merged

configuration, as produced by conda-build API’s get_or_merge_config() function.

python_indexes(public, stable)[source]#

Returns Python indexes to be used according to the current profile.

Parameters:
  • private – Set to True if we should use private channels/indexes to lookup dependencies. Should be False otherwise

  • stable (bool) – Set to True if we should only consider stable versions of packages, as opposed to pre-release ones (beta packages). Set to False otherwise.

Return type:

list[str]

get(key, default=None)[source]#

Reads the contents of a certain toml profile variable.

Return type:

Any

get_path(key, default=None)[source]#

Reads the contents of path from the profile and resolves it.

This function will search for a given profile key, consider it points to a path (relative or absolute) and will return that resolved path to the caller.

Parameters:
  • key (Union[str, Iterable[str]]) – The key, pointing to the variable inside profile.toml that contains the datafile to be _load_conda_packages

  • default (Optional[Path]) – The value to return to the caller by default, if the key does not exist within the profile.

Return type:

Optional[Path]

Returns:

The selected profile file path, or the contents of default otherwise.

get_file_contents(key, default=None)[source]#

Reads the contents of a file from the profile.

This function will search for a given profile key, consider it points to a filename (relative or absolute) and will read its contents, returning them to the caller.

Parameters:
  • key (Union[str, Iterable[str]]) – The key, pointing to the variable inside profile.toml that contains the datafile to be _load_conda_packages

  • default (Optional[str]) – The value to return to the caller by default, if the key does not exist within the profile.

Return type:

Optional[str]

Returns:

The contents of the selected profile file, or the contents of default otherwise.

conda_constraints(python)[source]#

Returns a list of conda constraints given the current profile.

Parameters:

python (str) – The python version in the format “X.Y” (e.g. “3.9” or “3.10”)

Return type:

Optional[dict[str, str]]

python_constraints()[source]#

Returns a list of Python requirements given the current profile.

Return type:

Optional[list[Requirement]]