From 908c414dc04c12315ca5ecfd7851c9e42b2713ba Mon Sep 17 00:00:00 2001 From: JE-Chen Date: Sat, 15 Apr 2023 01:18:03 +0800 Subject: [PATCH] Put dependencies/package information in pyproject.toml instead of setup.cfg (PEP621) (#2336) * Add PEP621 format toml file Add PEP621 format toml file * Add pep621_pyproject.toml Add pep621_pyproject.toml * This TOML file complies with PEP517 & PEP518 & PEP621 This link is for the PYPI package generated by this TOML file. * https://pypi.org/project/locust-je-test-pep621/2.15.2.dev8/ I don't want to overwrite old pyproject.toml so i call this file pep621_pyproject.toml * Remove duplicate zip_safe Remove duplicate zip_safe * Pull #2337 and add pep621 to pyproject.toml Pull #2337 and add pep621 to pyproject.toml * Remove duplicate setuptools_scm on build system requires & old pyproject Remove duplicate setuptools_scm on build system requires & old pyproject * Fix license text using license file too from license = { file = "LICENSE"} to license = { text = "MIT"} because we have this options license-files = ["LICENSE"] * Delete setup.cfg & setup.py Delete setup.cfg & setup.py * Replace 'setup.cfg' with 'pyproject.toml' Replace 'setup.cfg' with 'pyproject.toml' * Replace rm -f dist/* && python3 setup.py sdist bdist_wheel to rm -f dist/* && python3 -m build . Replace rm -f dist/* && python3 setup.py sdist bdist_wheel to rm -f dist/* && python3 -m build . * Nuke examples\vagrant\vagrant.sh and add pip upgrade build on Makefile Nuke examples\vagrant\vagrant.sh and add pip upgrade build on Makefile --- .github/workflows/tests.yml | 2 +- Makefile | 2 +- examples/vagrant/vagrant.sh | 18 -------- pyproject.toml | 91 ++++++++++++++++++++++++++++++++++++- setup.cfg | 79 -------------------------------- setup.py | 4 -- 6 files changed, 91 insertions(+), 105 deletions(-) delete mode 100644 examples/vagrant/vagrant.sh delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38af1caa46..3d14314367 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: - uses: actions/cache@v3 with: path: ${{ steps.pip-cache.outputs.dir }} - key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.cfg') }} + key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('pyproject.toml') }} - name: set full Python version in PY env var # See https://pre-commit.com/#github-actions-example run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV diff --git a/Makefile b/Makefile index 5b8baf819d..d469373ea1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ test: tox build: - rm -f dist/* && python3 setup.py sdist bdist_wheel + rm -f dist/* && python3 -m pip install --upgrade build && python3 -m build . release: build twine upload dist/* diff --git a/examples/vagrant/vagrant.sh b/examples/vagrant/vagrant.sh deleted file mode 100644 index d9fe2cdcfc..0000000000 --- a/examples/vagrant/vagrant.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# NOTICE: -# -# This file must be saved with unix-style line endings or it will fail. -# - -# Update and install some dependencies -apt-get -y update -apt-get -y install build-essential python-pip python-dev libev-dev libzmq-dev supervisor -cd /vagrant - -pip install --use-mirrors pyzmq supervisor - -# Checkout and install latest Locust from Github -python setup.py develop - -# Starting supervisor which is configured to start Locust -supervisord -c examples/vagrant/supervisord.conf diff --git a/pyproject.toml b/pyproject.toml index a6b93b04b3..af5f2e0e6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,97 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] +requires = ["setuptools>=61", "wheel", "setuptools_scm>=6.2"] build-backend = "setuptools.build_meta" +[project] +name = "locust" +license = { text = "MIT"} +description = "Developer friendly load testing framework" +dynamic = ["version"] +requires-python = ">=3.7" +dependencies = [ + "gevent >=20.12.1", + "flask >=2.0.0", + "Werkzeug >=2.0.0", + "requests >=2.23.0", + "msgpack >=0.6.2", + "pyzmq >=22.2.1, !=23.0.0", + "geventhttpclient >=2.0.2", + "ConfigArgParse >=1.0", + "psutil >=5.6.7", + "Flask-BasicAuth >=0.2.0", + "Flask-Cors >=3.0.10", + "roundrobin >=0.0.2", + "typing-extensions >=3.7.4.3", # This provides support for @final, @runtime_checkable, Protocol and TypedDict, and can probably be removed once we drop 3.7 support + "pywin32;platform_system=='Windows'", +] +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.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Topic :: Software Development :: Testing", + "Topic :: Software Development :: Testing :: Traffic Generation", + "Topic :: System :: Distributed Computing", +] + +[project.urls] +Homepage = "https://locust.io/" +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" + + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[tool.setuptools] +zip-safe = false +license-files = ["LICENSE"] +include-package-data = false + [tool.black] line-length = 120 [tool.setuptools_scm] write_to = "locust/_version.py" -local_scheme = "no-local-version" \ No newline at end of file +local_scheme = "no-local-version" + +[options.packages.find] +namespace = true +include = ["locust*"] +exclude = [ + "examples", + "tests", +] + +[tool.setuptools.package-data] +locust = ["py.typed"] +"locust.static" = ["**/*"] +"locust.templates" = ["**/*"] + +[project.scripts] +locust = "locust.main:main" + +[tool.mypy] +# missing type stubs +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = ["requests.*"] +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = ["locust.dispatch"] +no_strict_optional = true + diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cc175dfe1a..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,79 +0,0 @@ -[metadata] -name = locust -license_files = LICENSE -url = https://locust.io/ -project_urls = - 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 -description = Developer friendly load testing framework -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -obsoletes_dist = locustio -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.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Intended Audience :: Developers - Intended Audience :: System Administrators - Topic :: Software Development :: Testing - Topic :: Software Development :: Testing :: Traffic Generation - Topic :: System :: Distributed Computing - -[options] -packages = find_namespace: -zip_safe = false -python_requires = >= 3.7 -install_requires = - gevent >=20.12.1 - flask >=2.0.0 - Werkzeug >=2.0.0 - requests >=2.23.0 - msgpack >=0.6.2 - pyzmq >=22.2.1, !=23.0.0 - geventhttpclient >=2.0.2 - ConfigArgParse >=1.0 - psutil >=5.6.7 - Flask-BasicAuth >=0.2.0 - Flask-Cors >=3.0.10 - roundrobin >=0.0.2 - typing-extensions >=3.7.4.3 # This provides support for @final, @runtime_checkable, Protocol and TypedDict, and can probably be removed once we drop 3.7 support - pywin32;platform_system=='Windows' - -[options.packages.find] -include = locust* -exclude = - examples - tests - -[options.package_data] -locust = - py.typed -locust.static = - **/* -locust.templates = - **/* - -[options.entry_points] -console_scripts = - locust = locust.main:main - -[mypy] -# missing type stubs -ignore_missing_imports = True - -[mypy-requests.*] -ignore_missing_imports = True - -[mypy-locust.dispatch] -no_strict_optional = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 1b71804078..0000000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -# kept for compatibility, https://setuptools.pypa.io/en/latest/setuptools.html?highlight=setuptools.setup()#setup-cfg-only-projects -import setuptools - -setuptools.setup()