dts: add tools configuration
Add configuration for Python tools used in DTS: Poetry, dependency and package manager Black, formatter Pylama, static analysis Isort, import sorting Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
This commit is contained in:
parent
a39f5e1456
commit
bb5f299066
@ -1752,6 +1752,12 @@ M: Reshma Pattan <reshma.pattan@intel.com>
|
||||
F: app/proc-info/
|
||||
F: doc/guides/tools/proc_info.rst
|
||||
|
||||
DTS
|
||||
M: Lijuan Tu <lijuan.tu@intel.com>
|
||||
M: Owen Hilyard <ohilyard@iol.unh.edu>
|
||||
F: dts/
|
||||
F: doc/guides/tools/dts.rst
|
||||
|
||||
|
||||
Other Example Applications
|
||||
--------------------------
|
||||
|
@ -23,7 +23,7 @@ check_spdx() {
|
||||
':^.git*' ':^.ci/*' ':^.travis.yml' \
|
||||
':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \
|
||||
':^*/Kbuild' ':^*/README' \
|
||||
':^license/' ':^config/' ':^buildtools/' \
|
||||
':^license/' ':^config/' ':^buildtools/' ':^*/poetry.lock' \
|
||||
':^*.cocci' ':^*.abignore' \
|
||||
':^*.map' ':^*.ini' ':^*.data' ':^*.json' ':^*.cfg' ':^*.txt' \
|
||||
':^*.svg' ':^*.png' \
|
||||
|
56
doc/guides/tools/dts.rst
Normal file
56
doc/guides/tools/dts.rst
Normal file
@ -0,0 +1,56 @@
|
||||
.. SPDX-License-Identifier: BSD-3-Clause
|
||||
Copyright(c) 2022 PANTHEON.tech s.r.o.
|
||||
|
||||
DPDK Test Suite
|
||||
===============
|
||||
|
||||
The DPDK Test Suite, abbreviated DTS, is a Python test framework with test suites
|
||||
implementing functional and performance tests used to test DPDK.
|
||||
|
||||
|
||||
DTS Environment
|
||||
---------------
|
||||
|
||||
DTS is written entirely in Python using a variety of dependencies.
|
||||
DTS uses Poetry as its Python dependency management.
|
||||
Python build/development and runtime environments are the same and DTS development environment,
|
||||
DTS runtime environment or just plain DTS environment are used interchangeably.
|
||||
|
||||
|
||||
Setting up DTS environment
|
||||
--------------------------
|
||||
|
||||
#. **Python Version**
|
||||
|
||||
The Python Version required by DTS is specified in ``dts/pyproject.toml`` in the
|
||||
**[tool.poetry.dependencies]** section:
|
||||
|
||||
.. literalinclude:: ../../../dts/pyproject.toml
|
||||
:language: cfg
|
||||
:start-at: [tool.poetry.dependencies]
|
||||
:end-at: python
|
||||
|
||||
The Python dependency manager DTS uses, Poetry, doesn't install Python, so you may need
|
||||
to satisfy this requirement by other means if your Python is not up-to-date.
|
||||
A tool such as `Pyenv <https://github.com/pyenv/pyenv>`_ is a good way to get Python,
|
||||
though not the only one.
|
||||
|
||||
#. **Poetry**
|
||||
|
||||
The typical style of python dependency management, pip with ``requirements.txt``,
|
||||
has a few issues.
|
||||
The advantages of Poetry include specifying what Python version is required and forcing you
|
||||
to specify versions, enforced by a lockfile, both of which help prevent broken dependencies.
|
||||
Another benefit is the usage of ``pyproject.toml``, which has become the standard config file
|
||||
for python projects, improving project organization.
|
||||
To install Poetry, visit their `doc pages <https://python-poetry.org/docs/>`_.
|
||||
|
||||
#. **Getting a Poetry shell**
|
||||
|
||||
Once you have Poetry along with the proper Python version all set up, it's just a matter
|
||||
of installing dependencies via Poetry and using the virtual environment Poetry provides:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
poetry install
|
||||
poetry shell
|
@ -20,3 +20,4 @@ DPDK Tools User Guides
|
||||
comp_perf
|
||||
testeventdev
|
||||
testregex
|
||||
dts
|
||||
|
337
dts/poetry.lock
generated
Normal file
337
dts/poetry.lock
generated
Normal file
@ -0,0 +1,337 @@
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "22.1.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
|
||||
docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
|
||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"]
|
||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"]
|
||||
|
||||
[[package]]
|
||||
name = "black"
|
||||
version = "22.10.0"
|
||||
description = "The uncompromising code formatter."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
click = ">=8.0.0"
|
||||
mypy-extensions = ">=0.4.3"
|
||||
pathspec = ">=0.9.0"
|
||||
platformdirs = ">=2"
|
||||
tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""}
|
||||
|
||||
[package.extras]
|
||||
colorama = ["colorama (>=0.4.3)"]
|
||||
d = ["aiohttp (>=3.7.4)"]
|
||||
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
|
||||
uvloop = ["uvloop (>=0.15.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.3"
|
||||
description = "Composable command line interface toolkit"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
||||
|
||||
[[package]]
|
||||
name = "isort"
|
||||
version = "5.10.1"
|
||||
description = "A Python utility / library to sort Python imports."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6.1,<4.0"
|
||||
|
||||
[package.extras]
|
||||
pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
|
||||
requirements_deprecated_finder = ["pipreqs", "pip-api"]
|
||||
colors = ["colorama (>=0.4.3,<0.5.0)"]
|
||||
plugins = ["setuptools"]
|
||||
|
||||
[[package]]
|
||||
name = "jsonpatch"
|
||||
version = "1.32"
|
||||
description = "Apply JSON-Patches (RFC 6902)"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.dependencies]
|
||||
jsonpointer = ">=1.9"
|
||||
|
||||
[[package]]
|
||||
name = "jsonpointer"
|
||||
version = "2.3"
|
||||
description = "Identify specific nodes in a JSON document (RFC 6901)"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema"
|
||||
version = "4.17.0"
|
||||
description = "An implementation of JSON Schema validation for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
attrs = ">=17.4.0"
|
||||
pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2"
|
||||
|
||||
[package.extras]
|
||||
format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"]
|
||||
format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"]
|
||||
|
||||
[[package]]
|
||||
name = "mccabe"
|
||||
version = "0.7.0"
|
||||
description = "McCabe checker, plugin for flake8"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "mypy"
|
||||
version = "0.961"
|
||||
description = "Optional static typing for Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
mypy-extensions = ">=0.4.3"
|
||||
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
|
||||
typing-extensions = ">=3.10"
|
||||
|
||||
[package.extras]
|
||||
dmypy = ["psutil (>=4.0)"]
|
||||
python2 = ["typed-ast (>=1.4.0,<2)"]
|
||||
reports = ["lxml"]
|
||||
|
||||
[[package]]
|
||||
name = "mypy-extensions"
|
||||
version = "0.4.3"
|
||||
description = "Experimental type system extensions for programs checked with the mypy typechecker."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "pathspec"
|
||||
version = "0.10.1"
|
||||
description = "Utility library for gitignore style pattern matching of file paths."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "pexpect"
|
||||
version = "4.8.0"
|
||||
description = "Pexpect allows easy control of interactive console applications."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[package.dependencies]
|
||||
ptyprocess = ">=0.5"
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "2.5.2"
|
||||
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"]
|
||||
test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"]
|
||||
|
||||
[[package]]
|
||||
name = "ptyprocess"
|
||||
version = "0.7.0"
|
||||
description = "Run a subprocess in a pseudo terminal"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "pycodestyle"
|
||||
version = "2.9.1"
|
||||
description = "Python style guide checker"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "pydocstyle"
|
||||
version = "6.1.1"
|
||||
description = "Python docstring style checker"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
snowballstemmer = "*"
|
||||
|
||||
[package.extras]
|
||||
toml = ["toml"]
|
||||
|
||||
[[package]]
|
||||
name = "pyflakes"
|
||||
version = "2.5.0"
|
||||
description = "passive checker of Python programs"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "pylama"
|
||||
version = "8.4.1"
|
||||
description = "Code audit tool for python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
mccabe = ">=0.7.0"
|
||||
pycodestyle = ">=2.9.1"
|
||||
pydocstyle = ">=6.1.1"
|
||||
pyflakes = ">=2.5.0"
|
||||
|
||||
[package.extras]
|
||||
all = ["pylint", "eradicate", "radon", "mypy", "vulture"]
|
||||
eradicate = ["eradicate"]
|
||||
mypy = ["mypy"]
|
||||
pylint = ["pylint"]
|
||||
radon = ["radon"]
|
||||
tests = ["pytest (>=7.1.2)", "pytest-mypy", "eradicate (>=2.0.0)", "radon (>=5.1.0)", "mypy", "pylint (>=2.11.1)", "pylama-quotes", "toml", "vulture", "types-setuptools", "types-toml"]
|
||||
toml = ["toml (>=0.10.2)"]
|
||||
vulture = ["vulture"]
|
||||
|
||||
[[package]]
|
||||
name = "pyrsistent"
|
||||
version = "0.19.1"
|
||||
description = "Persistent/Functional/Immutable data structures"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "pyyaml"
|
||||
version = "6.0"
|
||||
description = "YAML parser and emitter for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[[package]]
|
||||
name = "snowballstemmer"
|
||||
version = "2.2.0"
|
||||
description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.10.2"
|
||||
description = "Python Library for Tom's Obvious, Minimal Language"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "tomli"
|
||||
version = "2.0.1"
|
||||
description = "A lil' TOML parser"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "types-pyyaml"
|
||||
version = "6.0.12.1"
|
||||
description = "Typing stubs for PyYAML"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.4.0"
|
||||
description = "Backported and Experimental Type Hints for Python 3.7+"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "warlock"
|
||||
version = "2.0.1"
|
||||
description = "Python object model built on JSON schema and JSON patch."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7,<4.0"
|
||||
|
||||
[package.dependencies]
|
||||
jsonpatch = ">=1,<2"
|
||||
jsonschema = ">=4,<5"
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.10"
|
||||
content-hash = "a0f040b07fc6ce4deb0be078b9a88c2a465cb6bccb9e260a67e92c2403e2319f"
|
||||
|
||||
[metadata.files]
|
||||
attrs = []
|
||||
black = []
|
||||
click = []
|
||||
colorama = []
|
||||
isort = []
|
||||
jsonpatch = []
|
||||
jsonpointer = []
|
||||
jsonschema = []
|
||||
mccabe = []
|
||||
mypy = []
|
||||
mypy-extensions = []
|
||||
pathspec = []
|
||||
pexpect = [
|
||||
{file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"},
|
||||
{file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"},
|
||||
]
|
||||
platformdirs = [
|
||||
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
|
||||
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
|
||||
]
|
||||
ptyprocess = []
|
||||
pycodestyle = []
|
||||
pydocstyle = []
|
||||
pyflakes = []
|
||||
pylama = []
|
||||
pyrsistent = []
|
||||
pyyaml = []
|
||||
snowballstemmer = []
|
||||
toml = []
|
||||
tomli = []
|
||||
types-pyyaml = []
|
||||
typing-extensions = []
|
||||
warlock = []
|
46
dts/pyproject.toml
Normal file
46
dts/pyproject.toml
Normal file
@ -0,0 +1,46 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# Copyright(c) 2022 University of New Hampshire
|
||||
|
||||
[tool.poetry]
|
||||
name = "dts"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Owen Hilyard <ohilyard@iol.unh.edu>", "dts@dpdk.org"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
pexpect = "^4.8.0"
|
||||
warlock = "^2.0.1"
|
||||
PyYAML = "^6.0"
|
||||
types-PyYAML = "^6.0.8"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
mypy = "^0.961"
|
||||
black = "^22.6.0"
|
||||
isort = "^5.10.1"
|
||||
pylama = "^8.4.1"
|
||||
pyflakes = "2.5.0"
|
||||
toml = "^0.10.2"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
dts = "main:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.pylama]
|
||||
linters = "pep8,pylint,mccabe,mypy,pycodestyle,pyflakes"
|
||||
format = "pylint"
|
||||
max_line_length = 88 # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.10"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
[tool.black]
|
||||
target-version = ['py310']
|
||||
include = '\.pyi?$'
|
||||
line-length = 88 # https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
|
Loading…
Reference in New Issue
Block a user