A service management framework
Project description
Nautica V3
Nautica V3 (or N3) is a backend platform for Python. It gives you a managed runtime environment with a service registry, lifecycle system, CLI, and built-in tools, saving you time from putting your app together and giving you more time to build it.
What's Included
- Service Registry with dependency resolver
- Lifecycle hooks for install, start and shutdown
- TOML Config system with key management
- Logger with file output and memory
- Shell for interacting with services
- TUI for live logs, thread and worker inspection (optional)
- Plugin system for extending projects without modifying core code
- Many Built-in Services, including HTTP API
I made N3 because I was solving the same problems in my projects, those being: configs, logging, figuring out startup orders, not to mention the validation boilerplate on every route. Because of this I made Nautica V2, which solved many of these issues, and V3 to improve on the idea.
Get Started
Firstly, install Nautica:
pip install nautica
To create a project, use the CLI (docs):
nautica create my-project
cd my-project
nautica run
To setup an existing project:
cd my-project
nautica install
nautica run
How HTTP API Compares
Benchmark Performance
| Library | Requests/Second | Avg Latency | Overall |
|---|---|---|---|
| Nautica3 | 2271 |
4.4ms |
- |
| FastAPI | 2259 |
4.4ms |
0.5% slower |
| Flask | 75 |
132.6ms |
96% slower |
Ran with 10 workers, for 10 seconds. Nautica3 matches FastAPI despite running additional middleware, requirement parsing, and logging on every request.
Code Complexity
Similarly to SvelteKit, Nautica defines the route names for you. This helps to reduce boilerplate (see Flask and FastAPI examples), improve readability, and helps with naming conventions
Nautica3
# file: src/http/api/v1/auth.py
from napi.http import HTTP, Context, Reply
from somewhere import username, password
@HTTP.POST()
@HTTP.Require(body = {"username": str, "password": str})
def login(ctx: Context):
if ctx.body["username"] == username and ctx.body["password"] == password:
return Reply(ok=True)
return Reply(ok=False, error="Invalid credentials"), 401
Flask
# file: main.py
from flask import Flask, request
from flask.blueprints import Blueprint
import json
from somewhere import username, password
app = Flask(__name__)
v1auth = Blueprint("v1auth", __name__, url_prefix="/api/v1/auth")
@v1auth.post("/login")
def login():
data = request.get_json(silent=True) or {}
if data.get("username") == username and data.get("password") == password:
return json.dumps({"ok": True})
return json.dumps({"ok": False, "error": "Invalid credentials"}), 401
app.register_blueprint(v1auth)
app.run(port=8101)
FastAPI
# file: main.py
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import uvicorn
from somewhere import username, password
app = FastAPI()
class LoginRequest(BaseModel):
username: str
password: str
@app.post("/api/v1/auth/login")
def login(body: LoginRequest):
if body.username == username and body.password == password:
return {"ok": True}
raise HTTPException(status_code=401, detail="Invalid credentials")
uvicorn.run(app, port=8101)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nautica-3.2.0.tar.gz.
File metadata
- Download URL: nautica-3.2.0.tar.gz
- Upload date:
- Size: 48.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3ab619a2a7ea7ed8f039d9dd0369e1cd6dd11438f291615c6a7d64166ac905d
|
|
| MD5 |
c4bd659c59fa8c94111583c9c615f914
|
|
| BLAKE2b-256 |
6ad9bbb0073d419e9d2b6aee735255727c75336e34309214fe4d8dac18664af6
|
File details
Details for the file nautica-3.2.0-py3-none-any.whl.
File metadata
- Download URL: nautica-3.2.0-py3-none-any.whl
- Upload date:
- Size: 61.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b6d58f0f743bd5d078a4d08644fea47ceb359a83f8a92b0b768c265be9c4484
|
|
| MD5 |
c7a19f0ec9d1b01d8084b0fd0b57aa6f
|
|
| BLAKE2b-256 |
ef95120c1ad893e4fae8708933001e9fbd67af88d124d07b71823fa975230784
|