зеркало из https://github.com/microsoft/lisa.git
Switch from poetry to setuptools / nox
This commit is contained in:
Родитель
0d023777af
Коммит
6617cec62a
6
.flake8
6
.flake8
|
@ -1,6 +0,0 @@
|
|||
[flake8]
|
||||
max-line-length = 88
|
||||
select = B,BLK,C90,E,F,I,W,N
|
||||
max-complexity = 15
|
||||
extend-ignore = E203
|
||||
exclude = .git,.venv,.vscode,__pycache__,runtime,*.pyi
|
|
@ -1,26 +1,33 @@
|
|||
# IDE Settings
|
||||
/.vscode
|
||||
/.dir-locals.el
|
||||
.vscode
|
||||
.dir-locals.el
|
||||
|
||||
# lisa runtime folder
|
||||
/runtime/*
|
||||
runtime/*
|
||||
|
||||
# python cache
|
||||
__pycache__
|
||||
*.py[co]
|
||||
|
||||
# it's auto generated by poetry
|
||||
lisa.egg-info
|
||||
# egg info
|
||||
*.egg-info
|
||||
|
||||
# code coverage result
|
||||
.coverage
|
||||
htmlcov
|
||||
|
||||
# html pages generated by sphinx
|
||||
/docs/_build
|
||||
docs/_build
|
||||
|
||||
# auto-generated test table & specifications
|
||||
/docs/run_test/test_summary.rst
|
||||
/docs/run_test/test_spec.rst
|
||||
docs/run_test/test_summary.rst
|
||||
docs/run_test/test_spec.rst
|
||||
|
||||
[.][v]env/
|
||||
[.][v]env/
|
||||
|
||||
# Virtual environments
|
||||
.nox
|
||||
|
||||
# Packaging directories
|
||||
build
|
||||
dist
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# This file provides fine-grain control over what files are included in a
|
||||
# Python source distribution (sdist).
|
||||
# For more details see https://packaging.python.org/en/latest/guides/using-manifest-in/
|
||||
|
||||
# These get included because they are tracked by git, so explicitly exclude
|
||||
prune .github
|
||||
exclude .git*
|
||||
|
||||
# Everything else tracked by git is include automatically by setuptools-scm
|
46
Makefile
46
Makefile
|
@ -1,46 +0,0 @@
|
|||
# This Makefile simply automates all our tasks. Its use is optional.
|
||||
|
||||
all: setup run test check
|
||||
|
||||
# Install Python packages
|
||||
setup:
|
||||
@poetry install --no-ansi --remove-untracked -E "azure libvirt doc legacy aws"
|
||||
|
||||
# Run LISA
|
||||
run:
|
||||
@poetry run python -X dev lisa/main.py --debug
|
||||
|
||||
# Run unit tests
|
||||
test:
|
||||
@poetry run python -X dev -m unittest discover
|
||||
|
||||
# Generate coverage report (slow, reruns LISA and tests)
|
||||
coverage:
|
||||
@poetry run coverage erase
|
||||
@poetry run coverage run lisa/main.py
|
||||
@poetry run coverage run --append -m unittest discover
|
||||
@poetry run coverage report --skip-empty --include=lisa*,examples*,microsoft/testsuites* --omit=lisa/tests/* --precision 2
|
||||
|
||||
# Run syntactic, semantic, formatting and type checkers
|
||||
check: flake8 mypy
|
||||
|
||||
# This also runs Black and isort via plugins
|
||||
flake8:
|
||||
@poetry run flake8
|
||||
|
||||
# This runs the static type checking
|
||||
mypy:
|
||||
@poetry run mypy --strict --exclude '.venv/.*' --namespace-packages --implicit-reexport --config-file pyproject.toml -p docs -p lisa -p microsoft
|
||||
|
||||
# Print current Python virtualenv
|
||||
venv:
|
||||
@poetry env list --no-ansi --full-path
|
||||
|
||||
# Auto fix style issues.
|
||||
fix: fix-isort fix-black
|
||||
|
||||
fix-isort:
|
||||
@poetry run isort ./lisa ./microsoft
|
||||
|
||||
fix-black:
|
||||
@poetry run black ./lisa ./microsoft
|
1
lisa.cmd
1
lisa.cmd
|
@ -1 +0,0 @@
|
|||
@poetry run python -m lisa.main %*
|
3
lisa.sh
3
lisa.sh
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
poetry run python3 lisa/main.py "$@"
|
|
@ -0,0 +1,211 @@
|
|||
"""
|
||||
Nox configuration file
|
||||
See https://nox.thea.codes/en/stable/config.html
|
||||
"""
|
||||
|
||||
import platform
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import nox
|
||||
import toml
|
||||
|
||||
CURRENT_PYTHON = sys.executable or f"{sys.version_info.major}.{sys.version_info.minor}"
|
||||
ON_WINDOWS = platform.system() == "Windows"
|
||||
|
||||
CONFIG = toml.load("pyproject.toml")
|
||||
DEPENDENCIES = CONFIG["project"]["dependencies"]
|
||||
OPTIONAL_DEPENDENCIES = CONFIG["project"]["optional-dependencies"]
|
||||
NOX_DEPENDENCIES = ("nox", "toml")
|
||||
|
||||
|
||||
# Global options
|
||||
nox.options.stop_on_first_error = False
|
||||
nox.options.error_on_missing_interpreters = False
|
||||
|
||||
# Require support for tags
|
||||
nox.needs_version = ">=2022.8.7"
|
||||
|
||||
|
||||
# --- Testing ---
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["test", "all"])
|
||||
def test(session: nox.Session) -> None:
|
||||
"""Run tests"""
|
||||
session.install(
|
||||
*DEPENDENCIES, *OPTIONAL_DEPENDENCIES["azure"], *OPTIONAL_DEPENDENCIES["test"]
|
||||
)
|
||||
session.run("python", "-m", "unittest", "discover")
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["test", "all"])
|
||||
def example(session: nox.Session) -> None:
|
||||
"""Run example"""
|
||||
session.install(".")
|
||||
session.run("lisa", "--debug")
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["all"])
|
||||
def coverage(session: nox.Session) -> None:
|
||||
"""Check test coverage"""
|
||||
session.install(
|
||||
*DEPENDENCIES,
|
||||
*OPTIONAL_DEPENDENCIES["azure"],
|
||||
*OPTIONAL_DEPENDENCIES["test"],
|
||||
"coverage",
|
||||
)
|
||||
|
||||
session.run("coverage", "erase")
|
||||
session.run("coverage", "run", "-m", "lisa")
|
||||
session.run("coverage", "run", "--append", "-m", "unittest", "discover")
|
||||
session.run("coverage", "report")
|
||||
|
||||
|
||||
# --- Formatting ---
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["format", "all"])
|
||||
def black(session: nox.Session) -> None:
|
||||
"""Run black"""
|
||||
session.install("black")
|
||||
session.run("black", ".")
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["format", "all"])
|
||||
def isort(session: nox.Session) -> None:
|
||||
"""Run isort"""
|
||||
session.install("isort")
|
||||
session.run("isort", ".")
|
||||
|
||||
|
||||
# --- Linting ---
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["lint", "all"])
|
||||
def flake8(session: nox.Session) -> None:
|
||||
"""Run flake8"""
|
||||
session.install(
|
||||
*OPTIONAL_DEPENDENCIES["flake8"],
|
||||
)
|
||||
session.run("flake8")
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["typing", "all"])
|
||||
def mypy(session: nox.Session) -> None:
|
||||
"""Run mypy"""
|
||||
session.install(
|
||||
*DEPENDENCIES,
|
||||
*OPTIONAL_DEPENDENCIES["azure"],
|
||||
*OPTIONAL_DEPENDENCIES["typing"],
|
||||
*NOX_DEPENDENCIES,
|
||||
"mypy == 0.942",
|
||||
)
|
||||
|
||||
session.run("mypy", "-p", "lisa")
|
||||
session.run("mypy", "docs", "microsoft")
|
||||
session.run("mypy", "noxfile.py")
|
||||
|
||||
|
||||
# --- Utility ---
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON, tags=["all"])
|
||||
def docs(session: nox.Session) -> None:
|
||||
"""Build docs"""
|
||||
session.install(
|
||||
*DEPENDENCIES,
|
||||
*OPTIONAL_DEPENDENCIES["docs"],
|
||||
*OPTIONAL_DEPENDENCIES["azure"],
|
||||
*OPTIONAL_DEPENDENCIES["aws"],
|
||||
)
|
||||
|
||||
session.run("sphinx-build", "-Eab", "html", "docs", "docs/_build/html")
|
||||
|
||||
|
||||
@nox.session(python=CURRENT_PYTHON)
|
||||
def dev(session: nox.Session) -> None:
|
||||
"""
|
||||
Create virtual environment for development
|
||||
Positional arguments determine which extras to install, default azure,libvirt
|
||||
Example:
|
||||
nox -vs dev -- libvirt
|
||||
"""
|
||||
|
||||
# Determine which extra dependencies to install
|
||||
if session.posargs:
|
||||
for arg in session.posargs:
|
||||
if arg not in OPTIONAL_DEPENDENCIES:
|
||||
session.error(f"'{arg}' is not a valid extra dependency group")
|
||||
|
||||
extras = ",".join(session.posargs)
|
||||
elif ON_WINDOWS:
|
||||
extras = "azure"
|
||||
else:
|
||||
extras = "azure,libvirt"
|
||||
|
||||
# Determine paths
|
||||
venv_path = ".venv"
|
||||
|
||||
if ON_WINDOWS:
|
||||
venv_python = str(Path(venv_path).resolve() / "Scripts" / "python.exe")
|
||||
else:
|
||||
venv_python = str(Path(venv_path).resolve() / "bin" / "python")
|
||||
|
||||
# Install virtualenv, it's used to create the final virtual environment
|
||||
session.install("virtualenv")
|
||||
|
||||
# Create virtual environment
|
||||
session.run(
|
||||
"virtualenv", "--python", str(session.python), "--prompt", "lisa", venv_path
|
||||
)
|
||||
|
||||
# Make sure pip and setuptools are up-to-date
|
||||
session.run(
|
||||
venv_python,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"--upgrade",
|
||||
"pip",
|
||||
"setuptools",
|
||||
external=True,
|
||||
)
|
||||
|
||||
# Editable install of lisa and dependencies
|
||||
session.run(
|
||||
venv_python,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"--editable",
|
||||
f".[{extras}]",
|
||||
external=True,
|
||||
)
|
||||
|
||||
# Install dev tools
|
||||
session.run(
|
||||
venv_python,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"mypy",
|
||||
"black",
|
||||
"isort",
|
||||
*OPTIONAL_DEPENDENCIES["flake8"],
|
||||
*OPTIONAL_DEPENDENCIES["typing"],
|
||||
*NOX_DEPENDENCIES,
|
||||
external=True,
|
||||
)
|
||||
|
||||
# Instruct user how to activate environment
|
||||
print("\nVirtual environment installed\nTo activate:\n")
|
||||
if ON_WINDOWS:
|
||||
print(
|
||||
f" {venv_path}\\Scripts\\activate.bat\n"
|
||||
" OR\n"
|
||||
f" {venv_path}\\Scripts\\activate.ps1\n"
|
||||
)
|
||||
|
||||
else:
|
||||
print(f" source {venv_path}/bin/activate\n")
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
222
pyproject.toml
222
pyproject.toml
|
@ -1,91 +1,145 @@
|
|||
[tool.poetry]
|
||||
name = "LISA"
|
||||
version = "3.0.0.dev1"
|
||||
[build-system]
|
||||
requires = ["setuptools >= 65", "setuptools_scm[toml] >= 6.2"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
|
||||
[project]
|
||||
name = "lisa"
|
||||
description = "Linux Integration Services Automation"
|
||||
authors = ["contributors <https://github.com/microsoft/lisa/graphs/contributors>"]
|
||||
license = "MIT"
|
||||
packages = [
|
||||
{ include = "lisa" },
|
||||
{ include = "microsoft" },
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Topic :: Software Development :: Testing",
|
||||
]
|
||||
dependencies = [
|
||||
"assertpy ~= 1.1",
|
||||
"func-timeout ~= 4.3.5",
|
||||
"dataclasses-json ~= 0.5.2",
|
||||
"paramiko ~= 2.10.1",
|
||||
"pluggy ~= 0.13.1",
|
||||
"python-dateutil ~= 2.8.1",
|
||||
"pytest-html >= 3.2.0",
|
||||
"PyYAML ~= 5.4.1",
|
||||
"randmac ~= 0.1",
|
||||
"retry ~= 0.9.2",
|
||||
"semver ~= 2.13.0",
|
||||
"spurplus ~= 2.3.4",
|
||||
"websockets ~= 10.3",
|
||||
]
|
||||
dynamic = ["version"]
|
||||
license = {text = "MIT"}
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.8, <3.11"
|
||||
|
||||
|
||||
[project.optional-dependencies]
|
||||
aws = [
|
||||
"boto3 ~= 1.21.37",
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
PyGObject = {version = "^3.38.0", platform = 'linux', optional=true}
|
||||
PyYAML = "^5.4.1"
|
||||
assertpy = "^1.1"
|
||||
azure-identity = {version = "^1.9.0", optional = true}
|
||||
azure-storage-blob = {version = "^12.11.0", optional = true}
|
||||
azure-mgmt-compute = {version = "^26.1.0", optional = true}
|
||||
azure-mgmt-marketplaceordering = {version = "^1.1.0", optional = true}
|
||||
azure-mgmt-network = {version = "^19.3.0", optional = true}
|
||||
azure-mgmt-resource = {version = "^21.0.0", optional = true}
|
||||
azure-mgmt-serialconsole = {version = "^1.0.0", optional = true}
|
||||
azure-mgmt-storage = {version = "^20.0.0", optional = true}
|
||||
azure-storage-file-share = {version = "12.4.0", optional = true}
|
||||
azure-mgmt-privatedns = {version="1.0.0", optional=true}
|
||||
cachetools = "^5.2.0"
|
||||
dataclasses-json = "^0.5.2"
|
||||
func-timeout = "^4.3.5"
|
||||
paramiko = "^2.10.1"
|
||||
pluggy = "^0.13.1"
|
||||
pypiwin32 = {version = "^223", platform = "win32", optional=true}
|
||||
pytest-html = "^3.1.1"
|
||||
python = ">=3.8,<4.0"
|
||||
python-dateutil = "^2.8.1"
|
||||
retry = "^0.9.2"
|
||||
spurplus = "^2.3.4"
|
||||
semver = "^2.13.0"
|
||||
types-toml = "^0.1.5"
|
||||
libvirt-python = {version = "^8.9.0", platform = 'linux', optional=true}
|
||||
pycdlib = "^1.12.0"
|
||||
randmac = "^0.1"
|
||||
toml = "^0.10.2"
|
||||
Pillow = {version="^9.0.0", optional=true}
|
||||
websockets = "^10.3"
|
||||
azure = [
|
||||
"azure-identity ~= 1.9.0",
|
||||
"azure-mgmt-compute ~= 26.1.0",
|
||||
"azure-mgmt-marketplaceordering ~= 1.1.0",
|
||||
"azure-mgmt-network ~= 19.3.0",
|
||||
"azure-mgmt-privatedns ~= 1.0.0",
|
||||
"azure-mgmt-resource ~= 21.0.0",
|
||||
"azure-mgmt-serialconsole ~= 1.0.0",
|
||||
"azure-mgmt-storage ~= 20.0.0",
|
||||
"azure-storage-blob ~= 12.11.0",
|
||||
"azure-storage-file-share ~= 12.4.0",
|
||||
"cachetools ~= 5.2.0",
|
||||
"requests",
|
||||
"Pillow ~= 9.0.0",
|
||||
"PyGObject ~= 3.38.0; platform_system == 'Linux'",
|
||||
]
|
||||
|
||||
# AWS related packages
|
||||
boto3 = {version = "^1.21.37", optional = true}
|
||||
boto3-stubs = {version = "^1.21.37", extras = ["essential"], optional = true}
|
||||
docs = [
|
||||
"Sphinx >= 4.1.0",
|
||||
"sphinx-argparse >= 0.2.5",
|
||||
"sphinx-rtd-theme >= 0.5.2",
|
||||
"sphinxemoji >= 0.1.8",
|
||||
"sphinx-copybutton >= 0.4.0",
|
||||
]
|
||||
|
||||
# dev dependencies. Optional isn't supported, so put them here.
|
||||
Sphinx = {version="^4.1.0", optional=true}
|
||||
sphinx-argparse = {version="^0.2.5", optional=true}
|
||||
sphinx-rtd-theme = {version="^0.5.2", optional=true}
|
||||
sphinxemoji = {version="^0.1.8", optional=true}
|
||||
sphinx-copybutton = {version="^0.4.0", optional=true}
|
||||
rstcheck = {version="^3.3.1", optional=true}
|
||||
types-Pillow = {version="^8.3.3", optional=true}
|
||||
flake8 = [
|
||||
"flake8 >= 4.0.1",
|
||||
"Flake8-pyproject",
|
||||
"flake8-black >= 0.3.2",
|
||||
"flake8-bugbear >= 22.3.23",
|
||||
"flake8-isort >= 4.1.1",
|
||||
"pep8-naming >= 0.12.1",
|
||||
]
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
black = "^22.3.0"
|
||||
coverage = "^5.3"
|
||||
flake8 = "^4.0.1"
|
||||
flake8-black = "^0.3.2"
|
||||
flake8-bugbear = "^22.3.23"
|
||||
flake8-isort = "^4.1.1"
|
||||
isort = "^5.10.1"
|
||||
mypy = "^0.942"
|
||||
pep8-naming = "^0.12.1"
|
||||
rope = "^1.0.0"
|
||||
types-retry = "^0.1.3"
|
||||
types-paramiko = "^0.1.7"
|
||||
types-requests = "^2.25.0"
|
||||
types-python-dateutil = "^0.1.4"
|
||||
types-PyYAML = "^5.4.3"
|
||||
types-cachetools = "^5.2.1"
|
||||
legacy = [
|
||||
"pypiwin32; platform_system == 'Windows'",
|
||||
]
|
||||
|
||||
libvirt = [
|
||||
"libvirt-python ~= 8.9.0; platform_system != 'Windows'",
|
||||
"pycdlib ~= 1.12.0; platform_system != 'Windows'",
|
||||
]
|
||||
|
||||
test = [
|
||||
]
|
||||
|
||||
typing = [
|
||||
"types-retry ~= 0.1.3",
|
||||
"types-paramiko ~= 0.1.7",
|
||||
"types-requests ~= 2.25.0",
|
||||
"types-python-dateutil ~= 0.1.4",
|
||||
"types-PyYAML ~= 5.4.3",
|
||||
"types-cachetools ~= 5.2.1",
|
||||
"types-Pillow ~= 8.3.3",
|
||||
"types-toml",
|
||||
"boto3-stubs ~= 1.21.37",
|
||||
"mypy-boto3-ec2",
|
||||
]
|
||||
|
||||
|
||||
[tool.poetry.extras]
|
||||
azure = ["azure-identity", "azure-storage-blob", "azure-mgmt-compute", "azure-mgmt-marketplaceordering", "azure-mgmt-network", "azure-mgmt-resource", "azure-mgmt-serialconsole", "azure-mgmt-storage", "azure-storage-file-share", "azure-mgmt-privatedns", "PyGObject", "Pillow", "types-Pillow"]
|
||||
libvirt = ["libvirt-python"]
|
||||
aws = ["boto3", "boto3-stubs"]
|
||||
legacy = ["pypiwin32"]
|
||||
doc = ["Sphinx", "sphinx-argparse", "sphinx-rtd-theme", "sphinxemoji", "sphinx-copybutton", "snooty-lextudio", "rstcheck"]
|
||||
[project.scripts]
|
||||
lisa = "lisa.main:cli"
|
||||
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/microsoft/lisa"
|
||||
documentation = "https://mslisa.readthedocs.io"
|
||||
|
||||
|
||||
[tool.black]
|
||||
line-length = 88
|
||||
target-version = ['py38']
|
||||
|
||||
|
||||
[tool.coverage.report]
|
||||
skip_empty = true
|
||||
include = [
|
||||
"lisa*",
|
||||
"examples*",
|
||||
"microsoft/testsuites*",
|
||||
]
|
||||
omit = [
|
||||
"lisa/tests/*",
|
||||
]
|
||||
precision = 2
|
||||
|
||||
|
||||
[tool.flake8]
|
||||
max-line-length = 88
|
||||
select = ["B", "BLK", "C90", "E", "F", "I", "W", "N"]
|
||||
max-complexity = 15
|
||||
extend-ignore = ["E203", "W503", "N818"]
|
||||
exclude = [
|
||||
".git",
|
||||
".nox",
|
||||
"__pycache__",
|
||||
"*.pyi",
|
||||
"runtime",
|
||||
".venv",
|
||||
".vscode",
|
||||
]
|
||||
|
||||
|
||||
[tool.isort]
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = true
|
||||
|
@ -94,13 +148,21 @@ use_parentheses = true
|
|||
ensure_newline_before_comments = true
|
||||
line_length = 88
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
|
||||
[tool.mypy]
|
||||
exclude = ".venv/.*"
|
||||
implicit_reexport = true
|
||||
mypy_path = "./typings"
|
||||
strict = true
|
||||
namespace_packages = true
|
||||
implicit_reexport = true
|
||||
show_column_numbers = true
|
||||
show_column_numbers = true
|
||||
explicit_package_bases = true
|
||||
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["lisa"]
|
||||
|
||||
|
||||
[tool.setuptools_scm]
|
||||
version_scheme = "post-release"
|
||||
local_scheme = "no-local-version"
|
||||
|
|
Загрузка…
Ссылка в новой задаче