Skip to main content

CFFI interface to Net-SNMP

Project description

netsnmp-cffi

This is a CFFI-based Python interface for the Net-SNMP C library, enabling efficient parallel SNMP communication with large amounts of devices from Python. It provides both asynchronous (asyncio) and synchronous interfaces.

This module is still a work in progress, and has been mainly developed to replace PySNMP as the default SNMP library in Zino 2 - the first releases of this library will focus mainly on functionality used by Zino (which for the most part means that SNMPv3 is not implemented yet).

Compatibility

The library is intended to be compatible with Net-SNMP versions from 5.9 and newer, and with Python 3.9 and newer.

Usage examples

For a simple (asyncio) usage example, see asnmpget.py.

Developing netsnmp-cffi

Running tests

tox and pytest are used to run the test suite. To run the test suite on all supported versions of Python, run:

tox

Code style

netsnmp-cffi code should follow the PEP-8 and PEP-257 guidelines. Ruff is used for automatic code formatting. The pre-commit tool is used to enforce code styles at commit-time.

Before you start hacking, enable pre-commit hooks in your cloned repository, like so:

pre-commit install

Using towncrier to automatically produce the changelog

Before merging a pull request

To be able to automatically produce the changelog for a release one file for each pull request (also called news fragment) needs to be added to the folder changelog.d/.

The name of the file consists of three parts separated by a period:

  1. The identifier: the issue number or the pull request number. If we don't want to add a link to the resulting changelog entry then a + followed by a unique short description.
  2. The type of the change: we use security, removed, deprecated, added, changed and fixed.
  3. The file suffix, e.g. .md, towncrier does not care which suffix a fragment has.

So an example for a file name related to an issue/pull request would be 214.added.md or for a file without corresponding issue +fixed-pagination-bug.fixed.md.

This file can either be created manually with a file name as specified above and the changelog text as content or one can use towncrier to create such a file as following:

$ towncrier create -c "Changelog content" 214.added.md

When opening a pull request there will be a check to make sure that a news fragment is added and it will fail if it is missing.

Before a release

To add all content from the changelog.d/ folder to the changelog file simply run

$ towncrier build --version {version}

This will also delete all files in changelog.d/.

To preview what the addition to the changelog file would look like add the flag --draft. This will not delete any files or change CHANGELOG.md. It will only output the preview in the terminal.

A few other helpful flags:

  • date DATE - set the date of the release, default is today
  • keep - do not delete the files in changelog.d/

More information about towncrier.

Building binary wheels

This package utilizes the API mode of CFFI, which means that it builds a small C shim to interface between the Net-SNMP library and Python. This means that a small platform-dependent binary will be part of the wheels built from this package.

In order to build wheels that should be compatible with at least several Linux distros and Python version combinations, and that are also uploadable to PyPI when making release, we utilize the manylinux tool suite.

Building the binary wheels should more or less be automated by a make command (see the Makefile itself for details):

make

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

netsnmp_cffi-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

netsnmp_cffi-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

netsnmp_cffi-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

netsnmp_cffi-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

File details

Details for the file netsnmp_cffi-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netsnmp_cffi-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80294c2e5a158f4c1cdf4389596e5334f1f71ff6fe121c01c6319fdd924854f8
MD5 1c91d05719ba2d1542d1af99f3982550
BLAKE2b-256 bcc8532114b64c8ec54aeab46deb2e0e2b7e17eafa4aac0e2dcad08906601b96

See more details on using hashes here.

File details

Details for the file netsnmp_cffi-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netsnmp_cffi-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0cdb0c2b92545dfbce0025170f752561c27eb8eee823b694c88f4bbf70295c43
MD5 12af38ed092f28d8ce739aa770b05058
BLAKE2b-256 cb965b91eaedb36210a6be966370dfb157d5fe29987ecfebff0d820af8be9de8

See more details on using hashes here.

File details

Details for the file netsnmp_cffi-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netsnmp_cffi-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a041d169cdf1e06beab278710c4a906d93ce4992a1adc785c18266c81e9e364b
MD5 f947ce74cb93a190c327d0c4af2c3f04
BLAKE2b-256 8061afd8c47562828d50bd54bbdea7db7e67a3cff1040734b569d34fa8c4a8ce

See more details on using hashes here.

File details

Details for the file netsnmp_cffi-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for netsnmp_cffi-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 19e8463b22e5df2f7f70f73ff37aefbb96715ffb072cb5d786b2ef9c7fba2661
MD5 72215e1b7213ad35e3e98617912b7d56
BLAKE2b-256 8ac2856f0a0017039b93f98755e9488487ff18ac6f7c72bc34c30a5c8c94dfe0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page