No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
renovate[bot] 171ea78ac2
feat(deps): update stefanzweifel/git-auto-commit-action action to v7 (#61)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-08 14:12:14 +02:00
.github/workflows feat(deps): update stefanzweifel/git-auto-commit-action action to v7 (#61) 2026-06-08 14:12:14 +02:00
.vscode fix: minor vscode adjustments 2024-10-24 09:32:11 +02:00
creyPY fix: added name for primary key constraint 2025-07-24 23:10:46 +02:00
.gitignore feat: Added Email Sending Service (#52) 2025-06-03 10:00:49 +02:00
__init__.py Added const module 2024-04-01 17:58:40 +02:00
CHANGELOG.md fix: minor changelog adjustment 2024-10-24 12:15:23 +02:00
LICENSE Minor Changes 2024-04-01 19:22:08 +02:00
README.md Update README.md 2024-11-24 18:02:00 +01:00
renovate.json chore: Configure Renovate (#20) 2024-11-24 16:23:52 +01:00
requirements.auth0.txt fix: bumped security risks and enabled newer packages installed 2024-12-04 20:05:19 +01:00
requirements.build.txt breaking: default version no longer uses postgres 2024-11-24 17:57:49 +01:00
requirements.pg.txt breaking: default version no longer uses postgres 2024-11-24 17:57:49 +01:00
requirements.stripe.txt feat(deps): update dependency stripe to v15.2.0 (#66) 2026-06-08 14:11:51 +02:00
requirements.txt fix: bumped security risks and enabled newer packages installed 2024-12-04 20:05:19 +01:00
setup.py fix: updated mail 2025-01-21 22:20:16 +01:00
test.py fix: fixed tests 2025-01-24 19:10:36 +01:00

creyPY

My collection of Python and FastAPI shortcuts etc.

Installation

pip install creyPY -U

Versioning

This library uses Semantic Versioning.

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:

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

from creyPY.const import LanguageEnum

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