locust/pyproject.toml

251 lines
6.7 KiB
TOML

[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "locust"
description = "Developer-friendly load testing framework"
license = { text = "MIT" }
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.10"
authors = [{ name = "Jonatan Heyman" }, { name = "Lars Holmberg" }]
maintainers = [
{ name = "Lars Holmberg" },
{ name = "Jonatan Heyman" },
{ name = "Andrew Baldwin" },
]
classifiers = [
"Topic :: Software Development :: Testing :: Traffic Generation",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: Traffic Generation",
"Topic :: System :: Distributed Computing",
]
dependencies = [
"flask>=2.0.0",
"Werkzeug>=2.0.0",
"requests>=2.26.0; python_version <= '3.11'",
"requests>=2.32.2; python_version > '3.11'",
"msgpack>=1.0.0",
"pyzmq>=25.0.0",
"geventhttpclient>=2.3.1",
"configargparse>=1.7.1",
"tomli>=1.1.0; python_version < '3.11'",
"typing_extensions>=4.6.0; python_version < '3.11'",
"psutil>=5.9.1",
"Flask-Login>=0.6.3",
"Flask-Cors>=3.0.10",
"pywin32; sys_platform == 'win32'",
"setuptools>=70.0.0",
"locust-cloud>=1.26.3",
"gevent>=24.10.1,<26.0.0",
]
[project.urls]
homepage = "https://locust.io/"
repository = "https://github.com/locustio/locust"
documentation = "https://docs.locust.io/"
[tool.uv]
default-groups = ["build", "test", "lint"]
[dependency-groups]
build = ["hatch>=1.14.0", "hatch-vcs>=0.4.0"]
test = [
"cryptography>=43.0.1,<44.0.0",
"mock>=5.1.0,<6.0.0",
"pyquery>=2.0.0,<3.0.0",
"pytest>=8.3.3,<9.0.0",
"retry>=0.9.2,<1.0.0",
]
lint = [
"pre-commit>=3.7.1,<4.0.0",
"ruff==0.10.0",
"mypy>=1.13.0,<2.0.0",
"types-requests>=2.32.0.20240622,<3.0.0",
]
release = ["twine>=5.1.1,<6.0.0"]
docs = [
"sphinx==7.4.7",
"sphinx-rtd-theme==3.0.2",
"readthedocs-sphinx-search==0.3.2",
"Sphinx-Substitution-Extensions==2020.9.30.0",
"Pygments==2.19.1",
"alabaster==0.7.16",
"babel==2.13.0",
"docutils==0.21.2",
"imagesize==1.4.1",
"snowballstemmer==2.2.0",
"sphinx-prompt==1.5.0",
"sphinxcontrib-applehelp==1.0.4",
"sphinxcontrib-devhelp==1.0.2",
"sphinxcontrib-htmlhelp==2.0.1",
"sphinxcontrib-jsmath==1.0.1",
"sphinxcontrib-qthelp==1.0.3",
"sphinxcontrib-serializinghtml==1.1.10",
"sphinxcontrib-googleanalytics>=0.4",
]
[project.scripts]
locust = "locust.main:main"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "locust/_version.py"
[tool.hatch.build.targets.sdist]
include = ["locust"]
exclude = ["locust/webui/*", "locust/test", "locust/build"]
artifacts = ["locust/webui/dist"]
[tool.hatch.build.targets.wheel]
include = ["locust"]
artifacts = ["locust/webui/dist"]
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
[tool.hatch.build.hooks.custom]
[tool.hatch.build.targets.BuildFrontend.hooks.custom]
[tool.ruff]
target-version = "py310"
line-length = 120
extend-exclude = [
"build",
"examples/issue_*.py",
"src/readthedocs-sphinx-search/",
]
lint.ignore = ["E402", "E501", "E713", "E731", "E741", "UP031"]
lint.select = ["E", "F", "W", "UP", "FA102", "I001"]
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|resp)$"
[tool.ruff.lint.per-file-ignores]
"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 locustfiles (for successful gevent monkey patching)
[tool.ruff.lint.isort.sections]
locust = ["locust"]
[tool.mypy]
# missing type stubs
ignore_missing_imports = true
python_version = "3.10"
[tool.pyright]
exclude = ["locust/test"]
reportOptionalMemberAccess = "none"
# analyzeUnannotatedFunctions = false
# Hatch environments
# List environments using `hatch env show`
# https://hatch.pypa.io/1.13/tutorials/environment/basic-usage/
## Local Testing
# Default hatch environment, used during local development
# List tests using `hatch test -s`
# https://hatch.pypa.io/1.13/tutorials/testing/overview/
[tool.hatch.envs.hatch-test]
default-args = ["locust/test"]
dependencies = [
"cryptography>=43.0.1,<44.0.0",
"mock>=5.1.0,<6.0.0",
"pyquery>=2.0.0,<3.0.0",
"pytest>=8.3.3,<9.0.0",
"retry>=0.9.2,<1.0.0",
]
[tool.hatch.envs.hatch-test.scripts]
run = [
"pytest{env:HATCH_TEST_ARGS:} {args}",
"bash -ec 'PYTHONUNBUFFERED=1 python3 examples/debugging_advanced.py | grep done'",
]
## CI testing
# Run all combinations: `hatch run test:all`
# Run single env: `hatch run +py=3.10 test:all`
[tool.hatch.envs.test]
template = "hatch-test"
[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12", "3.13"]
## Run all unit tests and advanced debugging
[tool.hatch.envs.test.scripts]
# Disable these tests for now, because they are breaking. When someone has time they should be converted into regular unit tests
# bash -ec "PYTHONUNBUFFERED=1 timeout 20s python3 examples/rest.py >{temp_dir}/out.txt 2>/{temp_dir}/err.txt || true"
# grep -qm 1 'my custom error message with response text, response was {"args"' {temp_dir}/out.txt
# grep -qm 1 'ZeroDivisionError: division by zero at.*Response was {"ar' {temp_dir}/out.txt
# bash -ec '! grep . {temp_dir}/err.txt' # should be empty
all = [
"pytest {args:locust/test}",
"bash -ec 'PYTHONUNBUFFERED=1 python3 examples/debugging_advanced.py | grep done'",
]
# Run main test and bail on first error
fail_fast = "pytest -x {args:locust/test/test_main.py}"
## CI integration testing
## Integration testing of build packages on CI, using a pre-built package
[tool.hatch.envs.integration_test_ci]
template = "test"
skip-install = true
path = ".venv"
[[tool.hatch.envs.integration_test_ci.matrix]]
python = ["3.12"]
## Linting
[tool.hatch.envs.lint]
detached = true
[[tool.hatch.envs.lint.matrix]]
python = ["3.12"]
[tool.hatch.envs.lint.scripts]
all = [""]
types = ["mypy locust/"]
format = ["ruff check .", "ruff format --check"]
## Hatch docs building environment
[tool.hatch.envs.docs]
[[tool.hatch.envs.docs.matrix]]
python = ["3.12"]
[tool.hatch.envs.docs.scripts]
build = ["sphinx-build -b html docs/ docs/_build/"]