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
Metadata
Release files for hazelnut 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hazelnut-1.0.0.tar.gz | 9.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hazelnut-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / hazelnut-1.0.0.tar.gz
| Download URL | hazelnut-1.0.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
817df81c8edee858bcfd05e479401d110d14f39912542abe494eb50618a9e49f
|
|
BLAKE2b-256 checksum How to use checksums |
0a0119d755719d794cc365ac68c2582f13d6f4dbe699bd312006b27c03551105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.
Transparency logRelease files / hazelnut-1.0.0-py3-none-any.whl
| Download URL | hazelnut-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0aca2cbc328b2d7f7325ab831f1d244560afc487db766cf3c42a3033bb4a5d82
|
|
BLAKE2b-256 checksum How to use checksums |
1ddbefc8800f6934e49079bd3b462d64503cce57d6c94a7be5f459e5e906c7e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.
Transparency logSecurity for hazelnut 1.0.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for hazelnut-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.
Transparency logA 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.