finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
8.31k stars 1.16k forks source link

Tornado being imported even if I'm not using tornado in my webserver #2723

Closed timkpaine closed 3 days ago

timkpaine commented 4 weeks ago

I have a FastAPI-based webserver that I want to ensure my import time and memory footprint is minimized. I see that tornado is being imported, even though I'm not using tornado.

Steps to Reproduce:

import sys
import perspective
"tornado" in sys.modules # True

Expected Result:

import sys
import perspective
"tornado" in sys.modules # False

Actual Result:

import sys
import perspective
"tornado" in sys.modules # True

Environment:

3.0+

Additional Context:

texodus commented 3 weeks ago

We can change this, but it's API breaking. If we do, we should also do this for the other handler types and remove the try/except import logic as it swallows important errors sometimes.

Why is a properly constrained virtual env not the appropriate solution?

timkpaine commented 3 weeks ago

Why is a properly constrained virtual env not the appropriate solution?

One might very reasonably want tornado in the environment, but not have it imported if not used. I have photoshop on my computer, I'd rather not have it open every time I use slack.

texodus commented 3 days ago

Fixed in #2754, released in v3.1.0