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.18.tar.gz (19.0 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.18-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: footysim_core-0.1.18.tar.gz
  • Upload date:
  • Size: 19.0 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.18.tar.gz
Algorithm Hash digest
SHA256 2e3fe410e6d5b64c42f057f73adad699b62abd977bc453070bfe9348f075c821
MD5 9cecc5cf496a886dc1c8e59fe8715e86
BLAKE2b-256 11b35465aec00cde4ba171d237121e45b7c4940d3819ff28a9933c45c8b1063b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: footysim_core-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 24.8 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.18-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae36b984f4578d591683ba29fc8ef5d5581c4eb730b2bb59ee929e8e868844b
MD5 4c22a69e0ec380f4420612d805ac02fe
BLAKE2b-256 c30cf56108d407a1108040c871b019af57f229270fc8f6b66226be82c2587a08

See more details on using hashes here.

Provenance

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