marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
5.39k stars 158 forks source link

DataFrameLike False Positive When __getattr__ Presents #1602

Closed Somainer closed 3 weeks ago

Somainer commented 3 weeks ago

Describe the bug

When a class implemented __getattr__ or __getattribute__, marimo will treat this instance as a DataFrameLike object, trying to render a table from it and raise exceptions.

Environment

{ "marimo": "0.6.17", "OS": "Darwin", "OS Version": "23.5.0", "Processor": "arm", "Python Version": "3.11.5", "Binaries": { "Browser": "125.0.6422.142", "Node": "v22.1.0" }, "Requirements": { "click": "8.1.7", "importlib-resources": "missing", "jedi": "0.19.1", "markdown": "3.6", "pymdown-extensions": "10.8.1", "pygments": "2.18.0", "tomlkit": "0.12.5", "uvicorn": "0.30.1", "starlette": "0.37.2", "websockets": "12.0", "typing-extensions": "4.7.1", "black": "24.4.2" } }

Code to reproduce

class Boom:
    def __getattr__(self, _):
        return ...
b = Boom()

This will result an error: TypeError: 'ellipsis' object is not callable

mscolnick commented 3 weeks ago

Thanks for pointing this out - I'll fix this today