Tag: python

Selecting Pynetbox Version

If you have: And you need: Then you need to use: Because: NetBox 3.3.0 or newer Cable terminations pynetbox 7.0.0 or newer Cable terminations were changed in NetBox 3.3 NetBox older than 3.3.0 Cable terminations pynetbox 6.6.2 (or older) pynetbox 7.0.0 (or newer) only supports NetBox 3.3 or newer NetBox 3.2.0 or newer /api/ipam/vlan-groups/<id>/available_vlans pynetbox […]

Comparing Version Numbers in Python

The distutils module is going to be deprecated in Python 3.10, and to be removed in Python 3.12. Hence, my current standard way of comparing version number strings is using pkg_resources module (part of setuptools): >>> from pkg_resources import parse_version as version >>> version(“1.0”) <Version(‘1.0’)> >>> version(“1.8.9”) < version(“2.0”) True >>> version(“2.0.9”) < version(“2.1”) True […]

Revisited: Version Numbering in Python Package

In Version Numbering in Python Package I showed a way to store the package version number in the code. The method is in hindsight not exactly the best one (who knew!), so here is another try for simple projects. Here I have mypackage/ (the package directory) mypackage/__init__.py mypackage/version.py setup.py with contents: mypackage/version.py: mypackage/__init__.py: setup.py: What […]