nixos/test-driver: convert to pyproject from setup.py

This also makes configuration available if you just run those tools locally.
Also use ruff instead of pylint because it's faster and more
comprehensive.

Changed files
+45 -24
nixos
+10 -10
nixos/lib/test-driver/default.nix
···
, qemu_pkg ? qemu_test
, coreutils
, imagemagick_light
-
, libtiff
, netpbm
, qemu_test
, socat
+
, ruff
, tesseract4
, vde2
, extraPythonPackages ? (_ : [])
}:
-
python3Packages.buildPythonApplication rec {
+
python3Packages.buildPythonApplication {
pname = "nixos-test-driver";
version = "1.1";
src = ./.;
+
format = "pyproject";
propagatedBuildInputs = [
coreutils
···
++ extraPythonPackages python3Packages;
doCheck = true;
-
nativeCheckInputs = with python3Packages; [ mypy pylint black ];
+
nativeCheckInputs = with python3Packages; [ mypy ruff black ];
checkPhase = ''
-
mypy --disallow-untyped-defs \
-
--no-implicit-optional \
-
--pretty \
-
--no-color-output \
-
--ignore-missing-imports ${src}/test_driver
-
pylint --errors-only --enable=unused-import ${src}/test_driver
-
black --check --diff ${src}/test_driver
+
echo -e "\x1b[32m## run mypy\x1b[0m"
+
mypy test_driver extract-docstrings.py
+
echo -e "\x1b[32m## run ruff\x1b[0m"
+
ruff .
+
echo -e "\x1b[32m## run black\x1b[0m"
+
black --check --diff .
'';
}
+35
nixos/lib/test-driver/pyproject.toml
···
+
[build-system]
+
requires = ["setuptools"]
+
build-backend = "setuptools.build_meta"
+
+
[project]
+
name = "nixos-test-driver"
+
version = "0.0.0"
+
+
[project.scripts]
+
nixos-test-driver = "test_driver:main"
+
generate-driver-symbols = "test_driver:generate_driver_symbols"
+
+
[tool.setuptools.packages]
+
find = {}
+
+
[tool.setuptools.package-data]
+
test_driver = ["py.typed"]
+
+
[tool.ruff]
+
line-length = 88
+
+
select = ["E", "F", "I", "U", "N"]
+
ignore = ["E501"]
+
+
[tool.black]
+
line-length = 88
+
target-version = ['py39']
+
include = '\.pyi?$'
+
+
[tool.mypy]
+
python_version = "3.10"
+
warn_redundant_casts = true
+
disallow_untyped_calls = true
+
disallow_untyped_defs = true
+
no_implicit_optional = true
-14
nixos/lib/test-driver/setup.py
···
-
from setuptools import setup, find_packages
-
-
setup(
-
name="nixos-test-driver",
-
version='1.1',
-
packages=find_packages(),
-
package_data={"test_driver": ["py.typed"]},
-
entry_points={
-
"console_scripts": [
-
"nixos-test-driver=test_driver:main",
-
"generate-driver-symbols=test_driver:generate_driver_symbols"
-
]
-
},
-
)