Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Poetry build system (mainly so we don't have to commit dynamically generated front end bundles to git) #2725

Merged
merged 117 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
1e23586
remove generated front end bundle
mquinnfd May 24, 2024
5d57ba7
add poetry and front end dist to vcs ignore
mquinnfd May 24, 2024
9ae85af
update build system manifest for poetry
mquinnfd May 24, 2024
ad90bb6
chmod on release renaming script
mquinnfd May 24, 2024
4d58026
re-add wheel extension to changed file name
mquinnfd May 24, 2024
6b46420
ensure vsc autoversioning plugin
mquinnfd May 24, 2024
cf9c05f
ensure vcs auto versioning plugin
mquinnfd May 24, 2024
e5dde14
revert vscode settings
mquinnfd May 24, 2024
fe2b756
add local dev install command
mquinnfd May 24, 2024
14dcb28
add version file to package output
mquinnfd May 24, 2024
d3d5e81
only include poetry lock in sdist
mquinnfd May 24, 2024
3b55405
run build setup as one shell
mquinnfd May 25, 2024
9c90aec
check if yarn is installed before building
mquinnfd May 25, 2024
1f72660
rename foo binary to yarn
mquinnfd May 25, 2024
7e290ff
deny poetry venvs creation
mquinnfd May 25, 2024
1ef12b2
remove poetry installation and just check for poetry and yarn
mquinnfd May 26, 2024
38d70b4
update URLs for related info
mquinnfd May 26, 2024
d67df73
Ensure spawning_complete happens only once on workers.
May 24, 2024
39c3d60
Update various test cases for new spawning_complete behavior.
May 25, 2024
633cfd1
Simplify additional test cases using the new get_messages function.
May 25, 2024
436d457
Set worker_state to 'running' in start_worker (this used to be by spa…
May 25, 2024
8a858c5
Simplify semaphore_wait example
May 25, 2024
c810143
Reverse accidental change
May 25, 2024
169986b
Update WorkerRunner.state when spawn cycle is done (it used to rely o…
May 25, 2024
a518fd8
Further simplify example
May 25, 2024
6cc99a6
Rewrite confusing error messages if someone accesses an HTTP Web UI u…
May 24, 2024
267a1a6
Convert report time to locale time
andrewbaldwin44 May 25, 2024
709b9a2
Update HTML report tests
andrewbaldwin44 May 25, 2024
72c6fa9
Use requests 2.32.2 or higher for Python 3.12, fixes #2555
May 25, 2024
601b0c7
Upgrade Sphinx to latest version
plaindocs May 16, 2024
dc36236
Add to extensions also?
plaindocs May 26, 2024
6e6e9f9
hash anchors in setup docs pages
mquinnfd May 26, 2024
da06265
testing version of pep440 generator
mquinnfd May 28, 2024
2239175
merge upstream
mquinnfd May 28, 2024
f075006
remove dist
mquinnfd May 28, 2024
cdfc20c
ignore dist contents
mquinnfd May 28, 2024
c7352fb
include changes to pyproject from main - requests version
mquinnfd May 28, 2024
ea29e16
Remove unnecessary python
plaindocs May 26, 2024
dcf422d
Downgrade docutils to officially supported
plaindocs May 26, 2024
7fb6338
Restore theme name
plaindocs May 26, 2024
256ff99
Fix ruff error
plaindocs May 26, 2024
39a14f6
Rename css options
plaindocs May 26, 2024
d57027d
Conform to style
plaindocs May 26, 2024
4b880f5
Add timestamp to chart tooltip
andrewbaldwin44 May 25, 2024
720ec57
Add zoom to echarts
andrewbaldwin44 May 25, 2024
03f6511
Update test
andrewbaldwin44 May 26, 2024
c149309
Fix empty timestamp formatting
andrewbaldwin44 May 26, 2024
ea3f4de
Round total_avg_response_time from history
andrewbaldwin44 May 26, 2024
64a2015
Reduce CSV_STATS_FLUSH_INTERVAL_SEC to 5 seconds by default (more rea…
cyberw May 27, 2024
cce6225
Dial back the API TOC
plaindocs May 27, 2024
b3808e8
doc formatting fix
cyberw May 27, 2024
3bb3e36
Modify timestamp generation to remove deprecation warning
JavierUhagon May 27, 2024
d213a86
Add newline at the end of the file
JavierUhagon May 27, 2024
24f8903
Fix incorrect error message detection for https requests introduced i…
May 27, 2024
a588308
update build system manifest for poetry
mquinnfd May 24, 2024
0a7bb63
remove merge object
mquinnfd May 28, 2024
d7ecc8b
merge master instead of rebase
mquinnfd May 28, 2024
9dd6d89
test commit distance
mquinnfd May 28, 2024
24d5383
jinja templating for format number
mquinnfd May 28, 2024
541b555
simple vesion formatting
mquinnfd May 28, 2024
f185890
take a stab at updating workflows for poetry
mquinnfd May 28, 2024
009c61f
might as well add discussions forum while I'm here
mquinnfd May 28, 2024
8745bb5
add docs serve command to makefile
mquinnfd May 28, 2024
9dd3886
developing locust docs page
mquinnfd May 28, 2024
3abfb48
make readme and pyproject align in terms of URLs
mquinnfd May 28, 2024
fdd924b
remove unused py version in wheel
mquinnfd May 29, 2024
c865276
adjust dockerfile for poetry build
mquinnfd May 29, 2024
6ac89de
add dev dependency group
mquinnfd May 29, 2024
bd4f9c6
docs dependencies
mquinnfd May 29, 2024
57a5d5c
docs dependencies and readme
mquinnfd May 29, 2024
cbc54d8
venv for tests
mquinnfd May 29, 2024
1cf4f33
RTD config for versioning
mquinnfd May 29, 2024
74de5ad
rtd step
mquinnfd May 29, 2024
5c2a517
don't run the build script on the remote
mquinnfd May 29, 2024
68c3a99
rtd
mquinnfd May 29, 2024
11b5f84
rtd
mquinnfd May 29, 2024
20dd4e0
rtd
mquinnfd May 29, 2024
538fe49
rtd
mquinnfd May 29, 2024
2b0d264
rtd
mquinnfd May 29, 2024
bdf8af2
rtd
mquinnfd May 29, 2024
de207f5
rtd
mquinnfd May 29, 2024
6aec0b6
rtd
mquinnfd May 29, 2024
64ee7f3
rtd
mquinnfd May 29, 2024
504f15c
rtd
mquinnfd May 29, 2024
f4d0f2b
tests and tox
mquinnfd May 29, 2024
c7452e5
tox fixes
mquinnfd May 30, 2024
ad53fd7
progress on CI runners locally
mquinnfd May 30, 2024
cf87454
skip front end build
mquinnfd Jun 1, 2024
093b083
in-progress
mquinnfd Jun 7, 2024
725b9b4
merge from upstream
mquinnfd Jun 7, 2024
392d644
run on remotes not my poor laptop
mquinnfd Jun 7, 2024
3b3b569
run on remotes not my poor laptop
mquinnfd Jun 7, 2024
ed2cf7e
ruff and mypy version
mquinnfd Jun 7, 2024
e9c21a5
yarn timeout for windows, update mypy
mquinnfd Jun 7, 2024
f14f164
windows plz
mquinnfd Jun 7, 2024
6cb6867
windows plz
mquinnfd Jun 7, 2024
7c2657b
updates from master
mquinnfd Jun 7, 2024
b634bdf
add mypy as a dev dependency
mquinnfd Jun 11, 2024
1cae9df
Merge branch 'master' into poetry-build-system
mquinnfd Jun 11, 2024
8467d7f
tests
mquinnfd Jun 15, 2024
c3068a9
testing if this is actually a shell thing
mquinnfd Jun 22, 2024
4c534ff
nope
mquinnfd Jun 22, 2024
178150d
increase fetch depth for dunamai versioning
mquinnfd Jun 22, 2024
15de334
I know what the problem is at least
mquinnfd Jun 22, 2024
5f9f721
test windows
mquinnfd Jun 22, 2024
9c8c30f
tox install
mquinnfd Jun 22, 2024
f2a8c34
revert vs code settings
mquinnfd Jun 23, 2024
39cf84a
remove oneshell directive from old installation process
mquinnfd Jun 23, 2024
90ffcc8
Update maintainers and authors
mquinnfd Jun 23, 2024
ba58f38
move web ui to correct location
mquinnfd Jun 23, 2024
70f240b
merge master
mquinnfd Jun 26, 2024
9369440
update file exclusions
mquinnfd Jun 28, 2024
a0f2e2b
skip fe build in fail-fast test
mquinnfd Jun 30, 2024
89da571
Merge branch 'master' into poetry-build-system
mquinnfd Jul 4, 2024
f326bdb
pin some version dependencies
mquinnfd Jul 4, 2024
0259c89
update tox version
mquinnfd Jul 4, 2024
c9a1072
add wheel renaming to prepublishing steps
mquinnfd Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ yarn-error.log
.venv
.DS_Store
.python-version
poetry.lock
locust/webui/dist
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
test:
tox

build:
rm -f dist/* && python3 -m pip install --upgrade build && python3 -m build .
setup_build::
python3 -m pip install --upgrade poetry && poetry self add "poetry-dynamic-versioning[plugin]"

.PHONY: build
build: setup_build
rm -f dist/* && poetry build && ./rename-wheel.sh

install: setup_build
poetry install

frontend_build:
yarn webui:install && yarn webui:build
Expand All @@ -15,9 +22,3 @@ build_docs:

changelog:
@echo "Not supported any more. Run ./generate_changelog.py <version_number> instead!"

sass_watch:
cyberw marked this conversation as resolved.
Show resolved Hide resolved
sass --watch locust/static/sass:locust/static/css

sass_build:
sass --update locust/static/sass:locust/static/css
10 changes: 10 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import subprocess


def build() -> None:
print("Building front end...")
subprocess.run(["make", "frontend_build"])


if __name__ == "__main__":
build()
Binary file removed locust/webui/dist/assets/favicon.ico
Binary file not shown.
250 changes: 0 additions & 250 deletions locust/webui/dist/assets/index-8515c9b5.js

This file was deleted.

Binary file removed locust/webui/dist/assets/logo.png
Binary file not shown.
20 changes: 0 additions & 20 deletions locust/webui/dist/auth.html

This file was deleted.

27 changes: 0 additions & 27 deletions locust/webui/dist/index.html

This file was deleted.

23 changes: 0 additions & 23 deletions locust/webui/dist/report.html

This file was deleted.

153 changes: 96 additions & 57 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
[build-system]
requires = ["setuptools>=61", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[project]
[tool.poetry]
name = "locust"
license = { text = "MIT" }
description = "Developer-friendly load testing framework"
dynamic = ["version"]
requires-python = ">=3.9"
dependencies = [
"gevent >=22.10.2",
"flask >=2.0.0",
"Werkzeug >=2.0.0",
"requests >=2.26.0",
"msgpack >=1.0.0",
"pyzmq >=25.0.0",
"geventhttpclient >=2.3.1",
"ConfigArgParse >=1.5.5",
"tomli >=1.1.0; python_version<'3.11'",
"psutil >=5.9.1",
"Flask-Login >=0.6.3",
"Flask-Cors >=3.0.10",
"pywin32; platform_system=='Windows'",
]
version = "0.0.0"
license = "MIT"
readme = "README.md"
authors = ["Jonatan Heyman", "Carl Byström", "Joakim Hamrén", "Hugo Heyman"]
mquinnfd marked this conversation as resolved.
Show resolved Hide resolved
maintainers = ["Lars Holmberg", "Jonatan Heyman"]
mquinnfd marked this conversation as resolved.
Show resolved Hide resolved

homepage = "https://locust.io/"
repository = "https://github.com/locustio/locust"
documentation = "https://docs.locust.io/"

classifiers = [
"Topic :: Software Development :: Testing :: Traffic Generation",
"Development Status :: 5 - Production/Stable",
Expand All @@ -41,22 +33,81 @@ classifiers = [
"Topic :: System :: Distributed Computing",
]

[project.urls]
Homepage = "https://github.com/locustio/locust"
Documentation = "https://docs.locust.io/"
Code = "https://github.com/locustio/locust"
"Help/Questions" = "https://stackoverflow.com/questions/tagged/locust"
"Issue tracker" = "https://github.com/locustio/locust/issues"
packages = [{ include = "locust" }]
include = [
"locust/webui/dist/**/*",
"locust/_version.py",
{ path = "poetry.lock", format = [
"sdist",
] },
]
exclude = [
"locust/webui/public",
"locust/webui/src",
"locust/webui/*.*",
mquinnfd marked this conversation as resolved.
Show resolved Hide resolved
"locust/test",
]

[tool.poetry.build]
script = "build.py"
generate-setup-file = false

[project.readme]
file = "README.md"
content-type = "text/markdown"
[tool.poetry.urls]
"Help/Questions" = "https://stackoverflow.com/questions/tagged/locust"
cyberw marked this conversation as resolved.
Show resolved Hide resolved
"Issue tracker" = "https://github.com/locustio/locust/issues"

[tool.setuptools]
zip-safe = false
license-files = ["LICENSE"]
include-package-data = false
[tool.poetry-dynamic-versioning]
enable = true
vcs = "git"
style = "pep440"
format = "{base}{stage}"
latest-tag = true
pattern = "^(?P<base>\\d+\\.\\d+\\.\\d+)(?P<stage>.*)$"

[tool.poetry-dynamic-versioning.files."locust/_version.py"]
persistent-substitution = true
initial-content = """
mquinnfd marked this conversation as resolved.
Show resolved Hide resolved
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE


__version__ = "0.0.0"
version = __version__
__version_tuple__ = (0, 0, 0)
version_tuple = __version_tuple__
"""

[tool.poetry.dependencies]
python = ">=3.9"

gevent = ">=22.10.2"
flask = ">=2.0.0"
Werkzeug = ">=2.0.0"
requests = ">=2.26.0"
msgpack = ">=1.0.0"
pyzmq = ">=25.0.0"
geventhttpclient = ">=2.3.1"
ConfigArgParse = ">=1.5.5"
tomli = { version = ">=1.1.0", markers = "python_version < '3.11'" }
psutil = ">=5.9.1"
Flask-Login = ">=0.6.3"
Flask-Cors = ">=3.0.10"
pywin32 = { version = "*", markers = "sys_platform == 'win32'" }

[tool.poetry.scripts]
locust = "locust.main:main"

[tool.ruff]
target-version = "py39"
Expand All @@ -73,41 +124,29 @@ lint.select = ["E", "F", "W", "UP", "FA102", "I001"]
"examples/*" = ["F841"]

[tool.ruff.lint.isort]
section-order = ["future", "locust", "standard-library", "third-party", "first-party", "local-folder"]
# Custom selection-order: to ensure locust is imported as first in lucustfiles (for successful gevent monkey patching)
section-order = [
"future",
"locust",
"standard-library",
"third-party",
"first-party",
"local-folder",
]
# Custom selection-order: to ensure locust is imported as first in locustfiles (for successful gevent monkey patching)

[tool.ruff.lint.isort.sections]
locust = ["locust"]


[tool.setuptools_scm]
write_to = "locust/_version.py"
local_scheme = "no-local-version"

[options.packages.find]
namespace = true
include = ["locust*"]
exclude = ["examples", "tests"]

[tool.setuptools.package-data]
locust = ["py.typed"]
"locust.webui.dist" = ["**/*"]

[project.scripts]
locust = "locust.main:main"

[tool.mypy]
# missing type stubs
ignore_missing_imports = true
python_version = "3.9"

[[tool.mypy.overrides]]
module = ["locust.dispatch"]
no_strict_optional = true
strict_optional = false

[tool.pyright]
exclude = [
"locust/test",
]
exclude = ["locust/test"]
reportOptionalMemberAccess = "none"
analyzeUnannotatedFunctions = false
14 changes: 14 additions & 0 deletions rename-wheel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# When using build script in poetry, the wheel file is named with the architecture and python version
# This script renames the wheel file to a generic, multi-arch name
# From https://github.com/python-poetry/poetry/issues/3509#issuecomment-1483859472

# Rename the wheel file to match the currently active python version
python_ver=$(python -c 'import platform; print("".join(platform.python_version_tuple()[:2]))')

wheel_file=$(find dist/ -type f -name '*.whl')
new_wheel_file=$(echo ${wheel_file} | sed "s/-cp[0-9].*$/-py3-none-any.whl/")

echo "Renaming ${wheel_file} to ${new_wheel_file}"
mv ${wheel_file} ${new_wheel_file}
Loading