Skip to content

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
exhuma committed Jul 25, 2024
2 parents ebc5712 + b0a16a6 commit 99ec259
Show file tree
Hide file tree
Showing 50 changed files with 200 additions and 185 deletions.
3 changes: 1 addition & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/

RUN apt update && \
apt install -y entr snmp && \
pip install -U pip && \
pip install fabric pre-commit docutils
pip install -U pip

# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
Expand Down
20 changes: 3 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
Expand All @@ -15,34 +14,21 @@
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest"
"python.linting.pylintEnabled": true
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"tamasfe.even-better-toml"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
// "forwardPorts": [161],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash ./.devcontainer/init-devcontainer.bash",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
4 changes: 4 additions & 0 deletions .devcontainer/init-devcontainer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
# This script is executed in the root-folder (as non-root user) of the project
# when the container is created using the VS-Code Remote-Development extension.
# -----------------------------------------------------------------------------
pip install --user pipx
pipx install fabric
pipx install pre-commit
pipx install docutils
fab develop
pre-commit install
2 changes: 0 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
schedule:
- cron: '40 23 * * 1'

jobs:
analyze:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ name: Python package
on:
push:
pull_request:
schedule:
# Weekly run ensuring no external dependencies cause surprises
- cron: '0 0 * * 0'

jobs:
test:
Expand All @@ -26,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -39,20 +36,21 @@ jobs:
quality-control:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check black formatting
run: |
pip install black
black --check puresnmp
black --check src
- name: Lint with pylint
run: |
pip install pylint
pylint --reports=y --exit-zero puresnmp
pylint --reports=y --exit-zero src
publish:
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/exhuma/pre-commit-hooks
rev: b31e7670811fd7ac12ef10bea59c5ac0e3b1a212
rev: v1.0.0
hooks:
- id: prevent-debug-markers
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"ms-vscode-remote.vscode-remote-extensionpack"
"ms-vscode-remote.vscode-remote-extensionpack",
"tamasfe.even-better-toml"
]
}
9 changes: 4 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
"search.exclude": {
"**/__pycache__": true
},
"python.formatting.provider": "black",
"editor.rulers": [80],
"editor.rulers": [
80
],
"python.analysis.typeCheckingMode": "off",
"python.linting.mypyEnabled": true,
"python.testing.pytestArgs": [],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"esbonio.sphinx.confDir": ""
"editor.formatOnSave": true
}
14 changes: 2 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
----


TL;DR
-----

Jump right in with the `cookbook`_

----
For detailed information, see the documentation_


Quick Info
Expand Down Expand Up @@ -73,12 +67,8 @@ Package Version Numbers
As an important side-note, you might want to know that this project follows
`Semantic Versioning`_.

Examples
--------

See the `cookbook`_.

.. _cookbook: http://puresnmp.readthedocs.io/en/latest/cookbook/index.html
.. _documentation: http://puresnmp.readthedocs.io/en/latest
.. _Semantic Versioning: http://semver.org/spec/v2.0.0.html


Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Changelog
=========

Release 2.0.1
~~~~~~~~~~~~~

* **[added]** Add support for hostnames (instead of only IP-addresses)
* **[fixed]** Do not crash if ``sys.stdout`` is empty (f.ex. when running as
Windows service). Patch provided by M. Lehn.
* **[docs]** Minor fixes to the project documentation.
* **[support]** Add forwards-compatibility to Sphinx 8.0. Patch provided by J.
Addison.
Windows service). Patch provided by M. Lehn.
* **[support]** Add new import alias ``puresnmp.Auth`` and ``puresnmp.Priv``
for easier imports
* **[support]** Switch to "src" layout for the project source code.
* **[support]** Display more readable name for plugin-loaders
* **[support]** Minor type-check fixes


Release 2.0.0post1 - Maintenance release
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
9 changes: 6 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = "furo"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

