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

Uploaded Python 3

File details

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

File metadata

  • Download URL: footysim_core-0.1.8.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.8.tar.gz
Algorithm Hash digest
SHA256 62cefb367334c66ddc0cbaa1883a372065c0c762567b6b03150209a5efc4cb38
MD5 274f8db7cf83155630096002b3b78496
BLAKE2b-256 135704ee1ed7afd4d9d81b825483b83e9aa5b284a505455ec82cc3327fbb5790

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: footysim_core-0.1.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ef6711ab4187bdef95d10b93ea2e4baa62e7fd84afdeddf298a99c2997e4d88c
MD5 7e72b708e2a05e2829c3f96deceb25a2
BLAKE2b-256 6df7b820cece57678d789e15126bf39a6ed76ab82011d9e41bcdc63f6060798f

See more details on using hashes here.

Provenance

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