src layout: move core code into src/tinyweb/ package

- Moved app.py, db.py, gateway.py, templates.py, embeddings.py,
  rns_client.py, and handlers/ into src/tinyweb/
- Created root app.py shim (adds src/ to sys.path, imports main)
- Created pyproject.toml with setuptools config (where = ["src"])
- Added src/tinyweb/__init__.py
- Updated all internal imports to use tinyweb. prefix (73 occurrences)
- Removed sys.path.insert hack from conftest.py
- Updated Dockerfile: pip install -e /app before running
- Updated gateway.py usage message: python -m tinyweb.gateway
- Updated README.md gateway usage instructions
This commit is contained in:
blankie 2026-06-17 05:03:23 +00:00
parent fc4e0c0b1d
commit 76672aa838
35 changed files with 400 additions and 384 deletions

View file

@ -8,8 +8,8 @@ import io
import pytest
import app as app_module
from gateway import GatewayHandler, MAX_BODY_SIZE
from tinyweb import app as app_module
from tinyweb.gateway import GatewayHandler, MAX_BODY_SIZE
class FakeHeaders:
@ -72,7 +72,7 @@ def test_post_at_size_cap_accepted():
rfile=io.BytesIO(b""),
)
# Stub out local_dispatch so _forward doesn't try the network path.
from gateway import GatewayState
from tinyweb.gateway import GatewayState
original = GatewayState.local_dispatch
GatewayState.local_dispatch = lambda data: {
"status": 404, "content_type": "text/plain", "body": "nope",