Skip to content

Commit

Permalink
#404 - Unpin required version of packaging (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-taubman authored Apr 14, 2023
1 parent b55ff54 commit 0834e35
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 24 deletions.
3 changes: 0 additions & 3 deletions brewtils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def echo_json(self, message):
"""

if _wrapped is None:

if form is not None:
_deprecate(
"Use of form with @command is now deprecated and will eventually be removed"
Expand Down Expand Up @@ -707,7 +706,6 @@ def _initialize_parameters(parameter_list):
initialized_params = []

for param in parameter_list:

# This is already a Parameter. Only really need to interpret the choices
# definition and recurse down into nested Parameters
if isinstance(param, Parameter):
Expand Down Expand Up @@ -774,7 +772,6 @@ def _signature_parameters(cmd, method):
"""
# Now we need to reconcile the parameters with the method signature
for index, arg in enumerate(signature(method).parameters.values()):

# Don't want to include special parameters
if (index == 0 and arg.name in ("self", "cls")) or arg.kind in (
InspectParameter.VAR_KEYWORD,
Expand Down
2 changes: 0 additions & 2 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@ def get_plugin_log_config(self, **kwargs):
return LoggingConfig(level=level, handlers=handlers, formatters=formatters)

def _generate_handlers(self, specific_handlers):

# If we are not given an override for handlers, then we will just
# assume that we want to use all the handlers given in the current
# configuration.
Expand All @@ -972,7 +971,6 @@ def _generate_handlers(self, specific_handlers):
return handlers

def _generate_formatters(self, specific_formatters):

# If we are not given an override for formatters, then we will just
# assume that we want to use the formatters given in the current
# configuration
Expand Down
2 changes: 0 additions & 2 deletions brewtils/request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ def update_request(self, request, headers):
return

with self.beergarden_error_condition:

self._wait_for_beergarden_if_down(request)

try:
Expand Down Expand Up @@ -459,7 +458,6 @@ def _wait_if_not_first_attempt(self, headers):
self._shutdown_event.wait(time_to_sleep)

def _handle_request_update_failure(self, request, headers, exc):

# If beergarden is down, we always want to try again
# Yes, even if it is the 'final_attempt'
if isinstance(exc, (RequestsConnectionError, RestConnectionError)):
Expand Down
31 changes: 24 additions & 7 deletions brewtils/rest/system_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from multiprocessing import cpu_count
from typing import Any, Dict, Iterable, Optional

from packaging.version import parse
from packaging.version import parse, InvalidVersion

import brewtils.plugin
from brewtils.errors import (
Expand Down Expand Up @@ -443,7 +443,6 @@ def _wait_for_request(self, request, raise_on_error, timeout):
delay_time = 0.5
total_wait_time = 0
while request.status not in Request.COMPLETED_STATUSES:

if timeout and 0 < timeout < total_wait_time:
raise TimeoutExceededError(
"Timeout waiting for request '%s' to complete" % str(request)
Expand Down Expand Up @@ -549,8 +548,26 @@ def _resolve_parameters(self, command, request):
@staticmethod
def _determine_latest(systems):
# type: (Iterable[System]) -> Optional[System]
return (
sorted(systems, key=lambda x: parse(x.version), reverse=True)[0]
if systems
else None
)
"""Returns the system with the latest version from the provided list of Systems.
Any version adhering to PEP440 is treated as "later" than a version that does
not adhere to that standard.
"""
versions = []
legacy_versions = []
system_versions_map = {}

for system in systems:
system_versions_map[system.version] = system

try:
versions.append(parse(system.version))
except InvalidVersion:
legacy_versions.append(system.version)

eligible_versions = versions if versions else legacy_versions

if eligible_versions:
latest_version = sorted(eligible_versions, reverse=True)[0]
return system_versions_map.get(str(latest_version))
else:
return None
1 change: 0 additions & 1 deletion brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ class LoggingConfigSchema(BaseSchema):


class EventSchema(BaseSchema):

name = fields.Str(allow_none=True)
namespace = fields.Str(allow_none=True)
garden = fields.Str(allow_none=True)
Expand Down
3 changes: 0 additions & 3 deletions brewtils/test/comparable.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def _assert_wrapper(obj1, obj2, expected_type=None, do_raise=False, **kwargs):


def assert_command_equal(obj1, obj2, do_raise=False):

return _assert_wrapper(
obj1,
obj2,
Expand All @@ -218,7 +217,6 @@ def assert_parameter_equal(obj1, obj2, do_raise=False):


def assert_event_equal(obj1, obj2, do_raise=False):

_assert(obj1.payload_type == obj2.payload_type, "Payload types were not equal")

comparison_func_name = "_assert_wrapper"
Expand Down Expand Up @@ -359,7 +357,6 @@ def assert_job_ids_equal(dict1, dict2, do_raise=False):


def assert_operation_equal(obj1, obj2, do_raise=False):

_assert(obj1.model_type == obj2.model_type, "Model types were not equal")

comparison_func_name = "_assert_wrapper"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 1

[flake8]
max-line-length = 100
ignore = E203,W503
ignore = E203,W503,F401

[isort]
profile = black
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def find_version():
"lark-parser<0.7",
"marshmallow<3",
"marshmallow-polyfield<4",
"packaging<21",
"packaging",
"pika<=1.2,>=1.0.1",
"pytz<2021",
"requests<3",
"simplejson<4",
"six<2",
"wrapt<1.13",
"wrapt",
"yapconf>=0.3.7",
],
extras_require={
Expand Down
1 change: 0 additions & 1 deletion test/decorators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,6 @@ def foo(self):
assert "command_registrar" in str(w[0].message)

def test_register(self, cmd):

# Just for sanity
assert not hasattr(cmd, "_command")

Expand Down
2 changes: 0 additions & 2 deletions test/rest/system_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def test_latest_config_ns(self, easy_client, bg_system):
)

def test_no_system_kwargs(self):

brewtils.plugin.CONFIG.namespace = "foo"
brewtils.plugin.CONFIG.name = "foo"
brewtils.plugin.CONFIG.version = "1.0.0"
Expand All @@ -172,7 +171,6 @@ def test_no_system_kwargs(self):
assert client._default_instance == brewtils.plugin.CONFIG.instance_name

def test_all_system_kwargs(self):

brewtils.plugin.CONFIG.name = "foo"
brewtils.plugin.CONFIG.version = "1.0.0"
brewtils.plugin.CONFIG.instance_name = "foo"
Expand Down

0 comments on commit 0834e35

Please sign in to comment.