Skip to main content

Facts

Returns facts of local machine.

Installation

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

Targeting

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

returns:

is: bar
not: baz

Then:

fact read foo:is

returns:

bar

But:

fact read foo:wrong:key

will return nothing.

Matching

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

fact match foo:is:bar

Grafting

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/my_grafts.py

from facts import graft, mark

@graft
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 setup.py function:

entry_points={
    'facts.graft': [
        'plugin-1 = mylib:plugin_1',
        'plugin-2 = mylib:plugin_2'
    ]
}

Metadata

Release files for facts 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for facts 0.4
File Size Uploaded Provenance Actions
facts-0.4.tar.gz 8.2 kB Without provenance Details for facts-0.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for facts 0.4
File Interpreter ABI Platform Actions
facts-0.4-py3-none-any.whl Python 3 none any Details for facts-0.4-py3-none-any.whl
facts-0.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for facts-0.4-py2.py3-none-any.whl

Total release size: 33.6 kB

Release files / facts-0.4.tar.gz

Download URL facts-0.4.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c899c226ad527bc4d9bc4f71dbafed51728063ce22acf6436bfc5fd294956857
BLAKE2b-256 checksum
How to use checksums
33889a719b12018e4e4387c1f5d75e1631e85da04f0675b095d8561f851576e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / facts-0.4-py3-none-any.whl

Download URL facts-0.4-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e29229275171a71ef08ca0cbd634fcc3e62d7c095c39d788d9f0f32a1f07fe8
BLAKE2b-256 checksum
How to use checksums
04526e9832fe1d439585f107c4b909a46688b17ed3721cf3d37323a46e80fc3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / facts-0.4-py2.py3-none-any.whl

Download URL facts-0.4-py2.py3-none-any.whl
Size 12.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
68bffb019692e4aa4fe5ee467459da55f63724bad3f002c951893dc30e485c8e
BLAKE2b-256 checksum
How to use checksums
67de1456ac14385015255d9dc3c23b08e5636257cf650df18fa5038bfb17a1dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for facts 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page