Containerized application framework with additional libraries and tools for rapid development of web applications.
Project description
Autonomous
:warning: :warning: :warning: WiP :warning: :warning: :warning:
Autonomous is an ORM + utility framework layer you lay over whatever micro-framework you choose (Flask, FastAPI, Starlette, pure WSGI, an async worker, a CLI) to stop rewriting the same containerized-service plumbing on every project.
It is not a web framework. It ships a MongoDB-backed ORM, a Redis-backed task runner, pluggable file storage, OAuth2 auth, AI-model adapters, and a tiny WSGI-compatible response/session layer so the auth pieces drop into any host framework without a hard dependency on it.
What you get
| Area | Module | What it does |
|---|---|---|
| ORM | autonomous.model.automodel |
AutoModel — a MongoDB-backed document with typed attributes (StringAttr, IntAttr, DateTimeAttr, ListAttr, ReferenceAttr). Handles save/get/random/delete, inheritance, circular & dangling references. |
| Auth | autonomous.auth |
AutoAuth base + GoogleAuth / GithubAuth OAuth2 flows built on Authlib; AutoUser model with authenticated / guest / admin roles; @auth_required decorator for host views. |
| Web shim | autonomous.web |
WSGI-compatible Response + redirect(), a pluggable SessionStore protocol, a ContextSession default, and a stdlib-only SignedCookieSession. The auth decorator talks to these, not to any framework's globals. |
| Tasks | autonomous.taskrunner.autotasks |
AutoTasks wraps RQ + Redis with priority queues, timeouts, current-job helpers. |
| Storage | autonomous.storage |
LocalStorage + ImageStorage (thumbnails / resized variants) for filesystem-backed asset storage with URL resolution. |
| AI | autonomous.ai.models.local_model, gemini |
Adapters for Ollama (local LLM), a media service for image/audio generation, and Google Gemini. All endpoints are HTTP so tests mock requests.post. |
| Logging | autonomous.logger |
Leveled, toggleable logger reachable as from autonomous import log. |
How it's meant to be used
Bring your own web micro-framework. Mount Autonomous components in your views, tasks, and CLI scripts. The library stays framework-agnostic.
Flask
from flask import Flask, session as flask_session, url_for
from autonomous.auth import AutoAuth
from autonomous.auth.google import GoogleAuth
from autonomous.web import bind_session
app = Flask(__name__)
AutoAuth.login_url = "/auth/login" # or url_for("auth.login") inside a request
@app.before_request
def _bind():
# flask_session is already a dict-like; Autonomous will read/write it
bind_session(flask_session)
@app.route("/me")
@AutoAuth.auth_required()
def me():
return AutoAuth.current_user().to_json()
FastAPI / Starlette / pure WSGI
from autonomous.web import ContextSession, bind_session, redirect
def middleware(environ, start_response):
bind_session(ContextSession()) # per-request dict session
# ... dispatch to the view; if it returns a Response it's WSGI-callable:
response = view(environ)
return response(environ, start_response)
Task runner
from autonomous.taskrunner.autotasks import AutoTasks, TaskPriority
def send_email(to, body): ...
AutoTasks().task(send_email, "a@b.c", "hi", priority=TaskPriority.HIGH)
ORM
from autonomous.model.automodel import AutoModel
from autonomous.model.autoattr import StringAttr, IntAttr
class Post(AutoModel):
title = StringAttr(default="")
views = IntAttr()
p = Post(title="hello"); p.save()
Post.get(p.pk).title # "hello"
Dependencies
- Languages
- Containers
- Server
- Database
- pymongo (MongoDB driver)
- Task queue
- Auth
- Authlib (OAuth2 / OIDC)
- Networking
- AI
- Testing
- Documentation
- Hand-authored guides live under
docs/(Markdown). - A zero-dependency generator at
scripts/gen_docs.pyintrospects the public surface and renders a navigable HTML reference todocs/_build/. - Build:
make docs. Then opendocs/_build/index.html.
- Hand-authored guides live under
Autonomous has no framework dependency — pick your own (Flask, FastAPI, pure WSGI, CLI) and plug Autonomous into it.
Developer Notes
TODO
- Setup/fix template app generator
- Switch to less verbose html preprocessor
- 100% testing coverage
Issue Tracking
- None
Processes
Generate app
TBD
Tests
make tests
Package
- Update version in
/src/autonomous/__init__.py make package
Task List
Backlog of known improvements across the framework, sorted from highest to lowest overall impact. Each item is tagged with the axis it primarily addresses (security / stability / functionality / efficiency / usability) and a concrete file:line anchor.
-
[security]
apis/version_control/GHCallbacks.py:38—certificate_checkreturnsTrueunconditionally, disabling TLS verification for every git operation. Enable verification or make the bypass an explicit, logged opt-in. -
[stability] AI backend signatures drift across
ai/models/local_model.py,ai/models/gemini.py, andai/models/mock_model.py.generate_json(system_promptvsfunction),upscale_image(image_contentvsfile), andgenerate_transcription(structured dict vs raw text) disagree so swapping the backend raises at runtime. Pin signatures onBaseAgentand make adapters conform. -
[functionality]
storage/imagestorage.py:224,239,250—remove(),rotate(), andflip()unconditionally returnFalse(TODO stubs). Implement the operations or remove them from the public surface. -
[stability]
apis/version_control/GHRepo.py:97,99—commit()hard-codes "Steven Moore" / "samoore@binghamton.edu" as the committer identity and uses a fixed commit message. Read from config or require args. -
[stability]
auth/autoauth.py:129,auth/google.py:22— userinfo is fetched withrequests.get(...).json(): no timeout, no retry, no status-code check. Transient network blips propagate as 500s. Wrap in the existingautonomous.ai.retry.retryhelper with a bounded timeout. -
[stability]
ai/models/gemini.py:162-164— unboundedwhileloop pollingfile.statewith a 0.5s sleep and no cap. Add a max-attempts / wall-clock limit and raise on timeout. -
[functionality]
cli.py—createapp()is a single placeholder. Wire real commands:autonomous init,autonomous docs build,autonomous tasks run-worker. -
[functionality]
model/automodel.py— no bulk operations. AddAutoModel.bulk_create(objs)andbulk_update(filter, **set)backed byinsert_many/update_many. Hot write paths currently loop.save()per object. -
[stability]
apis/version_control/GHRepo.py:18,36-41—pathandrepo.nameare joined onto the on-disk target without traversal validation. Reuse_sanitize_relative/_safe_joinfromstorage/localstorage.py. -
[stability] GitHub APIs have no rate-limit handling. PyGithub raises
RateLimitExceededExceptionon 403; the wrappers ignore it. Catch, sleep untilreset_at, retry. -
[functionality]
apis/version_control/GHOrganization.py:31—get_repos()iterates without pagination and silently truncates on orgs with more than 30 repos. Walk the full result set or accept apage_sizekwarg. -
[efficiency]
model/autoattr.pyListAttr.__get__— reference pruning fetches each referent one at a time (N+1). Batch-resolve viaQuerySet.in_bulkon the non-Nonepk set. -
[stability]
db/db_sync.py:16-18—_redis_client,_mongo_client,_mongo_dbsingletons are created under no lock. Guard withthreading.Lockor usefunctools.lru_cacheon the getter functions. -
[stability]
logger.py:85-88— handler opens files per call without locking. Concurrentlog()calls from gunicorn workers interleave. Switch tologging.handlers.RotatingFileHandleror add an explicit write lock. -
[functionality]
taskrunner/task_router.py—TaskRouterBase.ROUTESis an empty list; no register decorator, no dispatch primitives. Flesh out as a route-name → callable registry or delete the module. -
[efficiency]
ai/models/local_model.py:264-280—generate_text,generate_audio, andsummarize_textare single bare HTTP attempts. Route through the existingretry()helper. -
[functionality]
db/signals.py:51-57— pre/post init, save, delete only. Nopre_update/post_updatehook for partial field changes. Add signals and emit from the.update()helpers. -
[functionality] No soft-delete pattern on
AutoModel. Add an optionalSoftDeleteMixinwithdeleted_atplus a queryset filter that hides tombstones by default. -
[functionality]
storage/— no S3 / cloud backend. Extract a minimalStorageBackendprotocol; implementS3Storageas an extras-gated sibling ofLocalStorage. -
[usability] Hard-coded tuning knobs with no env-var override:
ai/models/local_model.py:32-36(four timeouts),storage/imagestorage.py:30(thumbnail sizes),storage/imagestorage.py:61,66(max_size=1024),taskrunner/autotasks.py:202(7200s job TTL). Promote each to an env-driven default. -
[stability]
ai/models/local_model.py:312-314—summarize_textbreaks its loop on the first exception and returns a partial summary silently. Count failures, raise when the whole batch fails, or route throughretry(). -
[efficiency]
ai/models/gemini.py:144,166—_add_filescallsclient.files.list()once per upload batch to resolve filenames. Use the upload response directly. -
[functionality] Test gaps — zero unit coverage for
apis/*,AutoTasks,ImageStorage.rotate/flip, or the optional-dependency stubs in the doc generator. Add hermetic tests that don't require Mongo/Redis. -
[usability]
autonomous/__init__.py— only re-exportsloginit. AddAutoModel,AutoAuth,Response,AutoTasksso consumers canfrom autonomous import AutoModel.
-
[efficiency]
db/db_sync.py:73— hardcoded 5-second sleep inprocess_single_object_sync. Replace with exponential backoff via theretry()helper. -
[stability]
ai/agents/imageagent.py:29— debugprint("provider", self.provider)left in the code path. Replace withlog(...)or delete. -
[stability]
utils/markdown.py:70-73— recursive parser has no depth limit; pathological input can stack-overflow. Add an explicit depth cap (e.g., 128). -
[usability]
apis/version_control/GHVersionControl.py:9-11—GHConfigdeclaresname: float/email: int; fields are never read anywhere. Fix the types or delete the dataclass.
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 autonomous_app-0.3.126.tar.gz.
File metadata
- Download URL: autonomous_app-0.3.126.tar.gz
- Upload date:
- Size: 137.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eb1142f67fe90dc90bad98a7a980c41fd87444e2ea15be90226690cd92eff13
|
|
| MD5 |
136cc0e4e77589c75a8a7868635db5b4
|
|
| BLAKE2b-256 |
261b33359394e1d91cd3227181e37c969479f456b5df27f0bcec310b95da31e5
|
File details
Details for the file autonomous_app-0.3.126-py3-none-any.whl.
File metadata
- Download URL: autonomous_app-0.3.126-py3-none-any.whl
- Upload date:
- Size: 153.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a545ec687b805f1e9b544b5a28fc7d223ec2728e7c25a2eef781b1e476e218be
|
|
| MD5 |
11a1029fb5f96b891b4cfd5abc1b746f
|
|
| BLAKE2b-256 |
2a2eb768082280450aac6f3328843520f9256dcfcb889c6a4ba1d6271e1828e2
|