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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file footysim_core-0.1.12.tar.gz.
File metadata
- Download URL: footysim_core-0.1.12.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9ede797c3e3ae69bcfd166605b61d65588aaab8b5d7e5662a9cee5c3c8d1e7
|
|
| MD5 |
936c3504f9e6e0f28d2beccccc4c7a62
|
|
| BLAKE2b-256 |
49971395de4d63054a9e2dfd589d02f4771f18ccffbad90ae05e7bf3255dc6d9
|
Provenance
The following attestation bundles were made for footysim_core-0.1.12.tar.gz:
Publisher:
publish.yml on louisbertrand22/FootySim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
footysim_core-0.1.12.tar.gz -
Subject digest:
4b9ede797c3e3ae69bcfd166605b61d65588aaab8b5d7e5662a9cee5c3c8d1e7 - Sigstore transparency entry: 541335368
- Sigstore integration time:
-
Permalink:
louisbertrand22/FootySim@135ec86cd9c38ca69ce0079a4d3c48405c212f91 -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/louisbertrand22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@135ec86cd9c38ca69ce0079a4d3c48405c212f91 -
Trigger Event:
push
-
Statement type:
File details
Details for the file footysim_core-0.1.12-py3-none-any.whl.
File metadata
- Download URL: footysim_core-0.1.12-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2f1403dd53d326070f96e591f9594cb0733038a664a770c7365651ba52e8905
|
|
| MD5 |
1ea492c4693da1f8883ed5b3cfeb1373
|
|
| BLAKE2b-256 |
ec1adbc1f75dd6f19e13f5c4ddfcced603feb81bd444be416ade18c29b5a1298
|
Provenance
The following attestation bundles were made for footysim_core-0.1.12-py3-none-any.whl:
Publisher:
publish.yml on louisbertrand22/FootySim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
footysim_core-0.1.12-py3-none-any.whl -
Subject digest:
f2f1403dd53d326070f96e591f9594cb0733038a664a770c7365651ba52e8905 - Sigstore transparency entry: 541335375
- Sigstore integration time:
-
Permalink:
louisbertrand22/FootySim@135ec86cd9c38ca69ce0079a4d3c48405c212f91 -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/louisbertrand22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@135ec86cd9c38ca69ce0079a4d3c48405c212f91 -
Trigger Event:
push
-
Statement type: