yak-server


Nameyak-server JSON
Version 0.57.1 PyPI version JSON
download
home_pageNone
SummaryFootball bet rest server
upload_time2025-08-23 15:26:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords api postgresql rest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Yak-toto

[![PyPI](https://img.shields.io/pypi/v/yak-server?label=stable)](https://pypi.org/project/yak-server/)
[![Python Versions](https://img.shields.io/pypi/pyversions/yak-server)](https://pypi.org/project/yak-server/)
[![codecov](https://codecov.io/gh/yak-toto/yak-server/branch/main/graph/badge.svg?token=EZZK5SY5BL)](https://codecov.io/gh/yak-toto/yak-server)
[![🔐 CodeQL](https://github.com/yak-toto/yak-server/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/yak-toto/yak-server/actions/workflows/codeql-analysis.yml)
[![Testing](https://github.com/yak-toto/yak-server/actions/workflows/test.yml/badge.svg)](https://github.com/yak-toto/yak-server/actions/workflows/test.yml)

## Requisites

- Ubuntu 22.04
- Postgres 17.2

## How to build the project

### Database

To setup a database, run `yak env init`. This will ask you to fill different configuration in order build env file.
Once done, you can run a docker script to start postgres database (at `scripts/postgresrun.sh`)

### Backend

Run your project in a Python env is highly recommend. You can use venv python module using the following command:

```bash
uv venv
. .venv/bin/activate
```

Fetch all packages using uv with the following command:

```bash
uv pip install -e .
```

Before starting the backend, add `JWT_SECRET_KEY` and `JWT_EXPIRATION_TIME` in `.env` same as the Postgres user name and password. As
login system is using JSON Web Token, a secret key is required and an expiration time (in seconds). To generate one, you can use the python built-in `secrets` module.

```py
>>> import secrets
>>> secrets.token_hex(16)
'9292f79e10ed7ed03ffad66d196217c4'
```

```text
JWT_SECRET_KEY=9292f79e10ed7ed03ffad66d196217c4
JWT_EXPIRATION_TIME=1800
```

Also, automatic backup can be done through `yak_server/cli/backup_database` script. It can be run using `yak db backup`.

Finally, fastapi needs some configuration to start. Last thing, for development environment, debug needs to be activated with a additional environment variable:

```text
DEBUG=1
```

And then start backend with:

```bash
uvicorn --reload yak_server:create_app --factory
```

### Data initialization

To run local testing, you can use the script `create_database.py`, `initialize_database.py` and `create_admin.py` located in `yak_server/cli` folder. To select, set `COMPETITION` environment variable in `.env`. It will read data from `yak_server/data/{COMPETITION}/`.

### Testing

Yak-server is using `pytest` to run tests.

## Profiling

You can run the application with profiler attached. To do so, please run the following command

```bash
uvicorn --reload scripts.profiling:create_app --factory
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yak-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "api, postgresql, rest",
    "author": null,
    "author_email": "Guillaume Le Pape <gui.lepape25@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0b/dd/5b25fc2c34e27bf5d5baebe04af6b983937919431af8e2a18abb4b9d822e/yak_server-0.57.1.tar.gz",
    "platform": null,
    "description": "# Yak-toto\n\n[![PyPI](https://img.shields.io/pypi/v/yak-server?label=stable)](https://pypi.org/project/yak-server/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/yak-server)](https://pypi.org/project/yak-server/)\n[![codecov](https://codecov.io/gh/yak-toto/yak-server/branch/main/graph/badge.svg?token=EZZK5SY5BL)](https://codecov.io/gh/yak-toto/yak-server)\n[![\ud83d\udd10 CodeQL](https://github.com/yak-toto/yak-server/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/yak-toto/yak-server/actions/workflows/codeql-analysis.yml)\n[![Testing](https://github.com/yak-toto/yak-server/actions/workflows/test.yml/badge.svg)](https://github.com/yak-toto/yak-server/actions/workflows/test.yml)\n\n## Requisites\n\n- Ubuntu 22.04\n- Postgres 17.2\n\n## How to build the project\n\n### Database\n\nTo setup a database, run `yak env init`. This will ask you to fill different configuration in order build env file.\nOnce done, you can run a docker script to start postgres database (at `scripts/postgresrun.sh`)\n\n### Backend\n\nRun your project in a Python env is highly recommend. You can use venv python module using the following command:\n\n```bash\nuv venv\n. .venv/bin/activate\n```\n\nFetch all packages using uv with the following command:\n\n```bash\nuv pip install -e .\n```\n\nBefore starting the backend, add `JWT_SECRET_KEY` and `JWT_EXPIRATION_TIME` in `.env` same as the Postgres user name and password. As\nlogin system is using JSON Web Token, a secret key is required and an expiration time (in seconds). To generate one, you can use the python built-in `secrets` module.\n\n```py\n>>> import secrets\n>>> secrets.token_hex(16)\n'9292f79e10ed7ed03ffad66d196217c4'\n```\n\n```text\nJWT_SECRET_KEY=9292f79e10ed7ed03ffad66d196217c4\nJWT_EXPIRATION_TIME=1800\n```\n\nAlso, automatic backup can be done through `yak_server/cli/backup_database` script. It can be run using `yak db backup`.\n\nFinally, fastapi needs some configuration to start. Last thing, for development environment, debug needs to be activated with a additional environment variable:\n\n```text\nDEBUG=1\n```\n\nAnd then start backend with:\n\n```bash\nuvicorn --reload yak_server:create_app --factory\n```\n\n### Data initialization\n\nTo run local testing, you can use the script `create_database.py`, `initialize_database.py` and `create_admin.py` located in `yak_server/cli` folder. To select, set `COMPETITION` environment variable in `.env`. It will read data from `yak_server/data/{COMPETITION}/`.\n\n### Testing\n\nYak-server is using `pytest` to run tests.\n\n## Profiling\n\nYou can run the application with profiler attached. To do so, please run the following command\n\n```bash\nuvicorn --reload scripts.profiling:create_app --factory\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Football bet rest server",
    "version": "0.57.1",
    "project_urls": {
        "Homepage": "https://github.com/yak-toto/yak-server",
        "Repository": "https://github.com/yak-toto/yak-server"
    },
    "split_keywords": [
        "api",
        " postgresql",
        " rest"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b6f2c548e6cbd1ba24a8bd1b6244b9eb826561e9bf441d19b6d19cc78f0498ef",
                "md5": "7b5839d82bd3d747ac6e5f5b95def9dd",
                "sha256": "837e8d189e908b177facf3f50b4a62f1fff6c946b073d3bd067a83530d5a9745"
            },
            "downloads": -1,
            "filename": "yak_server-0.57.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7b5839d82bd3d747ac6e5f5b95def9dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 77023,
            "upload_time": "2025-08-23T15:26:22",
            "upload_time_iso_8601": "2025-08-23T15:26:22.662915Z",
            "url": "https://files.pythonhosted.org/packages/b6/f2/c548e6cbd1ba24a8bd1b6244b9eb826561e9bf441d19b6d19cc78f0498ef/yak_server-0.57.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0bdd5b25fc2c34e27bf5d5baebe04af6b983937919431af8e2a18abb4b9d822e",
                "md5": "a458d8515989b4a1eb8f5e943bc54592",
                "sha256": "df3d08f076cac9b7a1ad3478790305bba656c5df5e871683b22deaa600d8d64c"
            },
            "downloads": -1,
            "filename": "yak_server-0.57.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a458d8515989b4a1eb8f5e943bc54592",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 190418,
            "upload_time": "2025-08-23T15:26:24",
            "upload_time_iso_8601": "2025-08-23T15:26:24.365002Z",
            "url": "https://files.pythonhosted.org/packages/0b/dd/5b25fc2c34e27bf5d5baebe04af6b983937919431af8e2a18abb4b9d822e/yak_server-0.57.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-23 15:26:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yak-toto",
    "github_project": "yak-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "yak-server"
}
        
Elapsed time: 1.46133s