Skip to main content

Vexen-User

Sistema de gestión de usuarios con arquitectura hexagonal, diseñado para integrarse con vexen-rbac y vexen-auth.

Características

  • Arquitectura Hexagonal: Separación clara entre dominio, aplicación e infraestructura
  • Async/Await: Totalmente asíncrono usando SQLAlchemy 2.0+ con asyncpg
  • Type Safe: Completamente tipado para mejor soporte en IDEs
  • API Pública Simple: Similar a FastAPI, fácil de usar
  • Paginación y Filtros: Soporte completo para búsqueda, filtros y paginación
  • Estadísticas: Obtén métricas sobre usuarios del sistema

Implementado

✅ Entidades: User entity completa con validaciones ✅ Repositorios: IUserRepositoryPort (interface) e implementación SQLAlchemy ✅ DTOs: Todas las estructuras de request/response según especificaciones ✅ Casos de Uso: list, get, create, update, delete, stats ✅ Servicio: UserService que orquesta los casos de uso ✅ API Pública: VexenUser class (similar a RBAC) ✅ Adapters: Gestión de sesiones SQLAlchemy ✅ Ejemplo funcional: example_usage.py

Uso Rápido

import asyncio
from vexen_user import VexenUser
from vexen_user.application.dto import CreateUserRequest

async def main():
    user_system = VexenUser(
        database_url="postgresql+asyncpg://user:pass@localhost/db"
    )

    await user_system.init()

    # Crear usuario
    user = await user_system.service.create(
        CreateUserRequest(
            email="user@example.com",
            name="John Doe"
        )
    )

    # Listar usuarios
    users = await user_system.service.list(page=1, page_size=20)

    # Obtener estadísticas
    stats = await user_system.service.stats()

    await user_system.close()

if __name__ == "__main__":
    asyncio.run(main())

Instalación

pip install vexen-user

Estructura del Proyecto

vexen_user/
├── domain/              # Capa de dominio (entidades, puertos)
│   ├── entity/         # User entity
│   └── repository/     # IUserRepositoryPort
├── application/        # Capa de aplicación (casos de uso, DTOs)
│   ├── dto/           # Request/Response DTOs
│   ├── usecase/       # Casos de uso
│   └── service/       # UserService
└── infraestructure/   # Capa de infraestructura (adaptadores)
    └── output/
        └── persistence/
            └── sqlalchemy/  # SQLAlchemy adapter

DTOs Disponibles

Request DTOs

  • CreateUserRequest: Crear nuevo usuario
  • UpdateUserRequest: Actualizar usuario completo
  • PatchUserRequest: Actualizar campos específicos

Response DTOs

  • UserResponse: Información básica de usuario
  • UserExpandedResponse: Información completa con metadatos
  • PaginatedUsersResponse: Lista paginada de usuarios
  • UserStatsResponse: Estadísticas del sistema

Casos de Uso

  • ListUsers: Listar usuarios con paginación y filtros
  • GetUser: Obtener usuario por ID o email
  • CreateUser: Crear nuevo usuario
  • UpdateUser: Actualizar usuario
  • DeleteUser: Eliminar usuario (soft delete)
  • GetUserStats: Obtener estadísticas

Integración con otros sistemas

Este paquete está diseñado para trabajar con:

  • vexen-rbac: Sistema de control de acceso basado en roles
  • vexen-auth: Sistema de autenticación

Desarrollo

# Instalar dependencias de desarrollo
pip install -e ".[dev]"

# Ejecutar tests
pytest

# Formatear código
ruff format .

# Linting
ruff check . --fix

Licencia

MIT

Links

Metadata

Release files for vexen-user 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vexen-user 0.1.5
File Size Uploaded Provenance
vexen_user-0.1.5.tar.gz 38.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vexen-user 0.1.5
File Interpreter ABI Platform
vexen_user-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 60.0 kB

Release files / vexen_user-0.1.5.tar.gz

Download URL vexen_user-0.1.5.tar.gz
Size 38.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f827b847934aa91de60721f87b7cd870b7fcf4b29ffd735ff1b9a4f41b1e7c38
BLAKE2b-256 checksum
How to use checksums
56fbe3da365fe5524739737ae6634dbf13b2f9936ce7136d655f37ed8b92d550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2025.

Transparency log

Release files / vexen_user-0.1.5-py3-none-any.whl

Download URL vexen_user-0.1.5-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11266182a655814d0b352fb7c5f87d47e016a4b40969dd20a59d92180808fdf0
BLAKE2b-256 checksum
How to use checksums
9e954ed39c090ccc2cd54fb765371014443f8cba7a49c79e02f7ea60f72c860e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2025.

Transparency log

Security for vexen-user 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vexen_user-0.1.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page