datalad_next.patches.run

Enhance run() placeholder substitutions to honor configuration defaults

Previously, run() would not recognize configuration defaults for placeholder substitution. This means that any placeholders globally declared in datalad.interface.common_cfg, or via register_config() in DataLad extensions would not be effective.

This patch makes run's format_command() helper include such defaults explicitly, and thereby enable the global declaration of substitution defaults.

Moreoever a {python} placeholder is now defined via this mechanism, and points to the value of sys.executable by default. This particular placeholder was found to be valuable for improving the portability of run-recording across (specific) Python versions, or across different (virtual) environments. See https://github.com/datalad/datalad-container/issues/224 for an example use case.

https://github.com/datalad/datalad/pull/7509

datalad_next.patches.run.format_command(dset, command, **kwds)[source]

Plug in placeholders in command.

Parameters:
  • dset (Dataset)

  • command (str or list)

  • converted (kwds is passed to the format call. inputs and outputs are)

  • necessary. (to GlobbedPaths if)

Return type:

formatted command (str)