Skip to content

Commit

Permalink
Remove strict dependency on locust-plugins, but require a compatible …
Browse files Browse the repository at this point in the history
…version of locust-plugins if (and only if) it is actuall installed.
  • Loading branch information
cyberw committed Dec 1, 2022
1 parent fa1ef9b commit cf19ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
},
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit cf19ed0

Please sign in to comment.