Compare commits

...

15 Commits

Author SHA1 Message Date
George Rawlinson c3e789682c
ci(drone): fix indentation
continuous-integration/drone/push Build is passing Details
2021-09-07 20:52:30 +00:00
George Rawlinson bc6f865481
ci(drone): initial pass at CI 2021-09-07 20:50:45 +00:00
George Rawlinson 4cd091c67a
chore: simplify Makefile 2021-04-01 15:02:26 +13:00
George Rawlinson 2e2a0d17a1
chore: update noxfile to reflect breaking changes of nox-poetry 2020-12-04 10:04:40 +13:00
George Rawlinson 79ccdf77c6
refactor: documentation generation 2020-11-24 14:39:38 +13:00
George Rawlinson 8cc7771389
chore: add link to documentation 2020-11-20 12:17:27 +13:00
George Rawlinson 9ec129a821
chore: update dependencies
certifi (2020.6.20 -> 2020.11.8)
urllib3 (1.25.11 -> 1.26.2)
babel (2.8.0 -> 2.9.0)
requests (2.24.0 -> 2.25.0)
regex (2020.10.28 -> 2020.11.13)
sphinx (3.3.0 -> 3.3.1)
2020-11-20 12:15:58 +13:00
George Rawlinson ff93806e0d
chore: update python version for RTD 2020-11-20 10:11:22 +13:00
George Rawlinson 7012690394
chore: fix RTD config 2020-11-20 10:08:36 +13:00
George Rawlinson d198d52a10
docs: generate readthedocs config 2020-11-20 10:07:32 +13:00
George Rawlinson 3441c7bee9
docs: add README to index & reference API 2020-11-20 07:53:58 +13:00
George Rawlinson 9101f47632
docs: use sphinx-rtd-theme 2020-11-20 07:53:28 +13:00
George Rawlinson 7fbe059c0a
docs: add API reference 2020-11-20 07:52:35 +13:00
George Rawlinson 186d9d761a
docs: add sphinx-rtd-theme as dependency 2020-11-20 07:51:57 +13:00
George Rawlinson ee759011b3
docs: add more documentation to classes 2020-11-20 07:50:15 +13:00
12 changed files with 285 additions and 159 deletions

11
.drone.yml Normal file
View File

@ -0,0 +1,11 @@
---
kind: pipeline
steps:
- name: test
image: python
commands:
- pip install poetry
- poetry install
- poetry run pytest

10
.readthedocs.yml Normal file
View File

@ -0,0 +1,10 @@
version: 2
sphinx:
configuration: docs/conf.py
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- path: .

View File

