Skip to main content

Asynchronous Python framework for Goodgame Empire

Project description

Python 3.10+ Asyncio Pydantic v2 UV Work in Progress

EmpireCore

Modern async Python library for Goodgame Empire automation

FeaturesInstallationQuick StartExamplesDocumentation


⚠️ Work in Progress

This library is under active development. APIs may change, and some features are incomplete or untested. Use at your own risk.


Features

Category Capabilities
Connection WebSocket, auto-reconnect, login cooldown handling
State Tracking Player, castles, resources, buildings, units, movements
Actions Attacks, transports, recruiting, building, with response validation
Automation Task loops, multi-account, target finder, map scanner
CLI Account status, login testing, state summary

Installation

This project uses uv for blazing-fast dependency management.

git clone https://github.com/eschnitzler/EmpireCore.git
cd EmpireCore

# Install dependencies and create venv automatically
uv sync

Traditional Installation (Pip)

python3 -m venv .venv
source .venv/bin/activate
pip install .

Configuration

Create an accounts.json file in the root directory. You can use the provided template:

cp accounts.json.template accounts.json

Then edit accounts.json with your credentials. This file is git-ignored to keep your credentials safe.

Quick Start

import asyncio
from empire_core import accounts

async def main():
    # Load default account from accounts.json
    account = accounts.get_default()
    if not account:
        print("Please configure accounts.json first!")
        return

    # Create client directly from account object
    client = account.get_client()
    
    await client.login()
    await client.get_detailed_castle_info()
    
    player = client.state.local_player
    print(f"{player.name} | Level {player.level} | {player.gold} gold")
    
    await client.close()

asyncio.run(main())

CLI Tool

The library includes a CLI for quick operations:

# Check configured accounts
uv run empire status

# Test login and show player stats
uv run empire login

Running Examples & Tests

# Run the demo
uv run examples/demo.py

# Run unit tests
uv run pytest

Development

We use ruff for linting and mypy for type checking.

# Setup pre-commit hooks
uv run pre-commit install

# Run all checks manually
uv run pre-commit run --all-files

For educational purposes only. Use responsibly.

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

empire_core-0.2.0.tar.gz (236.6 kB view details)

Uploaded Source

Built Distribution

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

empire_core-0.2.0-py3-none-any.whl (81.9 kB view details)

Uploaded Python 3

File details

Details for the file empire_core-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for empire_core-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0fb3701441314b92e7bd585137264fe6ace2e21ea1a10db9bc24959e441beee
MD5 391d50f7973844c6ef469357217df83b
BLAKE2b-256 6f4ff9235f1ff8de6e0702ad538c0786ee6cc64e942c9ace13a2a7796d076b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for empire_core-0.2.0.tar.gz:

Publisher: publish.yml on eschnitzler/EmpireCore

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

File details

Details for the file empire_core-0.2.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for empire_core-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0af0d5404f3017f8c71d11095ed4a4febc2c90dde20afcc3caab895153f19ac1
MD5 cc303f2686cc19813d4fb96ea2745eb4
BLAKE2b-256 56eb7ea2e8e657b91585228b611d257539adf4bfe7fb9e2e8a530c4b7a67d1c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for empire_core-0.2.0-py3-none-any.whl:

Publisher: publish.yml on eschnitzler/EmpireCore

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