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.1.0.tar.gz (235.7 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.1.0-py3-none-any.whl (81.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: empire_core-0.1.0.tar.gz
  • Upload date:
  • Size: 235.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 fd69698084f0b3acaf85123c7614ccd446756d6ee9a58fe3667cedc254ef0b90
MD5 1f32b9fa096fb67c56792466d7edee93
BLAKE2b-256 3efda9a81310b2bb6ee70c6f0ad3bf7e91d5ca7964b80e7a423b9155c7862f45

See more details on using hashes here.

Provenance

The following attestation bundles were made for empire_core-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: empire_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 81.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 114e11e6f01b01a9baaa4bbb01a7fc7aa95024b7bffc45ec4f23f56d0cbb7788
MD5 f1eb57a69c8f3824b418b2b0c67f0723
BLAKE2b-256 69210fcb0299c83645b51665afb3d7f18b085c298aca869e9eea362a0063a5c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for empire_core-0.1.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