Skip to content

Frameworks

The Numerous SDK supports a number of popular Python web frameworks.

The frameworks package provides framework-specific implementations of Numerous features. Currently, the main framework-specific function is get_session(), which handles user authentication by accessing session information through cookies in a way that's compatible with each framework's request handling.

You need to add the frameworks to your project's requirements directly as they are not part of or installed with the Numerous SDK.

Dash

Dash is supported by the numerous.frameworks.dash module.

numerous.frameworks.dash.get_session()

Get the session for the current user.

Returns:

Name Type Description
Session Session

The session for the current user.

Source code in numerous/frameworks/dash.py
11
12
13
14
15
16
17
18
19
def get_session() -> Session:
    """
    Get the session for the current user.

    Returns:
        Session: The session for the current user.

    """
    return Session(cg=DashCookieGetter())

FastAPI

FastAPI is supported by the numerous.frameworks.fastapi module.

numerous.frameworks.fastapi.get_session(request)

Get the session for the current user.

Returns:

Type Description
Session

The session for the current user.

Source code in numerous/frameworks/fastapi.py
22
23
24
25
26
27
28
29
30
def get_session(request: Request) -> Session:
    """
    Get the session for the current user.

    Returns:
        The session for the current user.

    """
    return Session(cg=FastAPICookieGetter(request))

Flask

Flask is supported by the numerous.frameworks.flask module.

numerous.frameworks.flask.get_session()

Get the session for the current user.

Returns:

Type Description
Session

The session for the current user.

Source code in numerous/frameworks/flask.py
19
20
21
22
23
24
25
26
27
def get_session() -> Session:
    """
    Get the session for the current user.

    Returns:
        The session for the current user.

    """
    return Session(cg=FlaskCookieGetter())

Marimo

Marimo is supported by the numerous.frameworks.marimo module.

numerous.frameworks.marimo.get_session()

Get the session for the current user.

Returns:

Type Description
Session

The session for the current user.

Source code in numerous/frameworks/marimo.py
19
20
21
22
23
24
25
26
27
def get_session() -> Session:
    """
    Get the session for the current user.

    Returns:
        The session for the current user.

    """
    return Session(cg=MarimoCookieGetter())

Panel

Panel is supported by the numerous.frameworks.panel module.

numerous.frameworks.panel.get_session()

Get the session for the current user.

Returns:

Name Type Description
Session Session

The session for the current user.

Source code in numerous/frameworks/panel.py
22
23
24
25
26
27
28
29
30
def get_session() -> session.Session:
    """
    Get the session for the current user.

    Returns:
        Session: The session for the current user.

    """
    return session.Session(cg=PanelCookieGetter())

Streamlit

Streamlit is supported by the numerous.frameworks.streamlit module.

numerous.frameworks.streamlit.get_session()

Get the session for the current user.

Returns:

Type Description
Session

The session for the current user.

Source code in numerous/frameworks/streamlit.py
19
20
21
22
23
24
25
26
27
def get_session() -> Session:
    """
    Get the session for the current user.

    Returns:
        The session for the current user.

    """
    return Session(cg=StreamlitCookieGetter())