Metadata-Version: 2.3
Name: nyxa-postgres
Version: 0.1.0
Summary: PostgreSQL extras for Nyxa — URL helpers, pool defaults, compose snippet
Keywords: fastapi,postgresql,nyxa,sqlalchemy
Author: Al-Amin Islam Nerob
Author-email: Al-Amin Islam Nerob <alamin@aincoder.com>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Dist: nyxa-db>=0.1.0
Requires-Dist: psycopg[binary]>=3.0
Requires-Python: >=3.11
Project-URL: Homepage, https://nyxadev.com
Project-URL: Repository, https://github.com/NyxaDev/nyxa
Description-Content-Type: text/markdown

# nyxa-postgres — PostgreSQL extras for Nyxa

Optional helpers for apps using [nyxa-db](https://pypi.org/project/nyxa-db/)
with PostgreSQL. Core `nyxa` and `nyxa-db` do **not** hard-depend on this package.

## Install

```bash
uv add nyxa-db nyxa-postgres
```

Or scaffold with Postgres wiring:

```bash
uv run nyxa init myapi --database postgres
```

That adds both packages, a matching `DATABASE_URL`, and a `docker-compose.yml`.

## URL helper

```python
from nyxa_postgres import postgres_url

url = postgres_url(user="user", password="pass", database="app")
# postgresql+psycopg://user:pass@localhost:5432/app
```

## Soft pool defaults

When `DATABASE_URL` is a Postgres URL and `nyxa-postgres` is installed,
`nyxa_db.get_engine` applies `pool_kwargs()` (`pool_size=5`, `max_overflow=10`,
`pool_pre_ping=True`). Without this package, engines use SQLAlchemy defaults.

## Compose snippet

```python
from nyxa_postgres import compose_snippet

print(compose_snippet())  # postgres:16, user/pass/app on :5432
```

```bash
docker compose up -d
uv run nyxa db migrate
```
