Skip to main content

Return facts of server

Project description

Returns facts of local machine.


pip install facts

CLI Usage

Get all facts:

facts all

Get one fact:

fact read foo

Get the human readable memory usage:

fact read memory --human

Set one custom fact:

fact write foo 'It is nice'

When value is a mapping, then you can choose between 2 merging strategies:

fact write foo '{is: bar}' --format yaml --replace
fact write foo '{not: baz}' --format yaml --merge

Delete a custom fact:

fact delete foo


By convention key facts can’t have colon marks. Because facts can be nested, and it’s possible to target these sub data. Each parts must be seperated by a colon. For example if:

fact read foo


is: bar
not: baz


fact read foo:is




fact read foo:wrong:key

will return nothing.


It is also possible to check if a certain fact turns out true:

fact match foo:is:bar


Facts allow you to extends with ‘grafts’. There is 2 ways

1. by modules

You can extend with your own facts. Any python modules under ~/.facts/grafts will be loaded. For example:

# ~/.facts/grafts/

from facts import graft, mark

def hello_world():
    return {
        'hello': 'world',
        'size': mark(1234567890, 'bytes')

Will append the fact hello with the value world, and the fact size with one of these values (depending the –human switch) 1234567890 or 1.1G.

2. with setuptools

You also write python libraries that will contribute to facts with using setuptools. Add the following to the function:

    'facts.graft': [
        'plugin-1 = mylib:plugin_1',
        'plugin-2 = mylib:plugin_2'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facts-0.4.tar.gz (8.2 kB view hashes)

Uploaded source

Built Distributions

facts-0.4-py3-none-any.whl (12.7 kB view hashes)

Uploaded 3 4

facts-0.4-py2.py3-none-any.whl (12.7 kB view hashes)

Uploaded 3 4

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page