Skip to content

Commit

Permalink
Removed Python 3.8 support. Added 3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Oct 9, 2024
1 parent b6d8911 commit 1c0178f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Setup python
Expand Down
165 changes: 3 additions & 162 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,167 +19,9 @@ from ASN.1 MIBs.
* Maintains an index of MIB objects over many MIB modules
* Automatically pulls ASN.1 MIBs from local directories, ZIP archives,
and HTTP servers
* 100% Python, works with Python 3.8+
* 100% Python, works with Python 3.9+

Rendered PySMI documentation can be found at [PySMI site](https://www.pysnmp.com/pysmi).

## How to use PySMI

If you are using PySNMP, you might never notice PySMI presence - PySNMP
calls PySMI for MIB download and compilation behind the scenes (you can
still can do that manually by invoking *mibdump* tool).

To turn ASN.1 MIB into a JSON document, call *mibdump* tool like this:

``` bash
$ mibdump --generate-mib-texts --destination-format json IF-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, https://mibs.pysnmp.com/asn1/@mib@
Borrow missing/failed MIBs from: https://mibs.pysnmp.com/json/fulltexts/@mib@
Existing/compiled MIB locations:
Compiled MIBs destination directory: .
MIBs excluded from code generation: RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI,
RFC1158-MIB, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM
MIBs to compile: IF-MIB
Destination format: json
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: yes
Do not create/update MIBs: no
Byte-compile Python modules: no (optimization level no)
Ignore compilation errors: no
Generate OID->MIB index: no
Generate texts in MIBs: yes
Keep original texts layout: no
Try various filenames while searching for MIB module: yes
Created/updated MIBs: IANAifType-MIB, IF-MIB, SNMPv2-MIB
Pre-compiled MIBs borrowed:
Up to date MIBs: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
```
JSON document build from
[IF-MIB module](https://mibs.pysnmp.com/asn1/IF-MIB)
would hold information such as:
``` json
{
"ifMIB": {
"name": "ifMIB",
"oid": "1.3.6.1.2.1.31",
"class": "moduleidentity",
"revisions": [
"2007-02-15 00:00",
"1996-02-28 21:55",
"1993-11-08 21:55"
]
},
// ...
"ifTestTable": {
"name": "ifTestTable",
"oid": "1.3.6.1.2.1.31.1.3",
"nodetype": "table",
"class": "objecttype",
"maxaccess": "not-accessible"
},
"ifTestEntry": {
"name": "ifTestEntry",
"oid": "1.3.6.1.2.1.31.1.3.1",
"nodetype": "row",
"class": "objecttype",
"maxaccess": "not-accessible",
"augmention": {
"name": "ifTestEntry",
"module": "IF-MIB",
"object": "ifEntry"
}
},
"ifTestId": {
"name": "ifTestId",
"oid": "1.3.6.1.2.1.31.1.3.1.1",
"nodetype": "column",
"class": "objecttype",
"syntax": {
"type": "TestAndIncr",
"class": "type"
},
"maxaccess": "read-write"
},
// ...
}
```
In general, converted MIBs capture all aspects of original (ASN.1) MIB contents
and layout. The snippet above is just a partial example, but here is the
complete [IF-MIB.json](https://mibs.pysnmp.com/json/fulltexts/IF-MIB.json)
file.
Besides one-to-one MIB conversion, PySMI library can produce JSON index to
facilitate fast MIB information lookup across large collection of MIB files.
For example, JSON index for
[IP-MIB.json](https://mibs.pysnmp.com/json/asn1/IP-MIB),
[TCP-MIB.json](https://mibs.pysnmp.com/json/asn1/TCP-MIB) and
[UDP-MIB.json](https://mibs.pysnmp.com/json/asn1/UDP-MIB)
modules would keep information like this:
``` json
{
"compliance": {
"1.3.6.1.2.1.48.2.1.1": [
"IP-MIB"
],
"1.3.6.1.2.1.49.2.1.1": [
"TCP-MIB"
],
"1.3.6.1.2.1.50.2.1.1": [
"UDP-MIB"
]
},
"identity": {
"1.3.6.1.2.1.48": [
"IP-MIB"
],
"1.3.6.1.2.1.49": [
"TCP-MIB"
],
"1.3.6.1.2.1.50": [
"UDP-MIB"
]
},
"oids": {
"1.3.6.1.2.1.4": [
"IP-MIB"
],
"1.3.6.1.2.1.5": [
"IP-MIB"
],
"1.3.6.1.2.1.6": [
"TCP-MIB"
],
"1.3.6.1.2.1.7": [
"UDP-MIB"
],
"1.3.6.1.2.1.49": [
"TCP-MIB"
],
"1.3.6.1.2.1.50": [
"UDP-MIB"
]
}
}
```
With this example, *compliance* and *identity* keys point to
*MODULE-COMPLIANCE* and *MODULE-IDENTITY* MIB objects, *oids*
list top-level OIDs branches defined in MIB modules. Full index
build over thousands of MIBs could be seen
[here](https://mibs.pysnmp.com/json/index.json).
The PySMI library can automatically fetch required MIBs from HTTP sites
or local directories. You could configure any MIB source available to you (including
[https://mibs.pysnmp.com/asn1/](https://mibs.pysnmp.com/asn1/)) for that purpose.
PySMI documentation can be found at [PySMI site](https://www.pysnmp.com/pysmi).

## How to get PySMI

Expand All @@ -190,8 +32,7 @@ available as a GitHub [repo](https://github.com/lextudio/pysmi).
You could `pip install pysmi` or download it from [PyPI](https://pypi.org/project/pysmi/).

If something does not work as expected,
[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub or
post your question [on Stack Overflow](https://stackoverflow.com/questions/ask).
[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub.

Copyright (c) 2015-2020, [Ilya Etingof](mailto:etingof@gmail.com).
Copyright (c) 2022-2024, [LeXtudio Inc.](mailto:support@lextudio.com).
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ packages = [
include = ["docs", "tests", "examples", "scripts"]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
ply = "^3.11"
Jinja2 = "^3.1.3"
requests = "^2.26.0"
Expand All @@ -38,7 +38,6 @@ pytest-cov = "^3.0.0"
black = "=22.3.0"
pre-commit = "2.21.0"
isort = "^5.10.1"
importlib-metadata = { version = ">=0.12", python = "<3.8" }
sphinx-sitemap-lextudio = "^2.5.2"
sphinx = "^5.0.0"
furo = "^2023.1.1"
Expand Down

0 comments on commit 1c0178f

Please sign in to comment.