@ -1,40 +1,33 @@
.DEFAULT: help
.PHONY: help clean clean-pyc clean-build dist lint test tests docs
help:
@echo "clean : delete all artifacts"
@echo "clean-pyc : delete python cache artifacts"
@echo "clean-build : delete distribution artifacts"
@echo "dist : generate distribution artifacts"
@echo "lint : lint with black, flake8 & reorder-python-imports"
@echo "test : run tests with latest Python version"
@echo "coverage : run coverage tests with latest Python version"
@echo "tests : run tests with supported Python versions"
help: ## Display this help section
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-38s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
clean: clean-pyc clean-build
clean: clean-pyc clean-build ## Delete all artifacts
clean-pyc:
clean-pyc: ## Delete python cache artifacts
@find . -name '*.pyc' -delete
@find . -name '*.pyo' -delete
@find . -name __pycache__ -delete
clean-build:
clean-build: ## Delete distribution artifacts
@rm --force --recursive build dist src/*.egg-info docs/_build
dist: clean
dist: clean ## Generate distribution artifacts
poetry build
lint:
lint: ## Lint with black, flake8 & reorder-python-imports
nox -rs precommit
test:
test: ## Run tests with latest Python version
nox
coverage:
coverage: ## Run coverage tests with latest Python version
nox -rs coverage
tests:
tests: ## Run tests with all supported Python versions
nox -rs tests
docs:
nox -rs docs
docs: ## Run documentation generation
nox -rs docs

46
docs/api-reference.rst Normal file
View File

@ -0,0 +1,46 @@
===============
API Reference
===============
Classes
=======
Client
------
.. autoclass:: smbmc.Client
:members:
:inherited-members:
Sensor
------
.. autoclass:: smbmc.models.Sensor
Power Supply
------------
.. autoclass:: smbmc.models.PowerSupply
Enums & Flags
=============
SensorStateEnum
---------------
.. autoclass:: smbmc.models.SensorStateEnum
SensorUnitEnum
--------------
.. autoclass:: smbmc.models.SensorUnitEnum
SensorTypeEnum
--------------
.. autoclass:: smbmc.models.SensorTypeEnum
PowerSupplyFlag
---------------
.. autoclass:: smbmc.models.PowerSupplyFlag

View File

@ -1,9 +1,4 @@
"""Sphinx configuration."""
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
"""Configuration file for the Sphinx documentation builder."""
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -40,6 +35,7 @@ release = version
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_rtd_theme",
]
# Add any paths that contain templates here, relative to this directory.
@ -51,16 +47,12 @@ templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# Autoclass configuration
autoclass_content = "both"
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
html_theme = "sphinx_rtd_theme"
# 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,

View File

@ -1,18 +1,7 @@
Welcome to smbmc
================
.. autoclass:: smbmc.Client
:members:
:inherited-members:
.. include :: ../README.rst
.. toctree::
:hidden:
:maxdepth: 2
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
api-reference

2
docs/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
sphinx==3.3.1
sphinx-rtd-theme==0.5.0

View File

@ -1,11 +1,10 @@
"""Nox sessions."""
import functools
import os
import shutil
from pathlib import Path
from textwrap import dedent
import nox
import nox_poetry
import nox_poetry.patch
from nox.sessions import Session
# package name
@ -22,30 +21,6 @@ nox.options.reuse_existing_virtualenvs = True
locations = ["src", "tests", "noxfile.py", "docs/conf.py"]
@nox.session(python=supported_versions)
def tests(session: Session) -> None:
"""Run the test suite.
Args:
session: The Session object.
"""
nox_poetry.install(session, nox_poetry.WHEEL)
nox_poetry.install(session, "pytest", "betamax")
session.run("pytest")
@nox.session(python=latest_version)
def coverage(session: Session) -> None:
"""Generate coverage report.
Args:
session: The Session object.
"""
nox_poetry.install(session, nox_poetry.WHEEL)
nox_poetry.install(session, "pytest", "betamax", "pytest-cov", "coverage[toml]")
session.run("pytest", f"--cov={package}", "tests/")
def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
"""Activate virtualenv in hooks installed by pre-commit.
@ -97,6 +72,40 @@ def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
hook.write_text("\n".join(lines))
@nox.session(python=latest_version)
def safety(session: Session) -> None:
"""Scan dependencies for insecure packages.
Args:
session: The Session object.
"""
requirements = nox_poetry.export_requirements(session)
session.install(".", "safety")
session.run("safety", "check", f"--file={requirements}", "--bare")
@nox.session(python=supported_versions)
def tests(session: Session) -> None:
"""Run the test suite.
Args:
session: The Session object.
"""
session.install(".", "pytest", "betamax")
session.run("pytest")
@nox.session(python=latest_version)
def coverage(session: Session) -> None:
"""Generate coverage report.
Args:
session: The Session object.
"""
session.install(".", "pytest", "betamax", "pytest-cov", "coverage[toml]")
session.run("pytest", f"--cov={package}", "tests/")
@nox.session(python=latest_version)
def precommit(session: Session) -> None:
"""Lint using pre-commit.
@ -108,8 +117,8 @@ def precommit(session: Session) -> None:
"run",
"--all-files",
] # "--show-diff-on-failure"]
nox_poetry.install(
session,
session.install(
".",
"black",
"darglint",
"flake8",
@ -128,35 +137,34 @@ def precommit(session: Session) -> None:
@nox.session(python=latest_version)
def docs(session: Session) -> None:
def docs_build(session: Session) -> None:
"""Build the documentation.
Args:
session: The Session object.
"""
output_dir = os.path.join(session.create_tmp(), "output")
doctrees, html = map(
functools.partial(os.path.join, output_dir), ["doctrees", "html"]
)
session.run("rm", "-rf", output_dir, external=True)
args = session.posargs or ["docs", "docs/_build"]
session.install(".", "sphinx", "sphinx-rtd-theme")
nox_poetry.install(session, nox_poetry.WHEEL)
nox_poetry.install(session, "sphinx", "sphinx-autobuild")
session.cd("docs")
sphinx_args = [
"-b",
"html",
"-W",
"-d",
doctrees,
".",
html,
]
build_dir = Path("docs", "_build")
if build_dir.exists():
shutil.rmtree(build_dir)
if not session.interactive:
sphinx_cmd = "sphinx-build"
else:
sphinx_cmd = "sphinx-autobuild"
sphinx_args.insert(0, "--open-browser")
session.run("sphinx-build", *args)
session.run(sphinx_cmd, *sphinx_args)
@nox.session(python=latest_version)
def docs(session: Session) -> None:
"""Build and serve the documentation with live reloading on file changes.
Args:
session: The Session object.
"""
args = session.posargs or ["--open-browser", "docs", "docs/_build"]
session.install(".", "sphinx", "sphinx-autobuild", "sphinx-rtd-theme")
build_dir = Path("docs", "_build")
if build_dir.exists():
shutil.rmtree(build_dir)
session.run("sphinx-autobuild", *args)

122
poetry.lock generated
View File

@ -50,7 +50,7 @@ tests_no_zope = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0
[[package]]
name = "babel"
version = "2.8.0"
version = "2.9.0"
description = "Internationalization utilities"
category = "dev"
optional = false
@ -121,7 +121,7 @@ python-versions = "*"
[[package]]
name = "certifi"
version = "2020.6.20"
version = "2020.11.8"
description = "Python package for providing Mozilla's CA Bundle."
category = "main"
optional = false
@ -655,7 +655,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "regex"
version = "2020.10.28"
version = "2020.11.13"
description = "Alternative regular expression module, to replace re."
category = "dev"
optional = false
@ -674,7 +674,7 @@ python-versions = ">=3.6.1"
[[package]]
name = "requests"
version = "2.24.0"
version = "2.25.0"
description = "Python HTTP for Humans."
category = "main"
optional = false
@ -688,7 +688,7 @@ socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
certifi = ">=2017.4.17"
chardet = ">=3.0.2,<4"
idna = ">=2.5,<3"
urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
urllib3 = ">=1.21.1,<1.27"
[[package]]
name = "restructuredtext-lint"
@ -753,7 +753,7 @@ python-versions = "*"
[[package]]
name = "sphinx"
version = "3.3.0"
version = "3.3.1"
description = "Python documentation generator"
category = "dev"
optional = false
@ -798,6 +798,20 @@ test = ["pytest", "pytest-cov"]
livereload = "*"
sphinx = "*"
[[package]]
name = "sphinx-rtd-theme"
version = "0.5.0"
description = "Read the Docs theme for Sphinx"
category = "dev"
optional = false
python-versions = "*"
[package.extras]
dev = ["transifex-client", "sphinxcontrib-httpdomain", "bump2version"]
[package.dependencies]
sphinx = "*"
[[package]]
name = "sphinxcontrib-applehelp"
version = "1.0.2"
@ -919,7 +933,7 @@ python-versions = "*"
[[package]]
name = "urllib3"
version = "1.25.11"
version = "1.26.2"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "main"
optional = false
@ -972,7 +986,7 @@ testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pyt
[metadata]
lock-version = "1.0"
python-versions = "^3.6.1"
content-hash = "d42a9e4480b364cd2fcc929659360b991f7e69c575d6a5a1b73be71729b9c714"
content-hash = "ab267246dee02c781accfe100d67fc3931792b537483bfa71d2aaa1f469353ad"
[metadata.files]
alabaster = [
@ -996,8 +1010,8 @@ attrs = [
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
]
babel = [
{file = "Babel-2.8.0-py2.py3-none-any.whl", hash = "sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4"},
{file = "Babel-2.8.0.tar.gz", hash = "sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38"},
{file = "Babel-2.9.0-py2.py3-none-any.whl", hash = "sha256:9d35c22fcc79893c3ecc85ac4a56cde1ecf3f19c540bba0922308a6c06ca6fa5"},
{file = "Babel-2.9.0.tar.gz", hash = "sha256:da031ab54472314f210b0adcff1588ee5d1d1d0ba4dbd07b94dba82bde791e05"},
]
bandit = [
{file = "bandit-1.6.2-py2.py3-none-any.whl", hash = "sha256:336620e220cf2d3115877685e264477ff9d9abaeb0afe3dc7264f55fa17a3952"},
@ -1015,8 +1029,8 @@ cached-property = [
{file = "cached_property-1.5.2-py2.py3-none-any.whl", hash = "sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0"},
]
certifi = [
{file = "certifi-2020.6.20-py2.py3-none-any.whl", hash = "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"},
{file = "certifi-2020.6.20.tar.gz", hash = "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"},
{file = "certifi-2020.11.8-py2.py3-none-any.whl", hash = "sha256:1f422849db327d534e3d0c5f02a263458c3955ec0aae4ff09b95f195c59f4edd"},
{file = "certifi-2020.11.8.tar.gz", hash = "sha256:f05def092c44fbf25834a51509ef6e631dc19765ab8a57b4e7ab85531f0a9cf4"},
]
cfgv = [
{file = "cfgv-3.2.0-py2.py3-none-any.whl", hash = "sha256:32e43d604bbe7896fe7c248a9c2276447dbef840feb28fe20494f62af110211d"},
@ -1278,41 +1292,55 @@ pyyaml = [
{file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"},
]
regex = [
{file = "regex-2020.10.28-cp27-cp27m-win32.whl", hash = "sha256:4b5a9bcb56cc146c3932c648603b24514447eafa6ce9295234767bf92f69b504"},
{file = "regex-2020.10.28-cp27-cp27m-win_amd64.whl", hash = "sha256:c13d311a4c4a8d671f5860317eb5f09591fbe8259676b86a85769423b544451e"},
{file = "regex-2020.10.28-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:c8a2b7ccff330ae4c460aff36626f911f918555660cc28163417cb84ffb25789"},
{file = "regex-2020.10.28-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4afa350f162551cf402bfa3cd8302165c8e03e689c897d185f16a167328cc6dd"},
{file = "regex-2020.10.28-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b88fa3b8a3469f22b4f13d045d9bd3eda797aa4e406fde0a2644bc92bbdd4bdd"},
{file = "regex-2020.10.28-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:f43109822df2d3faac7aad79613f5f02e4eab0fc8ad7932d2e70e2a83bd49c26"},
{file = "regex-2020.10.28-cp36-cp36m-win32.whl", hash = "sha256:8092a5a06ad9a7a247f2a76ace121183dc4e1a84c259cf9c2ce3bbb69fac3582"},
{file = "regex-2020.10.28-cp36-cp36m-win_amd64.whl", hash = "sha256:49461446b783945597c4076aea3f49aee4b4ce922bd241e4fcf62a3e7c61794c"},
{file = "regex-2020.10.28-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:8ca9dca965bd86ea3631b975d63b0693566d3cc347e55786d5514988b6f5b84c"},
{file = "regex-2020.10.28-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ea37320877d56a7f0a1e6a625d892cf963aa7f570013499f5b8d5ab8402b5625"},
{file = "regex-2020.10.28-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:3a5f08039eee9ea195a89e180c5762bfb55258bfb9abb61a20d3abee3b37fd12"},
{file = "regex-2020.10.28-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:cb905f3d2e290a8b8f1579d3984f2cfa7c3a29cc7cba608540ceeed18513f520"},
{file = "regex-2020.10.28-cp37-cp37m-win32.whl", hash = "sha256:a62162be05edf64f819925ea88d09d18b09bebf20971b363ce0c24e8b4aa14c0"},
{file = "regex-2020.10.28-cp37-cp37m-win_amd64.whl", hash = "sha256:03855ee22980c3e4863dc84c42d6d2901133362db5daf4c36b710dd895d78f0a"},
{file = "regex-2020.10.28-cp38-cp38-manylinux1_i686.whl", hash = "sha256:625116aca6c4b57c56ea3d70369cacc4d62fead4930f8329d242e4fe7a58ce4b"},
{file = "regex-2020.10.28-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2dc522e25e57e88b4980d2bdd334825dbf6fa55f28a922fc3bfa60cc09e5ef53"},
{file = "regex-2020.10.28-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:119e0355dbdd4cf593b17f2fc5dbd4aec2b8899d0057e4957ba92f941f704bf5"},
{file = "regex-2020.10.28-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:cfcf28ed4ce9ced47b9b9670a4f0d3d3c0e4d4779ad4dadb1ad468b097f808aa"},
{file = "regex-2020.10.28-cp38-cp38-win32.whl", hash = "sha256:06b52815d4ad38d6524666e0d50fe9173533c9cc145a5779b89733284e6f688f"},
{file = "regex-2020.10.28-cp38-cp38-win_amd64.whl", hash = "sha256:c3466a84fce42c2016113101018a9981804097bacbab029c2d5b4fcb224b89de"},
{file = "regex-2020.10.28-cp39-cp39-manylinux1_i686.whl", hash = "sha256:c2c6c56ee97485a127555c9595c069201b5161de9d05495fbe2132b5ac104786"},
{file = "regex-2020.10.28-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1ec66700a10e3c75f1f92cbde36cca0d3aaee4c73dfa26699495a3a30b09093c"},
{file = "regex-2020.10.28-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:11116d424734fe356d8777f89d625f0df783251ada95d6261b4c36ad27a394bb"},
{file = "regex-2020.10.28-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f1fce1e4929157b2afeb4bb7069204d4370bab9f4fc03ca1fbec8bd601f8c87d"},
{file = "regex-2020.10.28-cp39-cp39-win32.whl", hash = "sha256:832339223b9ce56b7b15168e691ae654d345ac1635eeb367ade9ecfe0e66bee0"},
{file = "regex-2020.10.28-cp39-cp39-win_amd64.whl", hash = "sha256:654c1635f2313d0843028487db2191530bca45af61ca85d0b16555c399625b0e"},
{file = "regex-2020.10.28.tar.gz", hash = "sha256:dd3e6547ecf842a29cf25123fbf8d2461c53c8d37aa20d87ecee130c89b7079b"},
{file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"},
{file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"},
{file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"},
{file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"},
{file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"},
{file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"},
{file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"},
{file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"},
{file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"},
{file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"},
{file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"},
{file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"},
{file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"},
{file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"},
{file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"},
{file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"},
{file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"},
]
reorder-python-imports = [
{file = "reorder_python_imports-2.3.6-py2.py3-none-any.whl", hash = "sha256:1299c31adf341eba2c17543e3cc7fab7389766e726ab54d20440917b5b96b5c5"},
{file = "reorder_python_imports-2.3.6.tar.gz", hash = "sha256:2ea16d2253536e7f90427b383cd046e46977ca25aae82464883eee882bc7d21b"},
]
requests = [
{file = "requests-2.24.0-py2.py3-none-any.whl", hash = "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"},
{file = "requests-2.24.0.tar.gz", hash = "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"},
{file = "requests-2.25.0-py2.py3-none-any.whl", hash = "sha256:e786fa28d8c9154e6a4de5d46a1d921b8749f8b74e28bde23768e5e16eece998"},
{file = "requests-2.25.0.tar.gz", hash = "sha256:7f1a0b932f4a60a1a65caa4263921bb7d9ee911957e0ae4a23a6dd08185ad5f8"},
]
restructuredtext-lint = [
{file = "restructuredtext_lint-1.3.1.tar.gz", hash = "sha256:470e53b64817211a42805c3a104d2216f6f5834b22fe7adb637d1de4d6501fb8"},
@ -1358,13 +1386,17 @@ snowballstemmer = [
{file = "snowballstemmer-2.0.0.tar.gz", hash = "sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"},
]
sphinx = [
{file = "Sphinx-3.3.0-py3-none-any.whl", hash = "sha256:3abdb2c57a65afaaa4f8573cbabd5465078eb6fd282c1e4f87f006875a7ec0c7"},
{file = "Sphinx-3.3.0.tar.gz", hash = "sha256:1c21e7c5481a31b531e6cbf59c3292852ccde175b504b00ce2ff0b8f4adc3649"},
{file = "Sphinx-3.3.1-py3-none-any.whl", hash = "sha256:d4e59ad4ea55efbb3c05cde3bfc83bfc14f0c95aa95c3d75346fcce186a47960"},
{file = "Sphinx-3.3.1.tar.gz", hash = "sha256:1e8d592225447104d1172be415bc2972bd1357e3e12fdc76edf2261105db4300"},
]
sphinx-autobuild = [
{file = "sphinx-autobuild-2020.9.1.tar.gz", hash = "sha256:4b184a7db893f2100bbd831991ae54ca89167a2b9ce68faea71eaa9e37716aed"},
{file = "sphinx_autobuild-2020.9.1-py3-none-any.whl", hash = "sha256:df5c72cb8b8fc9b31279c4619780c4e95029be6de569ff60a8bb2e99d20f63dd"},
]
sphinx-rtd-theme = [
{file = "sphinx_rtd_theme-0.5.0-py2.py3-none-any.whl", hash = "sha256:373413d0f82425aaa28fb288009bf0d0964711d347763af2f1b65cafcb028c82"},
{file = "sphinx_rtd_theme-0.5.0.tar.gz", hash = "sha256:22c795ba2832a169ca301cd0a083f7a434e09c538c70beb42782c073651b707d"},
]
sphinxcontrib-applehelp = [
{file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"},
{file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"},
@ -1469,8 +1501,8 @@ typing-extensions = [
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
]
urllib3 = [
{file = "urllib3-1.25.11-py2.py3-none-any.whl", hash = "sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e"},
{file = "urllib3-1.25.11.tar.gz", hash = "sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2"},
{file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"},
{file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"},
]
virtualenv = [
{file = "virtualenv-20.1.0-py2.py3-none-any.whl", hash = "sha256:b0011228208944ce71052987437d3843e05690b2f23d1c7da4263fde104c97a2"},

View File

@ -4,6 +4,7 @@ version = "0.2.0"
description = "Supermicro BMC interface"
authors = ["George Rawlinson <george@rawlinson.net.nz>"]
repository = "https://github.com/grawlinson/smbmc"
documentation = "https://smbmc.readthedocs.io"
readme = "README.rst"
classifiers = [
"Development Status :: 4 - Beta",
@ -42,6 +43,7 @@ reorder-python-imports = "^2.3.5"
darglint = "^1.5.5"
sphinx = "^3.2.1"
sphinx-autobuild = "^2020.9.1"
sphinx-rtd-theme = "^0.5.0"
[tool.coverage.paths]
source = ["src", "*/site-packages"]

