Skip to main content Switch to mobile version codecraftai-webworks 1.8.2 Code Craft AI - WebWorks
pip install codecraftai-webworks==1.8.2 Copy PIP instructions
Code Craft AI - WebWorks
codecraftai-webworks is the web framework of the Code Craft AI technology stack. It is a Python package (ccai.webworks) for building web applications and REST APIs, and it ships the browser-side pieces that go with them: a library of mj-* web components, a chart library and an API explorer, all served as static assets with no build step.
An application is built around a web application persona: one object that owns the application’s identity, its configuration, its endpoint registry, its router and its ASGI application. Endpoints are plain functions or classes marked with a decorator; the application declares which ones belong to it and the framework builds the router from them.
What is in the package
Server side (ccai.webworks):
ASGI and WSGI layers (asgi, wsgi): an ASGI 3.0 application with HTTP, WebSocket, server-sent event and lifespan handling, and a WSGI layer with request parsing, response building, a socket server and the bridge that serves a WebApplication over WSGI.
Routing (routing): a URL-node router with path parameters and converters, a dispatcher, request and response classes (JSON, HTML, redirect, streaming), multipart parsing and a middleware pipeline.
Endpoints and blueprints (endpoints): Endpoint.attach_at for single handlers; Blueprint and RestBlueprint for groups of handlers under a base path; access policies and rate limits declared on the endpoint.
REST and OpenAPI (endpoints.rest, openapi): request and response schemas, content negotiation, an OpenAPI generator, Swagger UI, ReDoc and the bundled API explorer. A route that declares a request schema, response schema or error map is REST-processed automatically (validation, negotiation, serialization, REST error bodies); pass rest_processing=False when registering it to handle the raw request yourself.
Authentication and security (authentication, security): basic, bearer, digest, HMAC, API key, session, OAuth 2 and OpenID Connect authenticators; access policies, CSRF protection, signed serialization, JSON web tokens and password hashing.
Templating (templating): a pluggable template engine interface with Jinja2 and Mako adapters, context processors, filters and auto-escaping.
Configuration (configuration): layered configuration from files, the environment and defaults, with schema validation.
Extensions (extensibility): add extensions in code with webapp.add_extension(...) or list them in the extensions configuration section (load, entry_points, paths, with an allowed_packages allow-list); they get application and request lifecycle hooks and can contribute middleware. Nothing is imported unless it is configured.
Markdown books (markdown, books): a CommonMark renderer with no third-party dependency, and a blueprint that serves a folder of markdown books as navigable HTML (see Markdown Books).
Developer tools (devexp): the webworks command line, a development server with auto-reload, an in-process test client, debug error pages and request inspection (see The webworks command line).
Production server (prodserver): webworks prodserve runs an application on pre-forked worker processes with graceful shutdown and reload, request IDs, health and metrics endpoints, a structured access log, request limits and TLS. A WebApplication is also served by any WSGI server through webapp.wsgi_app.
Browser side (ccai/webworks/static, shipped inside the package):
The mj-* component library: native custom elements (see The mj-* component library).
The chart library:
The package requires Python 3.10 or later. Releases are built by the Publish workflow and uploaded to the Code Craft AI package repository (and to PyPI when the organization enables it). With that repository configured as a package source:
pip install codecraftai-webworks Optional features are installed as extras:
Jinja2, for the Jinja2 template adapter
Mako, for the Mako template adapter
both template engines
Pydantic 2, for Pydantic models as REST schemas and in the OpenAPI schema converter
gevent, for the gevent worker of the production server
tomli (Python 3.10) and tomli-w, for TOML configuration files
IPython, used by webworks shell when it is installed
the testbase runner and Playwright, for running the test suites
pip install "codecraftai-webworks[jinja2,pydantic]" A minimal application
Save this as app.py:
from ccai.webworks.endpoints.endpoint import Endpoint from ccai.webworks.routing.request import Request from ccai.webworks.routing.response import JSONResponse from ccai.webworks.webapplication import establish_webapp_persona @Endpoint.attach_at(path="/", methods=["GET"]) def index(request: Request) -> JSONResponse: return JSONResponse(content={"message": "Hello, World!"}, status_code=200) webapp = establish_webapp_persona( name="hello", logger_name="hello", log_basename="hello", presence_dir=".presence", ) # The decorator only marks the handler; collecting it registers the route. webapp.registry.collect_from(index) webapp.startup() # The ASGI application: serve it with 'webworks serve' or any ASGI server. app = webapp.asgi_app Serve it from the same directory and request it:
webworks serve --reload curl http://127.0.0.1:8000/ webworks serve looks for app:app in the current directory; name another application with --app module:attribute. With --reload the server runs in a child process that is replaced whenever a source file changes, so the edited code is imported afresh.
The same application can be called in a test without a server:
from ccai.webworks.devexp.testing.testclient import TestClient from app import app client = TestClient(app) response = client.get("/") assert response.status_code == 200 assert response.json == {"message": "Hello, World!"} The webworks command line
Installing the package adds the webworks command. It can also be run as python -m ccai.webworks.devexp.cli.
Create a project. --template minimal (default), api or webapp.
Run the development server. --app, --host, --port, --reload, --debug, --no-debug, --extra-files, --log-level, --log-file.
List the application’s routes. --format table|json|csv, --filter, --verbose.
Open a Python shell with app, webapp, router and registry loaded.
webworks generate endpoint NAME
Write an endpoint module. --output-dir, --dry-run.
webworks generate blueprint NAME
Write a RestBlueprint module. --output-dir, --dry-run.
Run the persona’s database hooks. migrate, rollback, seed and status need a database backend provided by the application.
The global options --app, --config FILE (a JSON file), --env and --verbose go before the command name. Settings can also come from the environment: WEBWORKS_SERVER_PORT=9000 sets server.port. The user guide’s Getting Started chapter walks through all of this.
The development server is for development. In debug mode an unhandled error is answered with its traceback, so debug mode is switched off when the server binds to an address other machines can reach, unless --debug is given explicitly.
The mj-* component library
ccai/webworks/static holds a framework-agnostic library of native custom elements in eleven groups: buttons, selection, text, data, navigation, overlays, layout, feedback, media, productivity and charts. Each component is one ES module under static/javascript/components (mj
static/javascript/charts is a chart library built on the same foundation. A chart is an
source/testsites holds three sample applications. They are fixtures for the test suites and working examples of the framework:
helloworld: the smallest application; two endpoints.
blueprintdemo: RestBlueprint inheritance with OpenAPI and Swagger UI at /docs.
testcomponents: documents and exercises the component and chart libraries. It has a browse-by-group landing page, a page per component with attribute and event tables and a live, editable playground, and a /charts section with a page per chart type. It needs no authentication.
Run one from the repository root:
PYTHONPATH=source/testsites webworks serve --app testcomponents.app:app Markdown Books
BooksBlueprint serves a folder of markdown books as HTML pages. Navigation comes from the links in the markdown, not from the folders the files are in: the library’s index document (README.md at the root) links to the books, each book’s index document links to its chapters, and the order of those links, in lists or tables, is the reading order. The text of each link is the title the navigation shows. A link to a folder means the folder’s README.md (or index.md).
from ccai.webworks.books import BookLibrary, BooksBlueprint library = BookLibrary("~/repos/codecraftai-books") books = BooksBlueprint(library, mount_path="/books") books.attach_to_webapp(webapp) Each page shows its book’s contents, breadcrumbs, links to the previous and next documents and an outline of its headings. Links between the markdown files are rewritten to the URLs the documents are served at, and images in the library are served beside them. Nothing outside the library’s folder, and no hidden file, is ever served. Pages carry a Content-Security-Policy that allows no script.
The markdown is rendered by ccai.webworks.markdown (no third-party library): CommonMark plus GitHub tables, strikethrough and links made from bare addresses. Raw HTML in the markdown is escaped and links with unsafe schemes such as javascript: are dropped.
To read a library with the development server:
python source/examples/books/serve_books.py ~/repos/codecraftai-books --port 8000 Development
The repository uses Poetry for its environment.
Prepare the checkout and create the virtual environment in .venv:
python repository-setup/rehome-repository python development/setup-environment poetry install --extras "templating test" source .venv/bin/activate
Run the single-host suite. Tests run under the testbase runner:
testbase testing run --root source/testroots/ccai --includes=ccai.tests.singlehost --output=./.output/
Run the browser suite of the testcomponents site. It drives the component and chart libraries in Chromium through Playwright (installed by the test extra); download the browser once first. Without Playwright or its browser every test in this suite is reported as skipped, not passed:
python -m playwright install chromium testbase testing run --root ./source/testsites/testcomponents --includes=testcomponents.tests --output=./.output/testcomponents-tests
The Merge Gate workflow runs both suites, builds the wheel and smoke-tests it; the Publish workflow uploads a release only after that gate has passed. make test, make test-components and make dist-build run the same steps locally.
Released: Dec 5, 2026
Author: Code Craft AI LLC
Both files in this release have provenance metadata.
View provenance details
LicenseRef-CodeCraftAI-Source-Available View SPDX License List
gevent jinja2 mako pydantic shell templating test toml
python web framework asgi wsgi rest openapi web-components
Intended Audience Developers
Operating System MacOS
Microsoft :: Windows
Programming Language Python :: 3
Topic Internet :: WWW/HTTP
Internet :: WWW/HTTP :: WSGI
Software Development :: Libraries :: Application Frameworks
Release files for codecraftai-webworks 1.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 6.4 MB
Release files / codecraftai_webworks-1.8.2.tar.gz
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Security for codecraftai-webworks 1.8.2
Both files in this release have been uploaded with provenance metadata.
With provenance codecraftai_webworks-1.8.2.tar.gz Dec 5, 2026
Attestation for codecraftai_webworks-1.8.2.tar.gz
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.
Release history Release notifications | RSS feed
Dec 5, 2026 2 release files Full provenance
Nov 26, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Oct 31, 2026 2 release files Full provenance
Oct 28, 2026 2 release files Full provenance
Oct 20, 2026 2 release files Full provenance
Oct 19, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











