ensure_custom

ensure_custom(key, *subkeys, name, force=False, provider, **kwargs)[source]

Ensure a file is present, and run a custom create function otherwise.

Parameters:
  • key (str) – The name of the module. No funny characters. The envvar <key>_HOME where key is uppercased is checked first before using the default home directory.

  • subkeys (str) – A sequence of additional strings to join. If none are given, returns the directory for this module.

  • name (str) – The file name.

  • force (bool) – Should the file be re-created, even if the path already exists?

  • provider (Callable[..., None]) – The file provider. Will be run with the path as the first positional argument, if the file needs to be generated.

  • kwargs – Additional keyword-based parameters passed to the provider.

Return type:

Path

Returns:

The path of the file that has been created (or already exists)