View File

@ -24,6 +24,7 @@ class Client:
username: Username.
password: Password.
session_timeout: Session timeout of the BMC (in minutes).
default: 30 minutes.
"""
self.server = server
self.username = username
@ -84,7 +85,8 @@ class Client:
"""Acquire metrics for all power supplies.
Returns:
str: XML response.
list[PowerSupply]: All power supplies available on the PMBus
interface.
"""
r = self._query(
data={
@ -101,7 +103,7 @@ class Client:
"""Acquire metrics for all sensors.
Returns:
str: XML response.
list[Sensor]: A list of all sensors available to the BMC.
"""
r = self._query(
data={
@ -115,7 +117,7 @@ class Client:
return sensors
def get_metrics(self, metrics=["pmbus", "sensor"]): # noqa: C901
"""Fetch metrics with minimum network calls.
"""Fetch all metrics available.
Args:
metrics: List of metric(s) to query.

View File

@ -4,7 +4,14 @@ from enum import IntFlag
class SensorStateEnum(IntEnum):
"""Enumeration of sensor states."""
"""Enumeration of sensor states.
Possible Values:
- Unspecified
- Present
- Not Present
"""
UNSPECIFIED = 0
PRESENT = 1
@ -12,7 +19,17 @@ class SensorStateEnum(IntEnum):
class SensorUnitEnum(IntEnum):
"""Enumeration of sensor units."""
"""Enumeration of sensor units.
Possible Values:
- Unspecified
- degrees Celsius (°C)
- Volts (V)
- Amps (A)
- Watts (W)
- revolutions per minute (rpm)
"""
UNSPECIFIED = 0
DEGREES_CELSIUS = 1
@ -23,7 +40,16 @@ class SensorUnitEnum(IntEnum):
class SensorTypeEnum(IntEnum):
"""Enumeration of sensor types."""
"""Enumeration of sensor types.
Possible Values:
- Unspecified
- Temperature
- Voltage
- Fan
- Power Supply
"""
UNSPECIFIED = 0
TEMPERATURE = 1
@ -33,7 +59,20 @@ class SensorTypeEnum(IntEnum):
class PowerSupplyFlag(IntFlag):
"""Flags for power supply specific events."""
"""Bitflag for power supply specific events.
Flags:
- Unspecified
- Presence Detected
- Failure
- Predictive Failure
- Source Input Lost
- Source Input Out of Range
- Source Input Detected (Out of Range)
- Configuration Error
- Standby
"""
UNSPECIFIED = 0
PRESENCE_DETECTED = 1
@ -53,16 +92,16 @@ class Sensor:
id: Psuedo-unique id.
name: Sensor name.
type: Sensor type.
unit: Reading unit. e.g. Temperature - degrees Celsius.
unit: Reading unit.
state: Sensor state.
flags: Discrete sensors only; type specific flags.
reading: Sensor reading.
lnr: Lower non-recoverable indicator.
lc: Lower critical indicator.
lnc: Lower non-critical indicator.
unc: Upper non-critical indicator.
uc: Upper critical indicator.
unr: Upper non-recoverable indicator.
lnr: Lower non-recoverable threshold.
lc: Lower critical threshold.
lnc: Lower non-critical threshold.
unc: Upper non-critical threshold.
uc: Upper critical threshold.
unr: Upper non-recoverable threshold.
"""
def __init__(self):
@ -97,10 +136,10 @@ class PowerSupply:
output_voltage: Output voltage (V_DC).
output_current: Output current (A).
output_power: Output power (W).
temp_1: Temperature 1. Possibly intake (degrees Celsius).
temp_2: Temperature 2. Possibly outlet (degrees Celsius).
fan_1: Fan 1. Possibly intake (r.p.m.).
fan_2: Fan 2. Possibly outlet (r.p.m.).
temp_1: Temperature 1. Possibly intake (°C).
temp_2: Temperature 2. Possibly outlet (°C).
fan_1: Fan 1. Possibly intake (rpm).
fan_2: Fan 2. Possibly outlet (rpm).
"""
def __init__(self):