intersphinx_mapping = {
"": ("https://docs.python.org/3/", None),
"python": ("https://docs.python.org/3/", None),
"x690": ("https://exhuma.github.io/x690/", None),
"puresnmp-crypto": ("https://exhuma.github.io/puresnmp-crypto/", None),
"puresnmp-crypto": (
"https://puresnmp-crypto.readthedocs.io/en/latest/",
None,
),
}
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ independent.
upgrading
changelog
API Docs <api/modules>
Plugins API <plugins_api/modules>



Expand Down
9 changes: 5 additions & 4 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from os import environ
from os.path import abspath
from typing import Any
from os import environ

import fabric

Expand All @@ -20,10 +20,11 @@ def regen_apidoc(ctx: Any, src: str, dest: str, is_nspkg: bool = False) -> None:
pty=True,
)


@fabric.task
def regen_all_api(ctx):
regen_apidoc(ctx, "puresnmp", "doc/api")
regen_apidoc(ctx, "puresnmp_plugins", "doc/plugins_api", True)
regen_apidoc(ctx, "src/puresnmp", "doc/api")
regen_apidoc(ctx, "src/puresnmp_plugins", "doc/plugins_api", True)


@fabric.task
Expand All @@ -38,7 +39,7 @@ def doc(ctx):
cmd = "{sphinx} -b html -d {builddir}/doctrees . {builddir}/html"

with ctx.cd("doc"):
ctx.run(cmd.format(**opts), replace_env=False, pty=False)
ctx.run(cmd.format(**opts), replace_env=False, pty=True)


@fabric.task
Expand Down
84 changes: 61 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"

[project]
name = "puresnmp"
version = "2.0.1"
authors = [
{ name = "Michel Albert", email = "[email protected]" },
{ name = "POST Luxembourg", email = "[email protected]" },
]
description = "Pure Python SNMP implementation"
keywords = ["networking", "snmp"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: System :: Networking",
"Topic :: System :: Networking :: Monitoring",
"Topic :: System :: Systems Administration",
]
license = { text = "MIT" }

requires-python = ">=3.6"
dependencies = [
'dataclasses; python_version < "3.7"',
'importlib_metadata; python_version < "3.8"',
'typing_extensions; python_version < "3.8"',
'x690 >= 1.0, <2.0',
]

[project.optional-dependencies]
readthedocs = ["fabric"]
crypto = ["puresnmp-crypto >= 1.0.1"]
dev = [
'asyncmock; python_version < "3.8"',
"black >= 20.8b1",
"fabric >= 2.6.0",
"furo",
"mypy",
"pylint",
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-dependency",
"sphinx",
"types-dataclasses",
]

[project.urls]
Homepage = "https://github.com/exhuma/puresnmp"
"Bug Tracker" = "https://github.com/exhuma/puresnmp/issues"
Repository = "https://github.com/exhuma/puresnmp"

[tool.black]
line_length = 80
line-length = 80

[tool.isort]
force_grid_wrap = 0
Expand All @@ -20,17 +78,7 @@ ignore-long-lines = ".*(https?://|VarBind|ObjectIdentifier|# type: ignore).*"
ignore = [".git", "env"]

[tool.pylint.basic]
good-names = [
"i",
"j",
"k",
"n",
"m",
"ex",
"ip",
"Run",
"_"
]
good-names = ["i", "j", "k", "n", "m", "ex", "ip", "Run", "_"]

[tool.pylint.reports]
output-format = "colorized"
Expand All @@ -45,14 +93,4 @@ asyncio_mode = "strict"
filterwarnings = ["error"]
minversion = "6.0"
# addopts = "--doctest-modules --cov=puresnmp --cov=puresnmp_plugins --cov-report=term-missing"
testpaths = [
"tests",
"puresnmp",
]

[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
testpaths = ["tests", "puresnmp"]
Loading

0 comments on commit 99ec259

Please sign in to comment.