| name | uvicore-framework-reference |
| description | Quick reference for the Uvicore framework that an app developer needs but cannot see (the framework is installed as a library in the uv virtualenv, not in this repo). Covers the import cheatsheet (where to import everything from), the uvicore.* globals, debugging with dump/dd, useful ./uvicore inspection commands, and how to read the installed framework source when a skill doesn't cover something. |
| user-invocable | true |
Uvicore Framework Reference (for App Developers)
The uvicore framework is a PyPI library installed into your uv virtualenv (.venv/) โ its source is
not in this app repo and not in your editor by default. This skill is the cheatsheet so you
rarely need to go looking, plus how to look when you must.
Import cheatsheet โ where things come from
import uvicore
uvicore.app
uvicore.config
uvicore.log
uvicore.db
uvicore.cache
uvicore.events
uvicore.jobs
uvicore.ioc
@uvicore.provider() @uvicore.service() @uvicore.controller() @uvicore.routes()
@uvicore.model() @uvicore.table() @uvicore.seeder() @uvicore.event()
@uvicore.job() @uvicore.composer()
from uvicore.http import Request, response
from uvicore.http.response import APIResponse
from uvicore.http.routing import (Routes, Controller, WebRouter, ApiRouter,
WebRoute, ApiRoute, Router, Guard, ModelRouter, AutoApi)
from uvicore.http.params import Path, Query, Header, Cookie, Body, Form, File, Depends, Security
from uvicore.http.exceptions import (HTTPException, NotFound, PermissionDenied,
NotAuthenticated, InvalidCredentials, BadParameter)
from uvicore.http import status
from uvicore.orm import (Model, ModelMetaclass, Field,
BelongsTo, HasOne, HasMany, BelongsToMany, MorphOne, MorphMany, MorphToMany)
from uvicore.database import Table
from uvicore.console import command, group, argument, option
from uvicore.exceptions import SmartException
from uvicore.auth import UserInfo
from uvicore.configuration import env, Env
from typing import List, Any
from uvicore.typing import Dict, OrderedDict
from uvicore.support.dumper import dump, dd
The uvicore.* globals โ common calls
uvicore.app.package(main=True).name / .version โ the running app's name/version.
uvicore.app.version โ the framework version. uvicore.app.debug โ debug flag.
uvicore.config.app.api.prefix, uvicore.config.dotget('app.web.prefix'),
uvicore.config['acme.appstub'].version โ config is a deep-merged Dict.
uvicore.ioc.make('Name') โ resolve any bound service/model by name or alias.
uvicore.log.info/header/item/notice/error(...) โ see uvicore-framework-services.
Debugging: dump and dd
from uvicore.support.dumper import dump, dd
dump(some_var, another)
dd(some_var)
Use these liberally while developing routes/commands โ dd() in a handler shows you exactly what a
request/query produced.
Inspect the running app from the CLI
./uvicore โ list all command groups/commands.
./uvicore package list โ list loaded packages.
./uvicore http routes โ list all registered web/api routes with their names and paths
(use the names in url('...') and tests).
./uvicore db connections โ list database connections (with the database extra).
When the skills don't cover something โ read the installed framework
The framework source is in your virtualenv. Find and grep it:
uv run python -c "import uvicore, os; print(os.path.dirname(uvicore.__file__))"
UVICORE=$(uv run python -c "import uvicore, os; print(os.path.dirname(uvicore.__file__))")
grep -rn "def " $UVICORE/orm/query.py
ls $UVICORE/contracts/
uvicore/contracts/*.py are the interface definitions for every service (Application, Database,
Cache, Logger, Router, Model, etc.) โ the best place to confirm a public method signature. Major
modules: orm/, database/, http/, console/, events/, jobs/, cache/, mail/, redis/,
auth/, templating/, configuration/, typing/.
Treat installed framework code as read-only reference. To customize framework behavior, use
config overrides / IoC binding overrides from your app (see uvicore-config-and-auth), never edit
files in the virtualenv.
Don't guess
If you can't confirm an API from this cheatsheet, the other skills, or the stub examples, inspect
the installed source (above) rather than inventing a method name. The framework uses Pydantic
v2 โ use v2 idioms in models (and pipe-style typing X | None, not Optional[...]).