creyPY


NamecreyPY JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/creyD/creyPY
SummaryCollection of my Python and FastAPI shortcuts, snippets etc.
upload_time2025-01-21 11:17:14
maintainerNone
docs_urlNone
authorConrad Großer
requires_python>=3.12
licenseMIT
keywords creypy python fastapi shortcuts snippets utils
VCS
bugtrack_url
requirements annotated-types pydantic pydantic-core typing-extensions anyio fastapi idna sniffio starlette fastapi-pagination sqlalchemy sqlalchemy-utils python-dotenv h11 httpcore httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
``` 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/creyD/creyPY",
    "name": "creyPY",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "creyPY, Python, FastAPI, shortcuts, snippets, utils",
    "author": "Conrad Gro\u00dfer",
    "author_email": "conrad@noah.tech",
    "download_url": "https://files.pythonhosted.org/packages/07/08/7d2e2e092ca6318fe352827702bd3842e6d7d04c4de9d7e6c1e444ef81a3/creypy-3.0.0.tar.gz",
    "platform": "any",
    "description": "# creyPY\n\nMy collection of Python and FastAPI shortcuts etc.\n\n## Installation\n\n```bash\npip install creyPY -U\n```\n\n## Versioning\n\nThis library uses [Semantic Versioning](https://semver.org/).\n\n## FastAPI\n\nThis 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.\n\n### Database connection\n\nThe `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:\n\n- `POSTGRES_HOST`: The host of the database\n- `POSTGRES_PORT`: The port of the database\n- `POSTGRES_USER`: The user of the database\n- `POSTGRES_PASSWORD`: The password of the database\n- `POSTGRES_DB`: The database name\n\nCurrently 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:\n\n```python\nfrom creyPY.fastapi.db.session import get_db\n\nasync def test_endpoint(\n    db: Session = Depends(get_db),\n) -> Any:\n    pass\n```\n\n## Constants\n\nThe 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:\n\n- LanguageEnum: Contains all languages according to ISO 639\n- CountryEnum: Contains all countries according to ISO 3166\n- CurrencyEnum: Contains all accepted stripe currencies (Commented out are the Zero-decimal currencies, to avoid custom implementation)\n- StripeStatus: Contains all stripe payment statuses\n- GroupMode: Contains time group modes (e.g. day, week, month, year)\n\n### Usage example\n\n```python\nfrom creyPY.const import LanguageEnum\n\nprint(LanguageEnum.EN) # Output: LanguageEnum.EN\nprint(LanguageEnum.EN.value) # Output: English\n``` \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Collection of my Python and FastAPI shortcuts, snippets etc.",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/creyD/creyPY"
    },
    "split_keywords": [
        "creypy",
        " python",
        " fastapi",
        " shortcuts",
        " snippets",
        " utils"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0a9ca7f836bf941c916ca77bad9c749c238b9939267a4cb746ab5dc1f70a6c3",
                "md5": "7bb86e35610e1b9c80fe53c26916784b",
                "sha256": "b9a587abfd1da710952e18362b2650548310c35e661343eff558388d56b9f0ce"
            },
            "downloads": -1,
            "filename": "creyPY-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7bb86e35610e1b9c80fe53c26916784b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 23562,
            "upload_time": "2025-01-21T11:17:12",
            "upload_time_iso_8601": "2025-01-21T11:17:12.952652Z",
            "url": "https://files.pythonhosted.org/packages/c0/a9/ca7f836bf941c916ca77bad9c749c238b9939267a4cb746ab5dc1f70a6c3/creyPY-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07087d2e2e092ca6318fe352827702bd3842e6d7d04c4de9d7e6c1e444ef81a3",
                "md5": "9e2d7be5962700d341809e587aedb919",
                "sha256": "f51d88d0bc484c1dcd5677afe1b59a20cf3206beb2c2d4de1a2c16db98125720"
            },
            "downloads": -1,
            "filename": "creypy-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9e2d7be5962700d341809e587aedb919",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 20002,
            "upload_time": "2025-01-21T11:17:14",
            "upload_time_iso_8601": "2025-01-21T11:17:14.815339Z",
            "url": "https://files.pythonhosted.org/packages/07/08/7d2e2e092ca6318fe352827702bd3842e6d7d04c4de9d7e6c1e444ef81a3/creypy-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-21 11:17:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "creyD",
    "github_project": "creyPY",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "annotated-types",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "pydantic-core",
            "specs": [
                [
                    ">=",
                    "2.20.1"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "anyio",
            "specs": [
                [
                    ">=",
                    "4.4.0"
                ]
            ]
        },
        {
            "name": "fastapi",
            "specs": [
                [
                    ">=",
                    "0.111.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    ">=",
                    "3.7"
                ]
            ]
        },
        {
            "name": "sniffio",
            "specs": [
                [
                    ">=",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "starlette",
            "specs": [
                [
                    ">=",
                    "0.37.2"
                ]
            ]
        },
        {
            "name": "fastapi-pagination",
            "specs": [
                [
                    ">=",
                    "0.12.26"
                ]
            ]
        },
        {
            "name": "sqlalchemy",
            "specs": [
                [
                    ">=",
                    "2.0.31"
                ]
            ]
        },
        {
            "name": "sqlalchemy-utils",
            "specs": [
                [
                    ">=",
                    "0.41.2"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    ">=",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "h11",
            "specs": [
                [
                    ">=",
                    "0.14.0"
                ]
            ]
        },
        {
            "name": "httpcore",
            "specs": [
                [
                    ">=",
                    "1.0.5"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    ">=",
                    "0.27.0"
                ]
            ]
        }
    ],
    "lcname": "creypy"
}
        
Elapsed time: 0.41802s