TheRacetrack / plugin-python-job-type

A plugin for Racetrack which extends it with Python Job Type
Apache License 2.0
0 stars 1 forks source link

Make Python 3.11 job module working with typeguard #32

Closed iszulcdeepsense closed 7 months ago

iszulcdeepsense commented 7 months ago

Adding typeguard==4.1.5 to requirements of a job and adding typeguard decorator on the job class:

from typeguard import typechecked

@typechecked
class AdderModel:

makes a job to fail in the initialization step:

File "/src/job/src/job.py", line 15, in <module>
    @typechecked
     ^^^^^^^^^^^
  File "/src/job-venv/lib/python3.11/site-packages/typeguard/_decorators.py", line 209, in typechecked
    retval = instrument(property_func)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/job-venv/lib/python3.11/site-packages/typeguard/_decorators.py", line 71, in instrument
    module_source = inspect.getsource(sys.modules[f.__module__])

This only fails with Python 3.11.