Registry / auth-security / imia
library0.5.3pypypiunverified

Full stack authentication library for ASGI frameworks. Version 0.5.3, requires Python >=3.8.0. Active development with regular minor releases.

pip install imia
INSTALL
IMPORT
SIG · IMIA
I
imia
auth-securitypythonv0.5.3
Install
2.5s avg
Import
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 37.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.5s · import 0.000s · 33MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthenticationMiddleware
from imia import AuthenticationMiddleware
from imia import AuthenticationMiddleware

Minimal ASGI app with imia authentication middleware using in-memory user storage.

from imia import AuthenticationMiddleware, LoginManager from imia.providers import InMemoryUserProvider from starlette.applications import Starlette from starlette.responses import JSONResponse from starlette.routing import Route import os # Define a user provider (must implement find_by_id with connection arg) class MyUserProvider(InMemoryUserProvider): async def find_by_id(self, connection, user_id): # InMemoryUserProvider already does this, but override for custom logic return await super().find_by_id(connection, user_id) provider = MyUserProvider({ '1': {'id': '1', 'name': 'Alice'}, '2': {'id': '2', 'name': 'Bob'}, }) login_manager = LoginManager(provider) async def homepage(request): user = request['user'] return JSONResponse({'user': user['name'] if user else None}) app = Starlette(routes=[Route('/', homepage)]) app.add_middleware(AuthenticationMiddleware, login_manager=login_manager)
Debug
Known issues
breakingIn v0.5.1, UserProvider methods (e.g., find_by_id, find_by_login) now require an HTTPConnection instance as the first argument. Old custom providers will fail with TypeError.
fix
Update all UserProvider method signatures to include connection: HTTPConnection as first parameter.
affects: >=0.5.1
deprecatedIn v0.5.3, sqlalchemy and aiosqlite are no longer core dependencies; they are optional extras. Installing imia without extras will not include these libraries.
fix
Install with pip install imia[sqlalchemy] if using SQLAlchemy support.
affects: >=0.5.3
gotchaThe authenticate function (added in v0.5.1) is in imia.authentication module, not at package root. Importing from imia.authenticate will fail.
fix
Use 'from imia.authentication import authenticate'.
affects: >=0.5.1
Upgrade
Version history
0.5.3latest on PyPI · released Jul 15, 2022
Audit
Dependencies
sqlalchemyoptionalOptional, for SQLAlchemy user provider
aiosqliteoptionalOptional, required when using SQLAlchemy with aiosqlite
Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
imia — pip install imia · libregistry