[build-system]
requires = ["setuptools>=80", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "llvm-lnt"
dynamic = ["version"]
description = "LLVM Nightly Test Infrastructure"
readme = "README.md"
license = "LicenseRef-Apache-2.0-with-LLVM-exception"
license-files = ["LICENSE.TXT"]
authors = [
    { name = "Daniel Dunbar", email = "daniel@zuster.org" },
]
maintainers = []
keywords = ["web", "testing", "performance", "development", "llvm"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Environment :: Web Environment",
    "Intended Audience :: Developers",
    "Natural Language :: English",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Topic :: Software Development :: Quality Assurance",
    "Topic :: Software Development :: Testing",
]
requires-python = ">=3.10"
dependencies = [
    "aniso8601>=1.2.0",
    "certifi",
    "click>=8.1.0",
    "Flask-RESTful>=0.3.10",
    "Flask-WTF>=1.2.0",
    "Flask>=3.1.0",
    "Jinja2>=3.1.0",
    "MarkupSafe>=3.0.0",
    "PyYAML>=6.0.0",
    "requests",
    "SQLAlchemy==1.3.24",
    "typing",
    "Werkzeug>=3.1.0",
    "WTForms>=3.2.0",
]

[project.urls]
Homepage = "https://llvm.org"
Documentation = "https://llvm.org/docs/lnt"
Repository = "https://github.com/llvm/llvm-lnt"
"Bug Reports" = "https://github.com/llvm/llvm-lnt/issues"

[project.scripts]
lnt = "lnt.lnttool:main"

[project.optional-dependencies]
server = [
    "gunicorn>=19.9.0",
    "psycopg2>=2.9.0",
]
dev = [
    "build",
    "filecheck",
    "Flake8-pyproject",
    "flake8",
    "lit",
    "tox",
    "twine",
]

[tool.setuptools]
ext-modules = [
    {name = "lnt.testing.profile.cPerf", sources = ["lnt/testing/profile/cPerf.cpp"]}
]

[tool.setuptools.packages]
find = {namespaces = false}

[tool.setuptools.package-data]
"lnt.server.ui" = [
    "static/*.ico",
    "static/*.js",
    "static/*.css",
    "static/*.svg",
    "static/bootstrap/css/*.css",
    "static/bootstrap/js/*.js",
    "static/bootstrap/img/*.png",
    "static/flot/*.min.js",
    "static/plotly/*.min.js",
    "static/d3/*.min.js",
    "static/jquery/**/*.min.js",
    "templates/*.html",
    "templates/reporting/*.html",
    "templates/reporting/*.txt",
]
"lnt.server.db" = [
    "migrations/*.py"
]

[tool.setuptools_scm]
# This section is needed with older versions of Python, although it can be empty.

[tool.flake8]
ignore = ["E712", "E402", "E711", "E266", "W605", "E126", "E226", "W504"]
max-line-length = 120
count = true

[tool.mypy]
plugins = ["sqlmypy"]

[tool.tox]
env_list = ["py3", "mypy", "flake8", "docs"]

[tool.tox.env.py3]
description = "Run the unit tests"
allowlist_externals = ["rm", "lit"]
deps = [".[dev]"]
commands = [
    ["rm", "-rf", "test_run_tmp"],
    ["lit", "-sv", "tests"],
]

[tool.tox.env.flake8]
description = "Run linter on the codebase"
deps = [".[dev]"]
commands = [["flake8", "--statistics", "--exclude=./lnt/external/", "./lnt/", "./tests/", "./deployment/"]]
skip_install = true

[tool.tox.env.mypy]
description = "Typecheck the codebase"
# TODO: Make it possible to install [.dev] dependencies instead
deps = [
    "mypy",
    "sqlalchemy-stubs",
    "types-certifi",
    "types-PyYAML",
]
commands = [["mypy", "--ignore-missing-imports", "lnt"]]
skip_install = true

[tool.tox.env.docs]
description = "Build the documentation"
deps = [
    "sphinx==7",
    "sphinx_bootstrap_theme",
]
allowlist_externals = ["make"]
commands = [["make", "-C", "{toxinidir}/docs/", "html"]]
skip_install = true
