Comments (14)
Ok I've found a way to reproduce this online: when I import from our framework in multiple places, it gives weird errors, that are due to the __annotations__
being mixed up. I'm not sure whether we're doing something wrong in xdsl
itself, but the error is not visible when running in any environment other than marimo 0.6.14 and up. Here's a notebook with the behaviour:
from marimo.
It must just be because runtime checkable has side-effects. We'll use a different check on our side -- no need to change your library code. Will let you know when a fix is released.
from marimo.
@superlopuh , we just released version 0.7.3 with a fix. If you're still having problems, please re-open this issue.
Thanks again for reporting!
from marimo.
Just in case it helps debug something, the error is there because the subclass has in its annotations, the __annotations__
of a superclass, while not having the corresponding field in its __dict__
, and the code that checks for consistencies for each of these fails when traversing the mro()
from marimo.
I mistook the failure to import as a minimal reproducible example of my bug, but that's not quite correct. I have an issue with a local notebook, and I'm still trying to figure out exactly what the error is, but it's not the one I described above. I'll close this issue for now, sorry about the noise.
from marimo.
@superlopuh , thanks for opening the issue. I took a look at the commits in 0.6.14 and couldn't figure out what could have caused this :/
from marimo.
I wonder if it's one of the dependencies updated in the release? b055329
The Pyodide update seems like the most likely cause, maybe there was a change in the import functionality in the major version bump.
from marimo.
I don't think it's related to Pyodide. I can reproduce your issue locally (and your code works in the Pyodide REPL).
From your example, importing Add
first, then Attribute
works; but doing the imports in the opposite order fails.
I think this is a bug in marimo; I'm just not sure what specifically about your package causes it to surface.
from marimo.
This is the "weird error" I see:
@superlopuh , you mentioned that __annotations__
get mixed up. Can you give any more insight or clues into what might be going wrong? I'd like to try and fix this for you.
from marimo.
I think I've narrowed down the issue. We inspect attributes of variables in memory after running a cell (in an attempt to find dataframes), and it looks like xdsl
doesn't like that.
from marimo.
Calling the following function on xdsl.ir.Attribute
ends up breaking subsequent xdsl
imports:
https://github.com/marimo-team/marimo/blob/main/marimo/_plugins/ui/_impl/tables/types.py#L16-L25
In particular, it's the isinstance
check against the runtime_checkable
protocol that breaks things. Any idea why that would be? (Edit: could be related to this CPython issue, which was supposed to be resolved in Python 3.12+ -- however, I can repro the xdsl issue in marimo using Python 3.12)
Two options for fixing this:
- Maybe this is a bug on your end? I don't know enough about how
xdsl
is implemented to know. It does seem surprising that anisinstance
check interferes with imports. - We could be more explicit in checking for dataframe-ness of an object, by just doing a bunch of
isinstance
checks against known types, without usingruntime_checkable
from marimo.
Am I understanding correctly that removing this check makes the error go away? It does seem similar to the issue you linked. It's always possible that the bug is on our end, but it's curious that it's only ever reproducable in this marimo scenario. If runtime_checkable is known to have issues with supported versions of Python, then maybe it would be worth trying a different way to perform the check?
from marimo.
Amazing, thank you!
from marimo.
Amazing, thank you!
from marimo.
Related Issues (20)
- marimo edit hangs HOT 5
- `mo.ui.table` for Pandas Dataframe do not work in HTML exports HOT 5
- Changing the position of a set of cells HOT 2
- add `packaging` to dependencies? HOT 2
- live documentation changes format while typing argument to function I'm looking at docs of
- Feedback when stale cell is queued (lazy executor) HOT 4
- Request to manually edit dependencies
- Callouts: a bug and a suggestion HOT 2
- Brush Transparency Issue in Chart Rendering HOT 9
- Dict comprehension with form leads to TypeError('cannot pickle '_thread.lock' object') HOT 1
- SyntaxError causes cell to lock up HOT 2
- Support stateless for multi container scaling and deployment
- A small bug and one shortcut gone (or two) HOT 6
- TOC in static export of the notebook HOT 4
- Add option to "copy as pathname" to files/folders on the file browser panel HOT 2
- Stale column previews in ui.table
- Slow tests causing CI failures again
- outputting dataframe with tons of columns crashed all marimo browser tabs HOT 2
- Tracebacks with long error messages are truncated on frontend
- displaying a polars dataframe with an array column spews error output HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marimo.