Skip to main content

Koyo

Koyo is a Python web framework that mirrors the developer experience of Next.js (the app directory convention, file based routing, layouts, reusable components) but is written entirely in Python and runs as a normal Python web server. Since it is a normal Python process under the hood, any package installed with pip is available immediately, with no build step or compiler touching the Python code.

This is v1, frontend and routing only. No backend API layer, no database, no auth.

Koyo is free and open source under the MIT license. Fork it, use it anywhere, for anything, and ship what you build with it. Contributions are welcome; open an issue or pull request on the repository.

Install

Koyo requires Python 3.11 or newer.

pip install koyoapp

Quickstart

koyoapp create my-app
cd my-app
koyoapp dev

Open http://127.0.0.1:2309. The home page renders out of the box with an animated hero, a call to action linking to the Koyo documentation, and a live session counter driven by htmx. Edit any file under app/, public/, or styles/ and the page updates in place without a full reload.

Deploying

Every scaffold ships deploy-ready files: a Procfile that starts python -m uvicorn koyoapp.serve:app on $PORT, a requirements.txt pinning the koyoapp release, and a .railwayignore that keeps the local venv and build output out of deploys. Railway, Render, and any Procfile based host can run a Koyo app with no extra setup; for static-only sites, koyoapp build prerenders into .koyo/build/site for any static host. See https://justphemi.github.io/koyo-docs for a full guide.

CLI

  • koyoapp create . scaffolds a Koyo project into the current directory.
  • koyoapp create my-app creates my-app and scaffolds inside it.
  • koyoapp dev starts the dev server on port 2309 by default, override with --port. If the port is already in use, the next free port is used automatically.
  • koyoapp build prerenders every static route into .koyo/build/site.

Project structure

my-app/
  app/
    layout.py
    page.py
  components/
    counter.py
    landing.py
    site.py
  public/
  styles/
  koyo.config.py
  pyproject.toml

Routing rules follow the Next.js app directory convention. Folders wrapped in square brackets become dynamic path parameters. A page file must export a function named page, and a layout file must export a function named layout(children). Layouts nest outward to inward, exactly like Next.js.

Component system

koyoapp.html exposes function based HTML elements. Text content is HTML escaped by default; use Markup (or raw()) for raw unescaped output. Children can be passed positionally as arguments or appended with square brackets; both styles can be mixed, and a list (or any iterable) passed as a single child is flattened in place. Attributes map underscores to hyphens (hx_, data_, aria_), and class_ / cls both mean class.

from koyoapp.html import div, h1, p, span

def Card(title: str, body: str):
    return div(class_="p-4 rounded-lg shadow bg-white")[
        h1(class_="text-xl font-bold")[title],
        p(class_="text-gray-600")[body],
    ]

def Row(label: str, value: str):
    return div(span(label, cls="font-medium"), span(value), class_="flex gap-2")

Styles

koyoapp dev runs the Tailwind CLI in watch mode against the project and compiles styles/globals.css to styles/koyo.css, which the root layout links automatically. Any other .css file under styles/ is served untouched from /styles/ and can be linked directly with a normal link tag. The scaffold ships a light/dark theme switch: public/theme.js applies the saved or system-preferred theme before first paint, the hero button toggles it and stores the choice in localStorage, and dark mode is class based (darkMode: "class") so any element can use dark: variants.

Packages

There is no custom package manager. Activate the project virtualenv and use plain pip:

.venv/bin/pip install <package>

The package is importable in any page.py, layout.py, or component file immediately, since Koyo runs as a normal Python process.

Metadata

Release files for koyoapp 0.4.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 koyoapp 0.4.1
File Size Uploaded Provenance
koyoapp-0.4.1.tar.gz 425.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 845.5 kB

Release files / koyoapp-0.4.1.tar.gz

Download URL koyoapp-0.4.1.tar.gz
Size 425.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9a990c2ed4a6434c6da0e9b69f8af98b062ee019b0c68a27c063dbc6bcde4e77
BLAKE2b-256 checksum
How to use checksums
55c0168d1d94aa858ee5f130f1a2b59f63a23c681de6d8a192dd7dd9c25339d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / koyoapp-0.4.1-py3-none-any.whl

Download URL koyoapp-0.4.1-py3-none-any.whl
Size 419.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18f974461ddde38f1c86f8d9ec104819f33bc71b60f54411d0ed514e205c99ec
BLAKE2b-256 checksum
How to use checksums
ad2b3d09f3eac61d39547d39c3d72c7a150645c488e4db4728be1af1d3b85d56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for koyoapp 0.4.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.

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