pyinfra uses facts to determine the existing state of a remote server. Operations use this information to generate commands which alter the state. Facts can be executed/tested via the command line:

pyinfra myhost.com fact date another_fact ...

Or as part of a deploy:

if host.fact.linux_distribution['name'] == 'Ubuntu':
    spt.packages(...)

Facts, like operations, are namespaced as different modules: