Skip to content

Commit 8ef65dc

Browse files
committed
Rewrite project build and metadata using pyproject.toml
This patch rewrites the project build configuration using pyproject.toml, which is now the de-facto standard in Python. This single configuration file supersedes setup.py, tox.ini, mypy.ini, etc. I checked the contents of the generated package and made sure they matched exactly (that caught a few issues where I originally excluded some data files). This patch is careful not to change the version of dependencies. In pyproject.toml, we specify minimum package versions for the tool to work, and we provide a requirements.txt file that pins down specific versions for use by end-users. Currently, a few tests are failing if we don't pin exact versions when running them, so we're still pinning exact versions when we run tests via tox. The same holds for the type checker. In the future, we could upgrade towards a proper lockfile instead of manually constructed requirements.txt files. Fixes #77
1 parent 8aba409 commit 8ef65dc

File tree

8 files changed

+169
-235
lines changed

8 files changed

+169
-235
lines changed

MANIFEST.in

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
LLVM "Nightly Test" Infrastructure
2-
==================================
1+
LNT: LLVM "Nightly Test" Infrastructure
2+
=======================================
33

4-
This directory and its subdirectories contain the LLVM nightly test
5-
infrastructure. This is technically version "4.0" of the LLVM nightly test
6-
architecture.
4+
About
5+
=====
76

8-
The infrastructure has the following layout:
7+
*LNT* is an infrastructure for performance testing. The software itself
8+
consists of two main parts, a web application for accessing and visualizing
9+
performance data, and command line utilities to allow users to generate and
10+
submit test results to the server.
911

10-
$ROOT/lnt - Top-level Python 'lnt' module
12+
The package was originally written for use in testing LLVM compiler
13+
technologies, but is designed to be usable for the performance testing of any
14+
software.
1115

12-
$ROOT/lnt/server/db - Database schema, utilities, and examples of the LNT plist format.
1316

14-
$ROOT/docs - Sphinx documentation for LNT.
17+
Documentation
18+
=============
1519

16-
$ROOT/tests - Tests for the infrastructure.
20+
The official *LNT* documentation is available online at:
21+
https://llvm.org/docs/lnt
1722

18-
For more information, see the web documentation, or docs/.
1923

20-
Testing
21-
=======
24+
Source
25+
======
2226

23-
Testing is done by running tox from the top-level directory. It runs the tests
24-
for Python 3 and checks code style.
27+
The *LNT* source is available in the llvm-lnt repository:
28+
https://github.com/llvm/llvm-lnt

docs/developer_guide.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ To run the tests, we recomment using ``tox`` in a virtual environment::
3434

3535
You can also run individual unit tests with ``lit`` directly::
3636

37-
pip install lit
38-
lit -sv ./tests
39-
40-
However, that requires manually setting up the testing environment (``filecheck``, etc).
37+
pip install ".[dev]"
38+
lit -sv tests
4139

4240
For simple changes, adding a regression test and making sure all regression
4341
tests pass, is often a good enough testing approach. For some changes, the

