Commit a1666863 authored by Jörg Thalheim's avatar Jörg Thalheim
Browse files

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.
parent bf25d878
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -4,19 +4,20 @@
, 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
@@ -31,14 +32,13 @@ python3Packages.buildPythonApplication rec {
    ++ 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 −0
Original line number Diff line number Diff line
[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

nixos/lib/test-driver/setup.py

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
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"
    ]
  },
)