exhuma / puresnmp

Pure Python SNMPv2 Library
MIT License
79 stars 22 forks source link

passthrough timeout & retries arguments correctly #99

Closed whatamithinking closed 2 years ago

whatamithinking commented 2 years ago

First, thank you for creating this lib. pysnmp is good, but painfully complicated to get good performance out of. This lib is fast and has a nice simple functional interface.

Passing of the timeout argument seems to be broken currently with the Transport.send default of 2 always being applied instead of the timeout supplied to any of the raw/pythonic api functions. These fixes will just passthrough these keyword arguments.

exhuma commented 2 years ago

Thanks for the PR. There is currently a rewrite incoming, focussing on the reference architecture defined in RFC-3411. This also adds support for SNMPv3 and different support for SNMPv1. Effectively giving a cleaner separation between each of those models.

This also changes the way timeouts and retries work by providing a "client" class as was also suggested in #3

This took ages to get going as it was developed in-house and I had to first get a process set up to be legally allowed to open-source in-house code.

Incidentally this week (planned for Thursday) we'll have the code-review of puresnmp and I am very confident that I can push it to GitHub. So if we manage to finish the review this Thursday I'll be able to push. Until then, I will hold off on this PR. Even though I am not against merging it.

The new version will be backwards incompatible and will be released as v2.x (following semver). So if that would be blocking for you I an merge this PR into the 1.x branch.

whatamithinking commented 2 years ago

I can wait for the new version if it is coming in a few days. Thanks for the detailed reply.

exhuma commented 2 years ago

The review process started today and I'm waiting on a reply now. Crossing my fingers that it won't take too long. Note that, as the open-source track is not the highest priority in our company (not the core business) so I can't promise anything.

If you don't hear from me in due time, nudge me again in this thread and I'll either push it through internally, or I'll merge this PR to get you unblocked.

whatamithinking commented 2 years ago

Just following up on this. It does not look like the client you mentioned have been pushed yet. Is that going to happen anytime soon?

exhuma commented 2 years ago

Hi, thanks for your patience. I should be able to finish this next week. The repository had been officially forked into the company namespace over at https://github.com/post-luxembourg/puresnmp. The new code sits on the branch "feature/snmpv3". I will definitely release it first as pre-release because the main API has changed. Not least of which due to asyncio.

But it has been running in production internally already for over a year so I am confident that it's stable and the final release of version 2.0 will come very soon.

All I need to do is review the docs and write a migration guide for v1.x -> v2.x

exhuma commented 2 years ago

The new major release 2.0 has finally hit pypi. Albeit as pre-release for now so you have to opt-in by either running pip install with the --pre flag or using the exact-version with pip install "puresnmp==2.0.0rc1".

Note that this is a fairly big change due to the focus on asyncio. Depending on your project this may be a painful upgrade but I would appreciate the feedback.

Docs (including overview of the upgrade) are available at https://puresnmp.readthedocs.io/en/develop/

Seems like I messed up with the generation of the API-Docs though so the files on readthedocs.org are incomplete. Until I fixed that you can rely on the docstrings in the source code. I took care to have everything well documented.

The timeout & retries parameters can be controlled either permanently via client.configure, or temporarily via client.reconfigure

Let me know if you have any issues.

exhuma commented 2 years ago

Docs are building properly now.