Metadata-Version: 2.4
Name: creyPY
Version: 3.1.0rc56
Summary: Collection of my Python and FastAPI shortcuts, snippets etc.
Home-page: https://github.com/creyD/creyPY
Author: Conrad Großer
Author-email: code@grosser.group
License: MIT
Keywords: creyPY,Python,FastAPI,shortcuts,snippets,utils
Platform: any
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: annotated-types>=0.7.0
Requires-Dist: pydantic>=2.8.2
Requires-Dist: pydantic-core>=2.20.1
Requires-Dist: typing-extensions>=4.12.2
Requires-Dist: anyio>=4.4.0
Requires-Dist: fastapi>=0.111.0
Requires-Dist: idna>=3.7
Requires-Dist: sniffio>=1.3.1
Requires-Dist: starlette>=0.37.2
Requires-Dist: fastapi-pagination>=0.12.26
Requires-Dist: sqlalchemy>=2.0.31
Requires-Dist: sqlalchemy-utils>=0.41.2
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: h11>=0.14.0
Requires-Dist: httpcore>=1.0.5
Requires-Dist: httpx>=0.27.0
Provides-Extra: build
Requires-Dist: certifi>=2024.2.2; extra == "build"
Requires-Dist: charset-normalizer>=3.3.2; extra == "build"
Requires-Dist: docutils>=0.20.1; extra == "build"
Requires-Dist: idna>=3.6; extra == "build"
Requires-Dist: importlib_metadata>=7.1.0; extra == "build"
Requires-Dist: jaraco.classes>=3.4.0; extra == "build"
Requires-Dist: jaraco.context>=4.3.0; extra == "build"
Requires-Dist: jaraco.functools>=4.0.0; extra == "build"
Requires-Dist: keyring>=25.0.0; extra == "build"
Requires-Dist: markdown-it-py>=3.0.0; extra == "build"
Requires-Dist: mdurl>=0.1.2; extra == "build"
Requires-Dist: more-itertools>=10.2.0; extra == "build"
Requires-Dist: nh3>=0.2.17; extra == "build"
Requires-Dist: pkginfo>=1.10.0; extra == "build"
Requires-Dist: Pygments>=2.17.2; extra == "build"
Requires-Dist: readme_renderer>=43.0; extra == "build"
Requires-Dist: requests>=2.31.0; extra == "build"
Requires-Dist: requests-toolbelt>=1.0.0; extra == "build"
Requires-Dist: rfc3986>=2.0.0; extra == "build"
Requires-Dist: rich>=13.7.1; extra == "build"
Requires-Dist: setuptools>=69.2.0; extra == "build"
Requires-Dist: twine>=5.0.0; extra == "build"
Requires-Dist: urllib3>=2.2.1; extra == "build"
Requires-Dist: wheel>=0.43.0; extra == "build"
Requires-Dist: zipp>=3.18.1; extra == "build"
Provides-Extra: postgres
Requires-Dist: psycopg>=3.2.1; extra == "postgres"
Requires-Dist: psycopg-binary>=3.2.1; extra == "postgres"
Requires-Dist: psycopg-pool>=3.2.2; extra == "postgres"
Requires-Dist: asyncpg>=0.30.0; extra == "postgres"
Requires-Dist: greenlet>=3.1.1; extra == "postgres"
Provides-Extra: auth0
Requires-Dist: cachetools>=5.5.0; extra == "auth0"
Requires-Dist: charset-normalizer>=3.4.0; extra == "auth0"
Requires-Dist: requests>=2.32.3; extra == "auth0"
Requires-Dist: pyjwt>=2.10.1; extra == "auth0"
Requires-Dist: cffi>=1.17.1; extra == "auth0"
Requires-Dist: cryptography>=43.0.3; extra == "auth0"
Requires-Dist: pycparser>=2.22; extra == "auth0"
Provides-Extra: stripe
Requires-Dist: stripe==12.3.0; extra == "stripe"
Provides-Extra: all
Requires-Dist: certifi>=2024.2.2; extra == "all"
Requires-Dist: charset-normalizer>=3.3.2; extra == "all"
Requires-Dist: docutils>=0.20.1; extra == "all"
Requires-Dist: idna>=3.6; extra == "all"
Requires-Dist: importlib_metadata>=7.1.0; extra == "all"
Requires-Dist: jaraco.classes>=3.4.0; extra == "all"
Requires-Dist: jaraco.context>=4.3.0; extra == "all"
Requires-Dist: jaraco.functools>=4.0.0; extra == "all"
Requires-Dist: keyring>=25.0.0; extra == "all"
Requires-Dist: markdown-it-py>=3.0.0; extra == "all"
Requires-Dist: mdurl>=0.1.2; extra == "all"
Requires-Dist: more-itertools>=10.2.0; extra == "all"
Requires-Dist: nh3>=0.2.17; extra == "all"
Requires-Dist: pkginfo>=1.10.0; extra == "all"
Requires-Dist: Pygments>=2.17.2; extra == "all"
Requires-Dist: readme_renderer>=43.0; extra == "all"
Requires-Dist: requests>=2.31.0; extra == "all"
Requires-Dist: requests-toolbelt>=1.0.0; extra == "all"
Requires-Dist: rfc3986>=2.0.0; extra == "all"
Requires-Dist: rich>=13.7.1; extra == "all"
Requires-Dist: setuptools>=69.2.0; extra == "all"
Requires-Dist: twine>=5.0.0; extra == "all"
Requires-Dist: urllib3>=2.2.1; extra == "all"
Requires-Dist: wheel>=0.43.0; extra == "all"
Requires-Dist: zipp>=3.18.1; extra == "all"
Requires-Dist: psycopg>=3.2.1; extra == "all"
Requires-Dist: psycopg-binary>=3.2.1; extra == "all"
Requires-Dist: psycopg-pool>=3.2.2; extra == "all"
Requires-Dist: asyncpg>=0.30.0; extra == "all"
Requires-Dist: greenlet>=3.1.1; extra == "all"
Requires-Dist: cachetools>=5.5.0; extra == "all"
Requires-Dist: charset-normalizer>=3.4.0; extra == "all"
Requires-Dist: requests>=2.32.3; extra == "all"
Requires-Dist: pyjwt>=2.10.1; extra == "all"
Requires-Dist: cffi>=1.17.1; extra == "all"
Requires-Dist: cryptography>=43.0.3; extra == "all"
Requires-Dist: pycparser>=2.22; extra == "all"
Requires-Dist: stripe==12.3.0; extra == "all"
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# creyPY