mypy.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
[build-system]
2+
requires = ["setuptools >= 74.1"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "LNT"
7+
version = "0.4.2.dev0"
8+
description = "LLVM Nightly Test Infrastructure"
9+
readme = "README.md"
10+
license = "LicenseRef-Apache-2.0-with-LLVM-exception"
11+
license-files = ["LICENSE.TXT"]
12+
authors = [
13+
{ name = "Daniel Dunbar", email = "[email protected]" },
14+
]
15+
maintainers = []
16+
keywords = ["web", "testing", "performance", "development", "llvm"]
17+
classifiers = [
18+
"Development Status :: 4 - Beta",
19+
"Environment :: Web Environment",
20+
"Intended Audience :: Developers",
21+
"Natural Language :: English",
22+
"Operating System :: OS Independent",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"Topic :: Software Development :: Quality Assurance",
28+
"Topic :: Software Development :: Testing",
29+
]
30+
requires-python = ">=3.10"
31+
dependencies = [
32+
"aniso8601>=1.2.0",
33+
"certifi",
34+
"click>=8.1.0",
35+
"Flask-RESTful>=0.3.10",
36+
"Flask-WTF>=1.2.0",
37+
"Flask>=3.1.0",
38+
"Jinja2>=3.1.0",
39+
"MarkupSafe>=3.0.0",
40+
"python-gnupg>=0.3.7",
41+
"pyyaml>=6.0.0",
42+
"requests",
43+
"SQLAlchemy==1.3.24",
44+
"typing",
45+
"Werkzeug>=3.1.0",
46+
"WTForms>=3.2.0",
47+
]
48+
49+
[project.urls]
50+
Homepage = "https://llvm.org"
51+
Documentation = "https://llvm.org/docs/lnt"
52+
Repository = "https://github.com/llvm/llvm-lnt"
53+
"Bug Reports" = "https://github.com/llvm/llvm-lnt/issues"
54+
55+
[project.scripts]
56+
lnt = "lnt.lnttool:main"
57+
58+
[project.optional-dependencies]
59+
server = [
60+
"gunicorn>=19.9.0",
61+
"psycopg2>=2.9.0",
62+
]
63+
dev = [
64+
"filecheck",
65+
"Flake8-pyproject",
66+
"flake8",
67+
"lit",
68+
"tox",
69+
]
70+
71+
[tool.setuptools]
72+
ext-modules = [
73+
{name = "lnt.testing.profile.cPerf", sources = ["lnt/testing/profile/cPerf.cpp"]}
74+
]
75+
76+
[tool.setuptools.packages]
77+
find = {namespaces = false}
78+
79+
[tool.setuptools.package-data]
80+
"lnt.server.ui" = [
81+
"README.md",
82+
"requirements.client.txt",
83+
"requirements.server.txt",
84+
"docs/*",
85+
"examples/*",
86+
"lnt/server/ui/static/*",
87+
"lnt/server/ui/templates/*",
88+
"lnt/external/stats/README.txt",
89+
]
90+
"lnt.server.db" = [
91+
"lnt/server/db/migrations/*",
92+
]
93+
94+
[tool.flake8]
95+
ignore = ["E712", "E402", "E711", "E266", "W605", "E126", "E226", "W504"]
96+
max-line-length = 120
97+
count = true
98+
99+
[tool.mypy]
100+
plugins = ["sqlmypy"]
101+
102+
[tool.tox]
103+
env_list = ["py3", "mypy", "flake8", "docs"]
104+
105+
[tool.tox.env.py3]
106+
description = "Run the unit tests"
107+
allowlist_externals = ["rm", "lit"]
108+
# TODO: Make it possible to run the tests without pinning down all dependencies
109+
deps = [
110+
"-r requirements.txt",
111+
".[dev]",
112+
]
113+
commands = [
114+
["rm", "-rf", "test_run_tmp"],
115+
["lit", "-sv", "tests"],
116+
]
117+
118+
[tool.tox.env.flake8]
119+
description = "Run linter on the codebase"
120+
deps = [".[dev]"]
121+
commands = [["flake8", "--statistics", "--exclude=./lnt/external/", "./lnt/", "./tests/", "./deployment/"]]
122+
skip_install = true
123+
124+
[tool.tox.env.mypy]
125+
description = "Typecheck the codebase"
126+
# TODO: Make it possible to install [.dev] dependencies instead
127+
deps = [
128+
"mypy >= 0.910",
129+
"sqlalchemy-stubs",
130+
"types-certifi",
131+
"types-PyYAML",
132+
]
133+
# The option --no-incremental is currently needed to suppress warnings
134+
# about UpdatedBase when running tests several times. Future versions of
135+
# mypy should be checked to see if it can be removed and not get
136+
# warnings after running tox several times.
137+
commands = [["mypy", "--no-incremental", "--ignore-missing-imports", "lnt"]]
138+
skip_install = true
139+
140+
[tool.tox.env.docs]
141+
description = "Build the documentation"
142+
deps = [
143+
"sphinx==7",
144+
"sphinx_bootstrap_theme",
145+
]
146+
allowlist_externals = ["make"]
147+
commands = [["make", "-C", "{toxinidir}/docs/", "html"]]
148+
skip_install = true

setup.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)