forked from greatscottgadgets/python-usb-protocol
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chg: dev: move metadata to pyproject.toml, switch build system to hatch
* update CI workflow to use hatch cmds * add (optional) hatch env config to run tests * fix test discovery in pytest config, add fallback version Signed-off-by: Steve Arnold <[email protected]>
- Loading branch information
Showing
4 changed files
with
151 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[flake8] | ||
exclude = | ||
.git, | ||
__pycache__, | ||
examples, | ||
build, | ||
dist | ||
|
||
max-line-length = 250 | ||
max-complexity = 10 | ||
addons = file,open,basestring,xrange,unicode,long,cmp | ||
ignore = | ||
# line break before binary operator | ||
W503, | ||
# imported but unused | ||
F401, | ||
# star import used; unable to detect undefined names | ||
F403, | ||
# may be undefined, or defined from star imports | ||
F405, | ||
# too many leading '#' for block comment | ||
E266, | ||
# whitespace before ':' | ||
E203, | ||
# multiple spaces before operator | ||
E221, | ||
# multiple spaces after operator | ||
E222, | ||
# multiple spaces after ',' | ||
E241, | ||
# at least two spaces before inline comment | ||
E261, | ||
# multiple spaces after keyword | ||
E271, | ||
# multiple spaces before keyword | ||
E272, | ||
# too many blank lines | ||
E303, | ||
# expected 2 blank lines, found 1 | ||
E302, | ||
# expected 2 blank lines after class or function definition | ||
E305, | ||
# do not assign a lambda expression, use a def | ||
E731, | ||
# allow over/under indenting for now | ||
E126, | ||
E121, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[envs.default] | ||
dependencies = [ | ||
"coverage[toml]", | ||
"pytest", | ||
"hatch-vcs", | ||
] | ||
[envs.default.scripts] | ||
test = "pytest {args:usb_protocol}" | ||
test-cov = "coverage run -m pytest {args:usb_protocol}" | ||
cov-report = [ | ||
"- coverage combine", | ||
"coverage report --show-missing", | ||
] | ||
cov = [ | ||
"test-cov", | ||
"cov-report", | ||
] | ||
|
||
[[envs.all.matrix]] | ||
python = ["3.7", "3.8", "3.9", "3.10", "3.11"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,83 @@ | ||
[build-system] # these versions are valid on python 3.7 and up | ||
requires = [ | ||
"setuptools>=61", | ||
"setuptools_scm[toml]>=7", | ||
[project] | ||
name = "usb_protocol" | ||
description = "utilities, data structures, constants, parsers, and tools for working with USB data" | ||
dynamic = ["version"] | ||
dependencies = [ | ||
"construct", | ||
'importlib-metadata; python_version < "3.8"', | ||
] | ||
build-backend = "setuptools.build_meta" | ||
requires-python = ">=3.7" | ||
authors = [ | ||
{name = "Katherine J. Temkin", email = "[email protected]"}, | ||
{name = "Antoine van Gelder", email = "[email protected]"}, | ||
] | ||
|
||
readme = "README.md" | ||
license = {file = "LICENSE.txt"} | ||
|
||
classifiers = [ | ||
"Development Status :: 1 - Planning", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
"Environment :: Console", | ||
"Environment :: Plugins", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development", | ||
"Topic :: Security", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
|
||
[project.optional-dependencies] | ||
doc = [ | ||
"sphinx==7.2.6", | ||
"sphinx_rtd_theme==2.0.0", | ||
"sphinxcontrib-apidoc", | ||
"readthedocs-sphinx-search==0.3.2", | ||
"jinja2==3.1.3", | ||
] | ||
cov = [ | ||
"coverage[toml]", | ||
"coverage_python_version", | ||
] | ||
test = [ | ||
"pytest", | ||
"pytest-cov", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/greatscottgadgets/python-usb-protocol" | ||
Repository = "https://github.com/greatscottgadgets/python-usb-protocol.git" | ||
Issues = "https://github.com/greatscottgadgets/python-usb-protocol/issues" | ||
|
||
[tool.setuptools_scm] | ||
[build-system] | ||
requires = ["hatchling", "hatch-vcs"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.version] | ||
source = "vcs" | ||
fallback-version = "0.0.1" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
exclude = [ | ||
"/.github", | ||
"/.tox", | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["usb_protocol"] | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
testpaths = ["tests",] | ||
python_files = "*.py" | ||
testpaths = ["usb_protocol",] | ||
log_cli = true | ||
doctest_optionflags = ["ELLIPSIS", "NORMALIZE_WHITESPACE",] | ||
addopts = "--strict-markers" | ||
|
@@ -32,7 +100,7 @@ omit = [ | |
source = ["usb_protocol"] | ||
|
||
[tool.coverage.report] | ||
fail_under = 50 | ||
fail_under = 80 | ||
show_missing = true | ||
|
||
[tool.black] | ||
|
@@ -65,3 +133,6 @@ include_trailing_comma = true | |
force_grid_wrap = 0 | ||
use_parentheses = true | ||
ensure_newline_before_comments = true | ||
|
||
[tool.bandit] | ||
exclude_dirs = ["docs"] |