Metadata-Version: 2.5
Name: user_registration
Version: 0.1.1
Summary: Framework-agnostic, extensible user registration for Python applications.
Project-URL: Homepage, https://github.com/ShamimurRahmanShuvo/user_registration
Project-URL: Repository, https://github.com/ShamimurRahmanShuvo/user_registration
Project-URL: Issues, https://github.com/ShamimurRahmanShuvo/user_registration/issues
Author: Md Shamimur Rahman Shuvo
License: MIT
License-File: LICENSE
Keywords: authentication,password,python,security,user-registration,users
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: argon2-cffi<26.0.0,>=23.1.0
Requires-Dist: password-validator-s<2.0.0,>=1.0.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Requires-Dist: sqlalchemy<3.0,>=2.0; extra == 'dev'
Description-Content-Type: text/markdown

# User Registration

A framework-agnostic and database-agnostic user registration package for Python applications.

`user-registration` provides the domain and application layer for registering users while keeping framework and persistence concerns outside the core package.

## Features

- Python 3.12+
- Typed Python API
- Framework independent
- Database independent
- Configurable registration behavior
- Username validation
- Email validation
- Extensible validation registry
- Password policy integration via `password-validator-s`
- Argon2 password hashing
- Repository abstraction
- Custom repository implementations
- Registration hooks
- Duplicate-user detection
- FastAPI adapter
- SQLAlchemy adapter
- Unit and integration tests
- Static type checking with mypy
- Linting and formatting with Ruff

### Core flow

```text
            RegistrationRequest
                 |
                 v
            RegistrationService
 +--------------------------------+
  |      |          |         |
  v      v          v         v
fields validation password repository
                   policy
                     |
                     v
                  hashing
                     |
                     v
                    User
```

## Architecture

The core package does not depend on FastAPI, Django, Flask, SQLAlchemy, PostgreSQL, MongoDB, or any other infrastructure technology.

```text
                       Application
                            |
                            v
                  +--------------------+
                  | RegistrationService|
                  +---------+----------+
                            |
          +-----------------+------------------+
          |                 |                  |
          v                 v                  v
   ValidationRegistry  PasswordHasher   UserRepository
                            |
                            v
                         Argon2
```

### Basic usage

```python
from user_registration import (
    Argon2Hasher,
    PasswordValidatorAdapter,
    RegistrationConfig,
    RegistrationRequest,
    RegistrationService,
)

service = RegistrationService(
    repository=repository,
    password_hasher=Argon2Hasher(),
    password_validator=PasswordValidatorAdapter(),
    config=RegistrationConfig(),
)

result = service.register(
    RegistrationRequest(
        username="shuvo",
        email="shuvo@example.com",
        password="StrongPassword123!",
    )
)

if result.success:
    print(result.user_id)
else:
    print(result.status, result.errors)
```

The application supplies the repository implementation.

### Explicitly out of scope

The core does not implement login, JWT, OAuth/OIDC, sessions, MFA, RBAC, password reset, email delivery, ORM models, database connections, or HTTP routing.

### Development

```bash
.venv/bin/python -m pytest -v
.venv/bin/python -m mypy src
.venv/bin/python -m ruff check src tests
.venv/bin/python -m ruff format --check src tests
.venv/bin/python -m build
```

## License

MIT

### Visit https://github.com/ShamimurRahmanShuvo/user_registration/tree/main/docs, for more details
