facebook / facebook/pyrefly

support some flask ecosystem plugins

Open
#1,186 2 comments 0 reactions 0 assignees View on GitHub
needs-discussion typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Flask ecosystem is poorly typed, and often hard to add type.

Some examples:

1. flask-login

https://github.com/maxcountryman/flask-login/blob/c8bba84b9ba6768e878317fc46c54bd13fa1ac07/src/flask_login/utils.py#L25

2. g https://flask.palletsprojects.com/en/stable/appcontext/

```py
from flask import g

def get_db():
if 'db' not in g:
g.db = connect_to_database()

return g.db

@app.teardown_appcontext
def teardown_db(exception):
db = g.pop('db', None)

if db is not None:
db.close()
```

Is it possible to do something like "add" a field to type check, like the g.db?

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.