Skip to main content

Fast, batteries-included, business-oriented, opinionated REST APIs framework

Project description

Kwik

Kwik Logo

⚠️ Pre-Release Software Warning

Kwik v1.0 has been released and is ready for production use. The internal APIs, data structures, and framework interfaces are now stable. While not guaranteed, we strive to maintain backward compatibility following semantic versioning principles.


Documentation: https://davide.mezzogori.com/kwik/

codecov

Fast, batteries-included, business-oriented, opinionated REST APIs framework

Acknowledgments

Python 3.12+

Kwik stands on the shoulder of a couple of giants:

  • FastAPI: for the underlying REST API server.
  • Pydantic: for the data validation and serialization.
  • SQLAlchemy: for the ORM part.

Installation

$ pip install kwik

or

$ uv add kwik

It will install Kwik and all its dependencies.

Development

Setup

# Clone the repository
git clone https://github.com/dmezzogori/kwik.git
cd kwik

# Install dependencies using uv
uv sync

# Start development server with hot reload
kwik

Testing

# Run all tests with coverage (testcontainers automatically manages PostgreSQL)
pytest --cov=src/kwik --cov-report=term-missing

# Run tests in parallel (faster)
pytest -n auto

# Run specific test file
pytest tests/crud/test_crud_users.py

# Run only unit tests (skip integration tests)
pytest -m "not integration"

Note: Tests use testcontainers to automatically manage the PostgreSQL database. No manual database setup required (just docker).

Code Quality

# Run linter and formatter
ruff check
ruff format

Documentation

# Start documentation website locally
cd docs
docker compose up

# Access at http://localhost:8000

Listing queries (DX)

  • Unified dependency kwik.dependencies.ListQuery combines pagination, sorting, and filtering for list endpoints.
  • Query params supported:
    • skip and limit for pagination (stable default ordering by primary key when no sort is provided)
    • sorting as comma-separated fields with optional direction, e.g. ?sorting=name:asc,id:desc
    • filter_key and value for simple equality filters, e.g. ?filter_key=is_active&value=true
  • Example endpoint:
    • def list_users(q: ListQuery, context: UserContext) -> Paginated[UserProfile]: total, data = crud_users.get_multi(context=context, **q) return {"total": total, "data": data}
  • Invalid filter/sort fields return HTTP 400 with a clear message.

Contributing

  1. Create a feature branch (git checkout -b feature/your-feature-name)
  2. Make your changes following the existing code style
  3. Add tests for new functionality
  4. Run tests and ensure they pass
  5. Run linting and fix any issues
  6. Commit your changes (git commit -am '<Your commit message>')
  7. Push to the branch (git push origin feature/your-feature-name)
  8. Create a Pull Request

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kwik-1.2.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kwik-1.2.0-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file kwik-1.2.0.tar.gz.

File metadata

  • Download URL: kwik-1.2.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.12

File hashes

Hashes for kwik-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e682091a4d0d3afe89bf0c60c534621658320833a9e2fa4d1130e9444c1fbe3d
MD5 90319241db83a05839c61a10b63a5691
BLAKE2b-256 b1194ca0368582f0d3ba26002340e640ace8a2ab39fb75ced61fb7bea4a5d91c

See more details on using hashes here.

File details

Details for the file kwik-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: kwik-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.12

File hashes

Hashes for kwik-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b551f7865f95661155422700c23a6ba8f182e5025e15e07c81c289e77fb161d
MD5 d1d86ed81e0f37e7b4410df8ca4c9449
BLAKE2b-256 6a67a0da773a801d257e07d3ae804c4c1f72145187f6542f819125d2970e41d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page