From cf19ed0237deba34d1f68efe40a35b509d86794b Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Thu, 1 Dec 2022 11:09:15 +0100 Subject: [PATCH] Remove strict dependency on locust-plugins, but require a compatible version of locust-plugins if (and only if) it is actuall installed. --- setup.py | 18 ++++++++++++------ tox.ini | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 5d07639..6980ed0 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ import os import sys +import importlib.util from setuptools import find_packages, setup from setuptools.command.install import install from setuptools.command.egg_info import egg_info @@ -30,6 +31,16 @@ def run(self): egg_info.run(self) +requirements_list = [ + "keyring==21.4.0", + "psutil", + "ConfigArgParse>=1.0", +] +# if locust-plugins IS installed, then require a version known to work with this version of swarm. +spec = importlib.util.find_spec("locust_plugins") +if spec is not None: + requirements_list.append("locust-plugins>=2.7.0") + setup( name="locust-swarm", description="Load test + test data distribution & launching tool for Locust", @@ -57,12 +68,7 @@ def run(self): packages=find_packages(), include_package_data=True, zip_safe=False, - install_requires=[ - "keyring==21.4.0", - "locust-plugins>=2.2.2", - "psutil", - "ConfigArgParse>=1.0", - ], + install_requires=requirements_list, entry_points={ "console_scripts": ["swarm = locust_swarm.swarm:main"], }, diff --git a/tox.ini b/tox.ini index 6f1dc97..36af2d0 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = py{37,38,39,310} deps = black pylint + locust-plugins # not strictly a requirement, but probably better to have it than not commands = pylint locust_swarm/ black --check locust_swarm/