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.16.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.16-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: footysim_core-0.1.16.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.16.tar.gz
Algorithm Hash digest
SHA256 65d7306c51fa8f988e37b414fa2392a168bf84fa268815495b558a9e8de33a6c
MD5 23484e5d0e827e91dd8115e155eadbf1
BLAKE2b-256 6dff9a9a8bfe6d418c751f9e051da70ecb6debf3be36012666875dde73b0a730

See more details on using hashes here.

Provenance

The following attestation bundles were made for footysim_core-0.1.16.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.16-py3-none-any.whl.

File metadata

  • Download URL: footysim_core-0.1.16-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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 68f6a9a3032fca1e86e1358ece01f9cc0a64498db886e65c5e1f6ed0e1a0ff3f
MD5 062d42c0c50ca654ce417d248b5b09b4
BLAKE2b-256 bb633c54cc0958ad713b02cac93ac186c01f2fc84d7fc1bce59ae0d24034868b

See more details on using hashes here.

Provenance

The following attestation bundles were made for footysim_core-0.1.16-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