Skip to main content

Football bet rest server

Project description

Yak-toto

PyPI Docker Image Python Versions codecov 🔐 CodeQL Testing

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:

uv venv
. .venv/bin/activate

Fetch all packages using uv with the following command:

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.

>>> import secrets
>>> secrets.token_hex(16)
'9292f79e10ed7ed03ffad66d196217c4'
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:

DEBUG=1

And then start backend with:

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

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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yak_server-0.89.0.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yak_server-0.89.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file yak_server-0.89.0.tar.gz.

File metadata

  • Download URL: yak_server-0.89.0.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for yak_server-0.89.0.tar.gz
Algorithm Hash digest
SHA256 48d0d01fc1a04701ce8bc9556180ebd67f274bbf4eac38afe4d9dd683e0e6937
MD5 96e42a45a6de96b90d013716a1c97c4c
BLAKE2b-256 e92805cd1628a13f2ba9987aaf2327c750b788f1404c204d31c07f2fcdbe0cf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for yak_server-0.89.0.tar.gz:

Publisher: release.yml on yak-toto/yak-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yak_server-0.89.0-py3-none-any.whl.

File metadata

  • Download URL: yak_server-0.89.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for yak_server-0.89.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a9c69c992bc48beddbd79cb8da6bbbb6f17353f1f9f32d4d43cb845973d358b
MD5 d2d0fad094c85f8cfa4623872f43cb9d
BLAKE2b-256 e958a36e5de5cf79079799e5aef31fcc419828e9ecd9ffdbeecc47c75a754e0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for yak_server-0.89.0-py3-none-any.whl:

Publisher: release.yml on yak-toto/yak-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page