Skip to main content

Jyserver Web Framework with Pythonic Javascript Syntax

Jyserver is a framework for simplifying the creation of font ends for apps and kiosks by providing real-time access to the browser's DOM and Javascript from the server using Python syntax. It also provides access to the Python code from the browser's Javascript.

The difference between this framework and others (such as Django, Flask, etc.) is that jyserver uses Python dynamic syntax evaluation so that you can write Python code that will dynamically be converted to JS and executed on the browser. On the browser end, it uses JS's dynamic Proxy object to rewrite JS code for execution by the server. All of this is done transparently without any additional libraries or code. See example below.

This module uses threads and queues to ensure responsiveness.

Browser           Server
Javascript  --->  execute as python server code
JS & DOM    <---  execute statements
            <---  query and change values

Example:

from jserver import Client, Server
class App(Client):
    def __init__(self):
        # For simplicity, this is the web page we are rendering. 
        # The module will add the relevant JS code to 
        # make it all work. You can also use an html file.
        self.html = """
            <p id="time">TIME</p>
            <button id="reset" 
                onclick="server.reset()">Reset</button>
        """

    # Called by onclick
    def reset(self):
        # reset counter so elapsed time is 0
        self.start0 = time.time()
        # executed on client
        self.js.dom.time.innerHTML = "{:.1f}".format(0)

    # If there is a "main" function, it gets executed. Program
    # ends when the function ends. If there is no main, then
    # server runs forever.
    def main(self):
        # start counter so elapsed time is 0
        self.start0 = time.time()
        while True:
            # get current elapsed time, rounded to 0.1 seconds
            t = "{:.1f}".format(time.time() - self.start0)
            # update the DOM on the client
            self.js.dom.time.innerHTML = t
            time.sleep(0.1)

httpd = Server(App)
print("serving at port", httpd.port)
httpd.start()

Metadata

Release files for jyserver 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jyserver 0.0.1
File Size Uploaded Provenance Actions
jyserver-0.0.1.tar.gz 12.5 kB Without provenance Details for jyserver-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jyserver 0.0.1
File Interpreter ABI Platform Actions
jyserver-0.0.1-py3-none-any.whl Python 3 none any Details for jyserver-0.0.1-py3-none-any.whl

Total release size: 25.0 kB

Release files / jyserver-0.0.1.tar.gz

Download URL jyserver-0.0.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
10198bf38bcba703065d8d6385cdbf289b1d7131d634dcef1f8a7eb8ee39b072
BLAKE2b-256 checksum
How to use checksums
f281b874f57b0b987d72b5469bc41cc1d7cb4c5de7a1ed9c268141e02a8c1aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / jyserver-0.0.1-py3-none-any.whl

Download URL jyserver-0.0.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be278b421e37f1ed7b7382ad508b9faf365defca9d20bcdb2bf013a8ffc67c5e
BLAKE2b-256 checksum
How to use checksums
00812e45150adc3cbe4f75a9285e012b28c030ab134ffd976a652ef9535b0697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for jyserver 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page