Bottle
fastapi
Our great sponsors
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- Onboard AI - Learn any GitHub repo in 59 seconds
- SaaSHub - Software Alternatives and Reviews
Bottle | fastapi | |
---|---|---|
21 | 453 | |
8,186 | 65,377 | |
0.9% | - | |
0.0 | 9.4 | |
11 days ago | 7 days ago | |
Python | Python | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Bottle
-
Ask HN: What are some unpopular technologies you wish people knew more about?
Bottle.py: uber-fast and simple python web microframework, about 3x faster, saner, and more memory-efficient than Flask in my experience: https://github.com/bottlepy/bottle
Fossil: distributed version control and much more in a single executable, from the creators of SQLite: https://fossil-scm.org/
-
I want to read good python code, where can I find some excellent code?
Here's a web framework in a single file: bottle.py
-
GitHub - miguelgrinberg/microdot: The impossibly small web framework for Python and MicroPython.
I don't do much development for microcontrollers or limited resource environments, but it's nice to have a low boilerplate tool for throwing together quick web apps. I've used Bottle for that in the past. It looks like this might have more of an API focus, rather than templates or static pages? Very cool, will check it out.
-
Server-side Dart
There was a time, I want to start a new project and have to choose what technologies to use for the frontend and backend parts as well. Research gets me to Aqueduct and Shelf, both of them weren't looking actively developing and supported and that leads me to the idea to make my own small micro-framework like Echo for Golang or Bottle for Python. And it was easy to decide: I've had time and motivation :)
-
Python frameworks | best web frameworks for python
It was developed by Marcel Hellkamp and Bottle was initially released on July 1 2009 it is cross-platform and open-source. its Github repository is https://github.com/bottlepy/bottle. It is integrated with Python, Vue JS, and Jinja.
-
Python Flask has no remaining open issues or pull requests
This post inspired me to check on Bottle, and it can't say the same: https://github.com/bottlepy/bottle
-
Looking for a drop in replacement for werkzeug
why not https://github.com/bottlepy/bottle the first python micro framework less than 5k of lines,
-
Which language to use along with Python ?
Another option you might want to look in to is small web server stuff. I do a lot of prototyping of REST services using Bottle (http://bottlepy.org/). It's so easy to get going and works really well. Plus my code is so decoupled that if I promote to a heavier-weight server I don't really have to worry much about it.
-
What're the cleanest, most beautifully written projects in Github that are worth studying the code?
Raymond Hettinger recommended bottle in one of his talks for exactly this reason, https://github.com/bottlepy/bottle
- Ask HN: Good Python projects to read for modern Python?
fastapi
-
🔥14 Excellent Open-source Projects for Developers😎
2. FastAPI - Turbocharge Your Web APIs with Python ⚡
-
Building a Multi-Tenant App with FastAPI, SQLModel, and PropelAuth
In this tutorial, we’ll walk you through how to create a multi-tenant link shortening product using FastAPI (a popular Python web framework), SQLModel (a library for interacting with SQL databases in Python) and PropelAuth (a B2B/multi-tenant authentication provider).
-
APIs in Go with Huma 2.0
When it came time to evaluate replacing the now aging service, I prototyped a new version using the rapidly growing FastAPI framework, which automatically generates OpenAPI from the code for you, eliminating the possibility of the code & OpenAPI being out of sync, with the downstream effect of the docs, CLI, and SDKs also staying in sync properly. You can also still use a design-first approach, it just involves some structures written in code to be reviewed first. Design vs. code first is a false dichotomy by which we needn't be constrained.
-
It's Christmas day. You wake up, run to the tree, tear open the largest package with your name on it... FastAPI has added _____?
Getting rid of redoc and replacing it with something that actually has api testing and not predatory pricing (4k a year for "search" for their premium version). There's literally two PR's open for alternatives that I've been following but doubt they'll get approved 1. scalar https://github.com/tiangolo/fastapi/pull/10674 - This is like Redoc on steroids 2. stoplight https://github.com/tiangolo/fastapi/pull/5168 - Has been open for almost 2 years
-
The Blueprint for Trustworthy AI: Constructing Accurate Chatbots with Sophisticated Data Pipelines
Python (FastAPI web framework)
-
Experience using crow as web server
I'm investigating using C++ to build a REST server, and would love to know of people's experiences with Crow-- or whether they would recommend something else as a "medium-level" abstraction C++ web server. As background, I started off experimenting with Python/FastAPI, which is great, but there is too much friction to translate from pybind11-exported C++ objects to the format that FastAPI expects, and, of course, there are inherent performance limitations using Python, which could impact scaling up if the project were to be successful.
-
Building a Secure API with FastAPI, PostgreSQL, and Hanko Authentication
In today's fast-paced digital landscape, building robust, secure and user-friendly API is necessity. In this blog post, we'll explore the development of a fastapi application using a powerful tech stack consisting of FastAPI, PostgreSQL, and integrating Hanko authentication for enhanced security.
-
FastAPI Production Setup Guide 🏁⚡️🚀
import logging import sys import time from datetime import datetime from typing import Any, Callable, TypeVar import uvicorn from bson import ObjectId from fastapi import FastAPI, HTTPException, Path, Request, Response from fastapi.middleware.cors import CORSMiddleware from motor.motor_asyncio import AsyncIOMotorClient from pydantic import BaseModel from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): mongo_uri: str root_path: str = "" logging_level: str = "INFO" model_config = SettingsConfigDict(env_file=".env", extra="ignore") settings = Settings() logging.basicConfig( stream=sys.stdout, level=settings.logging_level, format="[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s", # noqa: E501 datefmt="%d/%b/%Y %H:%M:%S", ) logger = logging.getLogger("my-todos") db_client = AsyncIOMotorClient(settings.mongo_uri) db = db_client.todoDb description = """ This is a fancy API built with [FastAPI🚀](https://fastapi.tiangolo.com/) 📝 [Source Code](https://github.com/dpills/fastapi-prod-guide) 🐞 [Issues](https://github.com/dpills/fastapi-prod-guide/issues) """ app = FastAPI( title="My Todo App", description=description, version="1.0.0", docs_url="/", root_path=settings.root_path, ) app.add_middleware( CORSMiddleware, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], allow_origins=[ "http://localhost:3000", ], ) MONGO_ID_REGEX = r"^[a-f\d]{24}$" F = TypeVar("F", bound=Callable[..., Any]) class Todo(BaseModel): title: str completed: bool = False class TodoId(BaseModel): id: str class TodoRecord(TodoId, Todo): created_date: datetime updated_date: datetime class NotFoundException(BaseModel): detail: str = "Not Found" @app.middleware("http") async def process_time_log_middleware(request: Request, call_next: F) -> Response: """ Add API process time in response headers and log calls """ start_time = time.time() response: Response = await call_next(request) process_time = str(round(time.time() - start_time, 3)) response.headers["X-Process-Time"] = process_time logger.info( "Method=%s Path=%s StatusCode=%s ProcessTime=%s", request.method, request.url.path, response.status_code, process_time, ) return response @app.post("/todos", response_model=TodoId) async def create_todo(payload: Todo) -> TodoId: """ Create a new Todo """ now = datetime.utcnow() insert_result = await db.todos.insert_one( { "title": payload.title, "completed": payload.completed, "created_date": now, "updated_date": now, } ) return TodoId(id=str(insert_result.inserted_id)) @app.get( "/todos/{id}", response_model=TodoRecord, responses={ 404: {"description": "Not Found", "model": NotFoundException}, }, ) async def get_todo( id: str = Path(description="Todo ID", pattern=MONGO_ID_REGEX) ) -> TodoRecord: """ Get a Todo """ doc = await db.todos.find_one({"_id": ObjectId(id)}) if not doc: raise HTTPException(status_code=404, detail="Not Found") return TodoRecord( id=str(doc["_id"]), title=doc["title"], completed=doc["completed"], created_date=doc["created_date"], updated_date=doc["updated_date"], ) @app.get("/todos", response_model=list[TodoRecord]) async def get_todos() -> list[TodoRecord]: """ Get Todos """ todos: list[TodoRecord] = [] async for doc in db.todos.find(): todos.append( TodoRecord( id=str(doc["_id"]), title=doc["title"], completed=doc["completed"], created_date=doc["created_date"], updated_date=doc["updated_date"], ) ) return todos @app.put( "/todos/{id}", response_model=TodoId, responses={ 404: {"description": "Not Found", "model": NotFoundException}, }, ) async def update_todo( payload: Todo, id: str = Path(description="Todo ID", pattern=MONGO_ID_REGEX), ) -> TodoId: """ Update a Todo """ now = datetime.utcnow() update_result = await db.todos.update_one( {"_id": ObjectId(id)}, { "$set": { "title": payload.title, "completed": payload.completed, "updated_date": now, } }, ) if update_result.matched_count == 0: raise HTTPException(status_code=404, detail="Not Found") return TodoId(id=id) @app.delete( "/todos/{id}", response_model=bool, responses={ 404: {"description": "Not Found", "model": NotFoundException}, }, ) async def delete_todo( id: str = Path(description="Todo ID", pattern=MONGO_ID_REGEX), ) -> bool: """ Delete a Todo """ delete_result = await db.todos.delete_one({"_id": ObjectId(id)}) if delete_result.deleted_count == 0: raise HTTPException(status_code=404, detail="Not Found") return True if __name__ == "__main__": uvicorn.run( "main:app", host="0.0.0.0", port=8000, log_level="debug", reload=True, )
-
An Introduction to ⚡FastAPI
FastAPI documentation
-
DevOps with Fast API & PostgreSQL: How to containerize Fast API Application with Docker
FastAPI is an open-source modern framework that is used to build APIs in Python.
What are some alternatives?
AIOHTTP - Asynchronous HTTP client/server framework for asyncio and Python
HS-Sanic - Async Python 3.6+ web server/framework | Build fast. Run fast. [Moved to: https://github.com/sanic-org/sanic]
Tornado - Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.
django-ninja - 💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
Flask - The Python micro framework for building web applications.
swagger-ui - Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Django - The Web framework for perfectionists with deadlines.
starlite - Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs [Moved to: https://github.com/litestar-org/litestar]
BentoML - Build Production-Grade AI Applications
django-rest-framework - Web APIs for Django. 🎸
vibora - Fast, asynchronous and elegant Python web framework.
chalice - Python Serverless Microframework for AWS