Skip to content

Enable mask images and batbot metadata in NABat - #530

Merged
naglepuff merged 3 commits into
mainfrom
mln/nabat-show-batbot-metadata
Aug 20, 2026
Merged

Enable mask images and batbot metadata in NABat#530
naglepuff merged 3 commits into
mainfrom
mln/nabat-show-batbot-metadata

Conversation

@naglepuff

Copy link
Copy Markdown
Collaborator

No description provided.

@naglepuff
naglepuff force-pushed the mln/nabat-show-batbot-metadata branch from f562ed5 to 4f24d62 Compare August 12, 2026 22:02
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploying bats-ai with  Cloudflare Pages  Cloudflare Pages

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

View logs

@naglepuff
naglepuff force-pushed the mln/nabat-show-batbot-metadata branch 2 times, most recently from b162c54 to b5b6f98 Compare August 13, 2026 17:08
@naglepuff
naglepuff force-pushed the mln/nabat-show-batbot-metadata branch from b5b6f98 to 5e39ec5 Compare August 13, 2026 17:14
@naglepuff
naglepuff requested a review from BryonLewis August 17, 2026 22:00

@BryonLewis BryonLewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +28 to +29
if TYPE_CHECKING:
from bats_ai.core.views.recording import PulseMetadataSlopesSchema

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;;�\

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@naglepuff
naglepuff requested a review from BryonLewis August 20, 2026 15:20
@naglepuff
naglepuff merged commit 0f986c4 into main Aug 20, 2026
4 checks passed
@naglepuff
naglepuff deleted the mln/nabat-show-batbot-metadata branch August 20, 2026 16:06
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.

2 participants