Skip to main content

FootySim Core — async SQLAlchemy models, services & CLI for football simulations

Project description

⚽ FootySim — Simulation de championnat de football

FootySim est un projet Python utilisant SQLAlchemy (async) et Alembic pour simuler un championnat de football avec :

  • Clubs, joueurs, transferts
  • Fixtures (calendrier), matchs simulés, buteurs
  • Classement dynamique
  • CLI (Typer) pour jouer avec la base de données

Idéal pour apprendre SQLAlchemy avec un projet complet et fun 🎮.


🚀 Installation

1. Cloner le projet

git clone https://github.com/ton-compte/FootySim.git
cd FootySim

2. Créer et activer un venv

python -m venv .venv
source .venv/bin/activate   # Linux/Mac
.venv\Scripts\activate      # Windows

3. Installer les dépendances

pip install -r requirements.txt

4. Configurer la base de données

Renommer .env.example.env et modifier :

DATABASE_URL=sqlite+aiosqlite:///footysim.db
# ou avec MySQL :
# DATABASE_URL=mysql+aiomysql://root:password@localhost:3306/footysim

5. Initialiser la base

python -m footysim.cli initdb

6. Injecter des données de départ

python -m footysim.cli seed

🎮 Utilisation

Toutes les commandes passent par le CLI :

python -m footysim.cli [COMMANDE] [OPTIONS]

📅 Calendrier (fixtures)

Générer les journées :

python -m footysim.cli schedule

Lister les matchs programmés :

python -m footysim.cli fixtures 1   # 1 = season_id

⚽ Simulation de matchs

Simuler un seul match :

python -m footysim.cli simulate 3   # fixture_id = 3

Simuler toute la saison :

python -m footysim.cli simulate-season 1

Resimuler en réinitialisant les résultats :

python -m footysim.cli simulate-season 1 --reset

📊 Classement

Afficher la table actuelle :

python -m footysim.cli table 1

🏆 Meilleurs buteurs

Afficher les top scorers de la saison :

python -m footysim.cli topscorers 1

✅ Tests

Lancer la suite de tests unitaires :

pytest -v

📂 Structure du projet

src/footysim/
│── models/          # ORM SQLAlchemy (Club, Player, Fixture, Match, Goal, Transfer…)
│── services/        # Logique métier (schedule, match_engine, table_service…)
│── repositories/    # Accès DB
│── seeds/           # Données de départ
│── cli.py           # CLI Typer
│── core/            # config, logging, exceptions
alembic/             # migrations DB
tests/               # tests unitaires

🛠️ Roadmap (idées futures)

  • 🔄 Mode "sauvegarde/chargement" de saison
  • 💰 Gestion du mercato (budget, transferts)
  • 🤕 Gestion blessures & suspensions
  • 🏟️ Statistiques avancées (possession, tirs, etc.)
  • 🌐 API FastAPI pour exposer les résultats

📜 Licence

Projet pédagogique — librement réutilisable et modifiable.

Project details


Download files

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

Source Distribution

footysim_core-0.1.15.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

footysim_core-0.1.15-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file footysim_core-0.1.15.tar.gz.

File metadata

  • Download URL: footysim_core-0.1.15.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for footysim_core-0.1.15.tar.gz
Algorithm Hash digest
SHA256 0f9c6396fd19f836e36f776dc3b9934384571568bd7930c2788042165117602c
MD5 f87b2c11f1d23f66691587ea1b1f639d
BLAKE2b-256 d480d602afc052349553a5692a44a195b110d8ea0656fe20a543921c7caa0263

See more details on using hashes here.

Provenance

The following attestation bundles were made for footysim_core-0.1.15.tar.gz:

Publisher: publish.yml on louisbertrand22/FootySim

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

File details

Details for the file footysim_core-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: footysim_core-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for footysim_core-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 9e6929592d6c0c9b58c1395feba25aabc869e90dc605b9e76a07011868c920bc
MD5 60ab70ffc6570aca73dd72282b8be76b
BLAKE2b-256 eda9166476d3fcb52cc18320cf1e09c39ee87ae43f5b304ff34dd13aff7a83d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for footysim_core-0.1.15-py3-none-any.whl:

Publisher: publish.yml on louisbertrand22/FootySim

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