ensure_custom

ensure_custom(key: str, *subkeys: str, name: str, force: bool = False, provider: Callable[[...], None], **kwargs: Any) Path[source]

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

Parameters:
  • key – 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 – A sequence of additional strings to join. If none are given, returns the directory for this module.

  • name – The file name.

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

  • provider – 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.

Returns:

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