Skip to content

one-zero-eight/sports

Repository files navigation

InnoSport API

About

This is API for proxying requests in InnoSport website. It checks Accounts user token and make request to InnoSport API on behave of the user.

Technologies

Development

Getting started

  1. Install Python 3.12+

  2. Install Poetry

  3. Install project dependencies with Poetry.

    poetry install
  4. Set up pre-commit hooks:

    poetry run pre-commit install --install-hooks -t pre-commit -t commit-msg
  5. Set up project settings file (check settings.schema.yaml for more info).

    cp settings.example.yaml settings.yaml

    Edit settings.yaml according to your needs.

Set up PyCharm integrations

  1. Ruff (plugin). It will lint and format your code. Make sure to enable Use ruff format option in plugin settings.
  2. Pydantic (plugin). It will fix PyCharm issues with type-hinting.
  3. Conventional commits (plugin). It will help you to write conventional commits.

Run for development

Run the ASGI server

poetry run python -m src.api

OR using uvicorn directly

poetry run uvicorn src.api.app:app --use-colors --proxy-headers --forwarded-allow-ips=*

Now the API is running on http://localhost:8000. Good job!

Deployment

We use Docker with Docker Compose plugin to run the service on servers.

  1. Copy the file with environment variables: cp .example.env .env
  2. Change environment variables in the .env file
  3. Copy the file with settings: cp settings.example.yaml settings.yaml
  4. Change settings in the settings.yaml file according to your needs (check settings.schema.yaml for more info)
  5. Install Docker with Docker Compose
  6. Build a Docker image: docker compose build --pull
  7. Run the container: docker compose up --detach
  8. Check the logs: docker compose logs -f

How to update dependencies

Project dependencies

  1. Run poetry update to update all dependencies (it may update nothing, so double-check)
  2. Run poetry show --outdated --all to check for outdated dependencies
  3. Run poetry add <package>@latest to add a new dependency if needed

Pre-commit hooks

  1. Run poetry run pre-commit autoupdate

Also, Dependabot will help you to keep your dependencies up-to-date, see dependabot.yml.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages