hazelnut
hazelnut is an Apache licensed library written in Python designed to
provide a simple and pythonic way to parse /proc/meminfo on Linux based
systems.
Installation
pip install hazelnut
Usage
>>> from hazelnut import MemInfo
>>> mem = MemInfo()
>>> repr(mem)
"MemInfo(path='/proc/meminfo')"
Print all meminfo contents:
>>> print(mem)
MemTotal: 8092460 kB
MemFree: 499880 kB
...
Return output as dict:
>>> mem.to_dict()
{
"MemTotal": "8092460 kB",
"MemFree": "499880 kB",
"Buffers": "219088 kB",
"HugePages_Total": "0",
...
}
Search keys (case-insensitive, matches anywhere in the key — anchor with ^ if needed):
>>> mem.search('total')
['MemTotal: 8092460 kB', 'SwapTotal: 16776188 kB', 'VmallocTotal: 34359738367 kB', 'HugePages_Total: 0']
Get memory value as int (exact key match):
>>> mem.get('MemTotal')
8092460
>>> mem.get('Active(anon)')
1794356
>>> mem.get('NoSuchKey') is None
True
Values are returned as bare integers with the unit dropped: most fields
are expressed in kB (kibibytes), a few (e.g. HugePages_Total) are
plain counts.
License
Copyright 2015-2026 Martin Simon
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Buy me a coffee?
If you feel like buying me a coffee (or a beer?), donations are welcome:
BTC : bc1qq04jnuqqavpccfptmddqjkg7cuspy3new4sxq9
DOGE: DRBkryyau5CMxpBzVmrBAjK6dVdMZSBsuS
ETH : 0x2238A11856428b72E80D70Be8666729497059d95
LTC : MQwXsBrArLRHQzwQZAjJPNrxGS1uNDDKX6
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hazelnut-1.0.0.tar.gz.
File metadata
- Download URL: hazelnut-1.0.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
817df81c8edee858bcfd05e479401d110d14f39912542abe494eb50618a9e49f
|
|
| MD5 |
910e62407a2c797fb913e0e6c2f60a74
|
|
| BLAKE2b-256 |
0a0119d755719d794cc365ac68c2582f13d6f4dbe699bd312006b27c03551105
|
Provenance
The following attestation bundles were made for hazelnut-1.0.0.tar.gz:
Publisher:
release.yml on barnumbirr/hazelnut
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hazelnut-1.0.0.tar.gz -
Subject digest:
817df81c8edee858bcfd05e479401d110d14f39912542abe494eb50618a9e49f - Sigstore transparency entry: 2391933177
- Sigstore integration time:
-
Permalink:
barnumbirr/hazelnut@b6064ea36759862261a48a3a9c96ec2d641136d3 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/barnumbirr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b6064ea36759862261a48a3a9c96ec2d641136d3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hazelnut-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hazelnut-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aca2cbc328b2d7f7325ab831f1d244560afc487db766cf3c42a3033bb4a5d82
|
|
| MD5 |
4229db017e383f672bd7c2dde2441b72
|
|
| BLAKE2b-256 |
1ddbefc8800f6934e49079bd3b462d64503cce57d6c94a7be5f459e5e906c7e5
|
Provenance
The following attestation bundles were made for hazelnut-1.0.0-py3-none-any.whl:
Publisher:
release.yml on barnumbirr/hazelnut
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hazelnut-1.0.0-py3-none-any.whl -
Subject digest:
0aca2cbc328b2d7f7325ab831f1d244560afc487db766cf3c42a3033bb4a5d82 - Sigstore transparency entry: 2391933271
- Sigstore integration time:
-
Permalink:
barnumbirr/hazelnut@b6064ea36759862261a48a3a9c96ec2d641136d3 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/barnumbirr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b6064ea36759862261a48a3a9c96ec2d641136d3 -
Trigger Event:
push
-
Statement type: