Enable mask images and batbot metadata in NABat - #530
Conversation
f562ed5 to
4f24d62
Compare
Deploying bats-ai with
|
| Latest commit: |
e1c7f2b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://dc1663f0.bats-ai.pages.dev |
| Branch Preview URL: | https://mln-nabat-show-batbot-metada.bats-ai.pages.dev |
b162c54 to
b5b6f98
Compare
b5b6f98 to
5e39ec5
Compare
BryonLewis
left a comment
There was a problem hiding this comment.
The issue with ninja requiring an imported type.
This wasn't needed for the non NABat path because the class was declared in the same file so ruff wasn't going to suggest gating it behind TYPE_CHECKING.
| if TYPE_CHECKING: | ||
| from bats_ai.core.views.recording import PulseMetadataSlopesSchema |
There was a problem hiding this comment.
I'm getting some pydantic errors when attempting to view a recording with pulse metadata. I tihnk it is related to this being under TYPE_CHECKING. Ninja is trying to use the class at runtime and the TYPE_CHECKING is preventing it. I would add in the pyproject.toml to `runtime-evaluated-base-classes = ["ninja.Schema"] and I think that would prevent ruff from trying to restructure it while allow Ninja to access the type at runtime. I would confirm that you are getting the same issue first..
ERROR `NABatPulseMetadataSchema` is not fully �]8;id=6494166;file:///home/vscode/venv/lib/python3.13/site-packages/ninja/errors.py�\errors.py�]8;;�\:�]8;id=6494167;file:///home/vscode/venv/lib/python3.13/site-packages/ninja/errors.py#131�\131�]8;;�\
defined; you should define
`PulseMetadataSlopesSchema`, then call
`NABatPulseMetadataSchema.model_rebuild()`.
For further information visit
https://errors.pydantic.dev/2.13/u/class-not-f
ully-defined
Traceback (most recent call last):
File
"/home/vscode/venv/lib/python3.13/site-package
s/ninja/operation.py", line 216, in run
result = self.view_func(request, **values)
File
"/home/vscode/bats-ai/bats_ai/core/views/nabat
/nabat_recording.py", line 674, in
get_pulse_data
return
[NABatPulseMetadataSchema.from_orm(pulse) for
pulse in computed_pulse_annotation_qs]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
^^^^^^
File
"/home/vscode/bats-ai/bats_ai/core/views/nabat
/nabat_recording.py", line 638, in from_orm
return cls(
id=obj.id,
...<5 lines>...
slopes=obj.slopes,
)
File
"/home/vscode/venv/lib/python3.13/site-package
s/pydantic/main.py", line 263, in __init__
validated_self =
self.__pydantic_validator__.validate_python(da
ta, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
File
"/home/vscode/venv/lib/python3.13/site-package
s/pydantic/_internal/_mock_val_ser.py", line
100, in __getattr__
raise
PydanticUserError(self._error_message,
code=self._code)
pydantic.errors.PydanticUserError:
`NABatPulseMetadataSchema` is not fully
defined; you should define
`PulseMetadataSlopesSchema`, then call
`NABatPulseMetadataSchema.model_rebuild()`.
For further information visit
https://errors.pydantic.dev/2.13/u/class-not-f
ully-defined
ERROR Internal Server Error: �]8;id=6494172;file:///home/vscode/venv/lib/python3.13/site-packages/django/utils/log.py�\log.py�]8;;�\:�]8;id=6494173;file:///home/vscode/venv/lib/python3.13/site-packages/django/utils/log.py#249�\249�]8;;�\
There was a problem hiding this comment.
Adding this to the runtime-evaluated-base-classes surfaced some TC004 errors that I decided to correct here. Not sure why they weren't causing similar bugs, I can investigate a bit but for now I've moved those imports out of TYPE_CHECKING blocks.
No description provided.