Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

TODO

  • Add async support for database connection
  • Add version without postgresql dependency

Release files for creyPY 2.0.2rc2

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

Source distribution (sdist)

Source distribution for creyPY 2.0.2rc2
File Size Uploaded
creypy-2.0.2rc2.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for creyPY 2.0.2rc2
File Interpreter ABI Platform
creyPY-2.0.2rc2-py3-none-any.whl Python 3 none any Details

Total release size: 31.7 kB

Release files / creypy-2.0.2rc2.tar.gz

Download URL creypy-2.0.2rc2.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2acb7f9f71741b579d036643fe5e8445a311e78a59a8c00edb6234ccb20bd9dc
BLAKE2b-256 checksum
How to use checksums
827a26874efc31070f3a98265808f7ebdb5c19e4a6b09dee126702dd7deebecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.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 Nov 5, 2024.

Transparency log

Release files / creyPY-2.0.2rc2-py3-none-any.whl

Download URL creyPY-2.0.2rc2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d3e84664b57e809a57fbb3430a1952b2de222847b5e7971311c2c0a437ee17b
BLAKE2b-256 checksum
How to use checksums
af12c6ace48bbb0df1c404223ea0c7bf37875a0218a82c009eb03cc6e6025884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.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 Nov 5, 2024.

Transparency log

Release history Release notifications | RSS feed

3.0.0

2 release files

2.1.0

2 release files

2.0.2

2 release files

This release

2.0.2rc2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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