Skip to content

Python version of voltra server #107

@SamuelBrucksch

Description

@SamuelBrucksch

Feature Description

Hey,

I'm currently working on the server side implementation for live activities. We do not have a nodejs server, so we would have to spawn a subprocess, to get the correct live activity ui json string from the voltra server lib.

It should be actually possible, to achieve the same using a python script. Are you interested, in offering the server lib as a python script too?

I asked cursor, and it came up with something (see attached script). The code itself could then look like this:

    from voltra_server import V, render_live_activity

    layout = V.LinearGradient(
        colors=["#4E4E4A", "#3A3A36", "#2C2C28"],
        start={"x": 0, "y": 0.5},
        end={"x": 1, "y": 0.5},
        style={"borderRadius": 24},
        children=[
            V.VStack(spacing=8, style={"padding": 16, "width": "100%"}, alignment="leading", children=[
                V.Text("Hello from Python!", style={"color": "white", "fontSize": 15}),
            ]),
        ],
    )

    compressed = render_live_activity(lock_screen=layout)
    # compressed is the base64 string ready for the APNs content-state.uiJsonData

The server lib probably needs to be on the same version as the voltra lib used in the client to perfectly fit together, but thats the same issue we already have now with server and client logic separated in Javascript. But i guess it would be nice to have some of the python code get autogenerated based on whatever is done in JS, so it always fits together, and then we would just have to use the same version of the python lib in the backend.

voltra_server_public.py

Problem Statement

We have a server running with python, but want to send live activities without adding nodejs subprocesses.

Proposed Solution

Add a python server lib.

Alternatives Considered

Yes, a subprocess with nodejs, but its cumbersome to setup. Also python is quite popular for servers too.

Current Library Version

1.2.1

Implementation

  • I would be willing to submit a pull request for this feature

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions