Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit both typeguard 2.x and 4.x #3044

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion parsl/monitoring/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ def start(self, run_id: str, run_dir: str) -> int:
self.logger.debug("Initializing ZMQ Pipes to client")
self.monitoring_hub_active = True

comm_q: Queue[Union[Tuple[int, int], str]]
# This annotation is incompatible with typeguard 4.x instrumentation
# of local variables, because Queue is not a type: it's a method on
rjmello marked this conversation as resolved.
Show resolved Hide resolved
# multiprocessing.context.DefaultContext.
# comm_q: Queue[Union[Tuple[int, int], str]]
comm_q = SizedQueue(maxsize=10)

self.exception_q: Queue[Tuple[str, str]]
Expand Down
7 changes: 6 additions & 1 deletion parsl/tests/test_bash_apps/test_stdout.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import pytest
import typeguard

import parsl.app.errors as perror
from parsl.app.app import bash_app
Expand Down Expand Up @@ -44,7 +45,11 @@ def test_bad_stdout_specs(spec):
try:
fn.result()
except Exception as e:
assert isinstance(e, TypeError) or isinstance(e, perror.BadStdStreamFile), "Exception is wrong type"
# This tests for TypeCheckError by string matching on the type name
# because that class does not exist in typeguard 2.x - it is new in
# typeguard 4.x. When typeguard 2.x support is dropped, this test can
# become an isinstance check.
assert "TypeCheckError" in str(type(e)) or isinstance(e, TypeError) or isinstance(e, perror.BadStdStreamFile), "Exception is wrong type"
else:
assert False, "Did not raise expected exception"

Expand Down
9 changes: 8 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
pyzmq>=17.1.2
typeguard>=2.10,<3

# typeguard uses semantic versioning.
# major v3 was a shortlived version that was rapidly replaced by major v4,
# so this specification excludes it.
# v2 and v4 are both seen in the wild with users in complex deployments.
typeguard>=2.10,!=3.*,<5


typing-extensions>=4.6,<5
globus-sdk
dill
Expand Down
Loading