Skip to main content

Teloce-Py

Teloce-Py logo

Build interactive Python apps with .vel components. No Node.js required.

PyPI version MIT license Documentation

Teloce-Py compiles a template, browser behavior, and scoped CSS from a single .vel file into plain browser assets. Your Python framework (Flask, FastAPI, Django, or Flaxon) keeps handling routes, APIs, databases, auth, and security.

Features

  • Single-file components: Template, script, and scoped style in one .vel file.
  • Bring your own backend: Works with Flask, FastAPI, Django, and Flaxon.
  • No Node.js: Production builds use MinifyJS, a native esbuild engine bundled in the wheel.
  • Fast builds: Tree shaking, mangling, code splitting, source maps, and hashed assets.

Teloce Ecosystem

Teloce is designed to support both Python-based application development and JavaScript-based workflows.

Teloce-Py

Teloce-Py is the Python implementation. It lets developers build applications using .vel single-file components without requiring Node.js.

It integrates with Python web frameworks and handles component compilation, scoped styles, browser assets, and production builds.

Teloce-NPM

Teloce-NPM is the companion npm project for the Teloce ecosystem.

It provides npm-based tooling and packages for developers working with Teloce and JavaScript-based projects. It complements Teloce-Py by supporting workflows outside the Python package environment.

Explore Teloce-NPM:

The Three.js example demonstrates using Teloce-NPM in a project with Three.js.

Together, Teloce-Py and Teloce-NPM provide different ways to work with the Teloce ecosystem.

Getting Started

Install:

Editor Support

Before you start, install the Teloce extension for VS Code. It adds syntax highlighting, diagnostics, autocomplete, hover information, formatting, and snippets for .vel files.

code --install-extension Flaxon-vscode.teloce-vscode

Or open the Extensions panel (Ctrl+Shift+X / Cmd+Shift+X), search for Teloce, and click Install. The extension is optional: Teloce-Py works without it.

python -m pip install teloce-py Flask

Create static/js/App.vel:

<script>
export default {
  data() { return { count: 0 }; },
  methods: {
    increment() { this.count += 1; }
  }
};
</script>

<template>
  <button @click="increment">Clicked {{ count }} times</button>
</template>

Create app.py:

from pathlib import Path
from flask import Flask, render_template
from teloce.build import build_project

ROOT = Path(__file__).parent
build_project(ROOT, out_dir=ROOT / "dist", options={"dev": True})

app = Flask(
    __name__,
    static_folder="dist/static",
    static_url_path="/static"
)

@app.get("/")
def home():
    return render_template("app.html")

if __name__ == "__main__":
    app.run(debug=True)

Create templates/app.html:

<!doctype html>
<html>
  <body>
    <div id="app"></div>
    <script type="module">
      import { mount } from "{{ url_for('static', filename='js/App.js') }}";
      mount("#app");
    </script>
  </body>
</html>

Run it and open http://127.0.0.1:5000:

python app.py

Project Structure

my-app/
├── app.py
├── teloce.config.json
├── static/
│   └── js/
│       └── App.vel       # Your source
├── templates/
│   └── app.html          # HTML shell with #app mount
└── dist/                 # Generated, never edit by hand

Production Build

teloce lint --strict
teloce build --source-map --hash-assets --bundle --report

Teloce strips common TypeScript syntax during compilation. The optional teloce typecheck command checks scripts and supported template expressions with PyTSCheck.

Documentation

Status

Teloce-Py is in beta. Pin your version and test generated assets on your target framework and platform.

License

MIT

Runtime Contributor Checks

The JavaScript runtime uses JSDoc types with a development-only checker:

npm ci --ignore-scripts
npm run typecheck

See coverage and workflow.

Runtime files stay .js; Python application users do not need Node or TypeScript.

Optional Component Type Checking

On Python 3.11+, install:

pip install "teloce-py[typecheck]"

Then run:

teloce typecheck ui

Or use JSON output for CI:

teloce typecheck ui --json

This checks TypeScript script blocks, .ts files/declarations, and supported template expressions using the bundled PyTSCheck compiler.

See the type-checking guide for API examples, diagnostic locations, optional dependency handling, and prototype limits.

Plain JavaScript components are skipped. Project tsconfig settings and dependency declarations are inherited automatically; object-style props infer supported constructor types. Props passed to statically imported TypeScript children are validated. Array-style prop values, dynamic children, and some import forms remain limited.

You can also explore this Teloce-NPM Three.js example.

Metadata

Release files for teloce-py 0.3.4

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

Source distribution (sdist)

Source distribution for teloce-py 0.3.4
File Size Uploaded Provenance Actions
teloce_py-0.3.4.tar.gz 334.6 kB Without provenance Details for teloce_py-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for teloce-py 0.3.4
File Interpreter ABI Platform Actions
teloce_py-0.3.4-py3-none-any.whl Python 3 none any Details for teloce_py-0.3.4-py3-none-any.whl

Total release size: 713.6 kB

Release files / teloce_py-0.3.4.tar.gz

Download URL teloce_py-0.3.4.tar.gz
Size 334.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f942b6fe85b447d0fca710e7f4b35e9759313fed607a1a256c5e9cf218994e88
BLAKE2b-256 checksum
How to use checksums
69721723fd20fb68243162f1d30d3d84592b44712703b81649af0fe44dfd8411
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / teloce_py-0.3.4-py3-none-any.whl

Download URL teloce_py-0.3.4-py3-none-any.whl
Size 379.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
227b64baf82e5fc500c351fb102c1fb87f70df301d249cd2b1de1a93bff9cc27
BLAKE2b-256 checksum
How to use checksums
e6c5e4a5705a0ec8ff2df5dc48b9349d689bcd2c5a5df93120b9f2356e142aa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for teloce-py 0.3.4

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