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

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

merged 5 commits into from
Jan 31, 2024

Conversation

benclifford
Copy link
Collaborator

This PR loosens some type checking to accomodate both typeguard 2.x and 4.x as large parsl users (eg. LSST DESC) still package version 2.x but other users want the latest - 4.x

In typeguard 4.x, local variables are instrumented for type-checking, which is incompatible with using multiprocessing.Queue: multiprocessing.Queue is not a type as far as typeguard is concerned, so a single use of that, in MonitoringHub, is commented out by this PR.

Typeguard 2.x and 4.x have different type error classes, so explicit type checking of exception classes cannot happen in tests as the typeguard 4.x TypeCheckError class does not exist when typeguard 2.x is installed. This PR makes that type-check of type-checking errors happen using string matching of the name of the type-check error class in test_bash_apps/test_stdout.py

See for example issue #3017

This PR is ugly but attempts to be pragmatic about user packaging needs.

Changed Behaviour

different exceptions on user type errors

Fixes

Fixes #3017

Type of change

  • Code maintenance/cleanup

This PR loosens some type checking to accomodate both typeguard 2.x and 4.x
as large parsl users (eg. LSST DESC) still package version 2.x but other users
want the latest - 4.x

In typeguard 4.x, local variables are instrumented for type-checking, which
is incompatible with using multiprocessing.Queue: multiprocessing.Queue is
not a type as far as typeguard is concerned, so a single use of that, in
MonitoringHub, is commented out by this PR.

Typeguard 2.x and 4.x have different type error classes, so explicit type
checking of exception classes cannot happen in tests as the typeguard 4.x
TypeCheckError class does not exist when typeguard 2.x is installed. This
PR makes that type-check of type-checking errors happen using string
matching of the name of the type-check error class in
test_bash_apps/test_stdout.py

See for example issue #3017

This PR is ugly but attempts to be pragmatic about user packaging needs.
parsl/monitoring/monitoring.py Outdated Show resolved Hide resolved
@benclifford benclifford merged commit 7d45e33 into master Jan 31, 2024
6 checks passed
@benclifford benclifford deleted the benc-typeguard-2-4 branch January 31, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parsl vs typeguard 4 doesn't work
2 participants