pyinfra.api.arguments module

pyinfra.api.arguments.generate_env(config, value)
pyinfra.api.arguments.pop_global_arguments(kwargs, state=None, host=None, keys_to_check=None)

Pop and return operation global keyword arguments, in preferred order:

  • From the current context (a direct @operator or @deploy function being called)
  • From any current @deploy context (deploy kwargs)
  • From the host data variables
  • From the config variables

Note this function is only called directly in the @operation & @deploy decorator wrappers which the user should pass global arguments prefixed “_”. This is to avoid any clashes with operation and deploy functions both internal and third party.

This is a bit strange because internally pyinfra uses non-_-prefixed arguments, and this function is responsible for the translation between the two.

TODO: is this wird-ness acceptable? Is it worth updating internal use to _prefix?

pyinfra.api.arguments.show_legacy_argument_warning(key, call_location)