Skip to content
Carnage725Public

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

fyro

Fast, Yet Ridiculously Opinionated.

A web framework on top of FastAPI that feels like Django. Why fyro? => why

FastAPI is the engine. fyro adds what a project needs around it, with one obvious place for everything: one model class gives you a Postgres table, Create/Read/Update schemas, a REST API with docs, migrations and an admin page. Database sessions, a command line, users, login and permissions are built in.

# blog/models.py
from fyro import Field, Model


class Post(Model):
    title: str = Field(max_length=200)
    body: str
    secret: str = Field(write_only=True)
    published: bool = False

That class is the table blog_post, the API at /api/blog/post (list with filters, search, ordering and paging; get; create; patch; delete) and the admin page at /admin/blog/post. Queries need no session code:

posts = await Post.objects.filter(published=True).order_by("-id").limit(10).all()

Quickstart

Needs Python 3.12+, Docker (for Postgres) and uv or pip.

uv venv && source .venv/bin/activate
uv pip install fyro

fyro new mysite && cd mysite
docker compose up -d --wait
python manage.py startapp blog
# write blog/models.py, then in mysite/settings.py:
#     installed_apps: list[str] = ["fyro.auth", "blog"]
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver        # http://127.0.0.1:8000/docs and /admin

The full walkthrough and the guides are in docs/: settings, models, querying, the automatic API, migrations, the command line, auth and permissions, the admin, and security notes.

Status

v0.1, alpha. PostgreSQL only. Relations between models come in v0.2; see what v0.1 does not do. The plan and the history of every design decision are in PLAN.md and BUILD_PROMPT.md.

Development

uv sync                     # install dependencies
docker compose up -d        # Postgres 16 on localhost:5432 (user, password, db: fyro)
uv run pytest               # tests, in random order (pytest-randomly)
uv run ruff check           # lint
uv run --only-group docs zensical serve   # docs at http://127.0.0.1:8000

How tests are written and attacked is described in test.md.

License

MIT. The admin bundles htmx (0BSD) and JetBrains Mono (OFL-1.1); their licenses are in src/fyro/admin/static/.

NOTE: this is a work in progress, i am a fresher. pls be nice. and also credits to all the people who developed the underlying tech.

About

No description, website, or topics provided.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages