Skip to main content

jdm-electron-flask (Python)

The Python backbone for jdm-electron-flask desktop apps.

This package ships inside every project scaffolded by the jdm-cli electron-flask plugin. It provides the app factory, dynamic API registration, SocketIO setup, and environment-aware logging — so you build features, not boilerplate.


Installation

You don't install this manually. It's included in the scaffolded requirements.txt:

jdm-electron-flask==1.0.0

If you need it standalone:

pip install jdm-electron-flask

What it provides

create_app

The Flask app factory. Handles config loading, SocketIO init, blueprint auto-discovery, and the React SPA catch-all route.

# run.py
from jdm_electron_flask import create_app, get_socketio

app = create_app()
socketio = get_socketio()

if __name__ == "__main__":
    socketio.run(app, host="0.0.0.0", port=5000, debug=True)

JDMBlueprint

Extended Blueprint with built-in response helpers.

from jdm_electron_flask import JDMBlueprint

health_bp = JDMBlueprint("health", __name__)

@health_bp.route("/health")
def health():
    return health_bp.success({"status": "ok"})

JDMEvents

Base class for organizing socket event handlers.

from jdm_electron_flask import JDMEvents

class ConnectEvents(JDMEvents):
    def register(self):
        @self.socketio.on("connect")
        def on_connect():
            self.on_connect()

        @self.socketio.on("ping_server")
        def on_ping(data):
            self.emit("pong_client", {"echo": data})

ConnectEvents().register()

Printer

Environment-aware logger. Prints in development, writes to logs/<date>.log in production/deployed.

from jdm_electron_flask import Printer

Printer.success("Blueprint registered")
Printer.warn("Something is off")
Printer.error("Something broke")
Printer.info("Just FYI")

Response helpers

from jdm_electron_flask import success, error, paginate

return success({"user": "JDM"})
return error("Not found", status=404)
return paginate(items, total=100, page=1, per_page=10)

Validators

from jdm_electron_flask import validate_fields

valid, msg, data = validate_fields(["name", "email"])
if not valid:
    return error(msg)

Dynamic API registration

Routes are controlled by config/api.json:

{
    "health": {
        "link": "/api",
        "masterEnabled": true
    },
    "users": {
        "link": "/api/users",
        "masterEnabled": true,
        "disabledOnProduction": false,
        "disabledOnDeployed": false
    }
}

Adding a new route:

  1. Add entry to config/api.json
  2. Create app/api/users.py with a users_bp blueprint

That's it. No touching __init__.py ever again.


Environment modes

FLASK_ENV Behavior
development Debug on, console logging, all routes enabled
production Debug off, file logging, respects disabledOnProduction
deployed Debug off, file logging, respects disabledOnDeployed

Companion

This package is the Python half of the jdm-electron-flask ecosystem:

Package Role
jdm-electron-flask (npm) CLI plugin — scaffold, build, compile
jdm-electron-flask (PyPI) Backend library — app factory, blueprints, sockets

License

MIT © JDM-Github

Metadata

Release files for jdm-electron-flask 1.0.8

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

Source distribution (sdist)

Source distribution for jdm-electron-flask 1.0.8
File Size Uploaded Provenance Actions
jdm_electron_flask-1.0.8.tar.gz 9.6 kB Without provenance Details for jdm_electron_flask-1.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jdm-electron-flask 1.0.8
File Interpreter ABI Platform Actions
jdm_electron_flask-1.0.8-py3-none-any.whl Python 3 none any Details for jdm_electron_flask-1.0.8-py3-none-any.whl

Total release size: 19.6 kB

Release files / jdm_electron_flask-1.0.8.tar.gz

Download URL jdm_electron_flask-1.0.8.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7b7b3882e57d1434b1877d6387da59bda3a213db66a10343c5e3956638b18c0d
BLAKE2b-256 checksum
How to use checksums
84979d4faeecc4721c9191aa66cd22a882c7691e5f99d4a366c67b67068209f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / jdm_electron_flask-1.0.8-py3-none-any.whl

Download URL jdm_electron_flask-1.0.8-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2d93e20f05e8d230dbb1f217c9defa3443a0289213e821790c36b14e2d1d781
BLAKE2b-256 checksum
How to use checksums
115b0b37228acc491679bc7d0ebc1c92463424d525d51d5655c5bd93aed957a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for jdm-electron-flask 1.0.8

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