My collection of Python and FastAPI shortcuts etc.

## Installation

```bash
pip install creyPY -U
```

## Versioning

This library uses [Semantic Versioning](https://semver.org/).

## FastAPI

This library installes fastapi and pydantic, as well as sqlalchemy for you. It also provides a sqlalchemy base class and companion pydantic schemas. Also there are some helper functions for FastAPI in `creyPY.fastapi.app` like `generate_unique_id` to generate unique operation IDs for the OpenAPI schema to work with code generators.

### Database connection

The `creyPY.fastapi.db` module provides a `Session` class that can be used as a context manager to connect to a database. It exposes the `SQLALCHEMY_DATABASE_URL` variable for you to use. It uses the following environment variables:

- `POSTGRES_HOST`: The host of the database
- `POSTGRES_PORT`: The port of the database
- `POSTGRES_USER`: The user of the database
- `POSTGRES_PASSWORD`: The password of the database
- `POSTGRES_DB`: The database name

Currently only PostgreSQL is supported. It creates a sync session, it is planned to add async support in the future. You can use this like this:

```python
from creyPY.fastapi.db.session import get_db

async def test_endpoint(
    db: Session = Depends(get_db),
) -> Any:
    pass
```

## Constants

The constants module contains a few enums that I use in my projects. The best way to understand this library is to look at the code (it's not that much). However for simplicity, here is a brief overview:

- LanguageEnum: Contains all languages according to ISO 639
- CountryEnum: Contains all countries according to ISO 3166
- CurrencyEnum: Contains all accepted stripe currencies (Commented out are the Zero-decimal currencies, to avoid custom implementation)
- StripeStatus: Contains all stripe payment statuses
- GroupMode: Contains time group modes (e.g. day, week, month, year)

### Usage example

```python
from creyPY.const import LanguageEnum

print(LanguageEnum.EN) # Output: LanguageEnum.EN
print(LanguageEnum.EN.value) # Output: English
``` 
