Skip to main content

A local Pokemon data repository/Pokedex with fast offline access

Project description

LocalDex

A fast, offline-first Python library for Pokemon data access. LocalDex provides comprehensive Pokemon information without requiring network requests.

PyPI version Python versions License: MIT

Features

  • Offline Access: All data stored locally - no network requests required
  • Fast Lookups: Optimized caching and search capabilities
  • Comprehensive Data: Pokemon, moves, abilities, and items
  • CLI Interface: Command-line access to all data
  • Type Hints: Full type support for better development experience
  • Stat Calculations: Built-in stat calculation methods

Installation

pip install localdex

Quick Start

from localdex import LocalDex

# Initialize the dex
dex = LocalDex()

# Get Pokemon by name or ID
pikachu = dex.get_pokemon("pikachu")
charizard = dex.get_pokemon_by_id(6)

# Get moves and abilities
thunderbolt = dex.get_move("thunderbolt")
lightning_rod = dex.get_ability("lightning-rod")

# Search Pokemon
fire_types = dex.search_pokemon(type="fire")
fast_pokemon = dex.search_pokemon(min_speed=120)
legendary_fire = dex.search_pokemon(type="fire", is_legendary=True)

# Get all data
all_pokemon = dex.get_all_pokemon()
all_moves = dex.get_all_moves()

CLI Usage

# Get Pokemon information
localdex pokemon pikachu
localdex pokemon 25

# Search Pokemon
localdex search --type Fire --generation 1
localdex search --legendary --min-attack 100

# Get move and ability info
localdex move thunderbolt
localdex ability lightningrod

# List data
localdex list-pokemon --generation 1
localdex list-moves --type Electric

# Export data
localdex export --format json --output pokemon_data.json

# Run demo
localdex demo

API Reference

Core Methods

  • get_pokemon(name_or_id) - Get Pokemon by name or ID
  • get_pokemon_by_id(id) - Get Pokemon by ID
  • get_pokemon_by_name(name) - Get Pokemon by name
  • get_move(name) - Get move by name
  • get_ability(name) - Get ability by name
  • get_item(name) - Get item by name
  • search_pokemon(**filters) - Search Pokemon with filters
  • get_all_pokemon() - Get all Pokemon
  • get_all_moves() - Get all moves
  • get_all_abilities() - Get all abilities
  • get_all_items() - Get all items

Search Filters

# Available filters for search_pokemon()
dex.search_pokemon(
    type="Fire",              # Pokemon type
    generation=1,             # Generation number
    is_legendary=True,        # Legendary Pokemon
    is_mythical=True,         # Mythical Pokemon
    min_attack=100,           # Minimum attack stat
    max_speed=50,             # Maximum speed stat
    name_contains="char"      # Name contains text
)

Data Models

# Pokemon model
pokemon = dex.get_pokemon("pikachu")
print(f"{pokemon.name} - {pokemon.types}")
print(f"HP: {pokemon.base_stats.hp}")
print(f"Attack: {pokemon.base_stats.attack}")

# Move model
move = dex.get_move("thunderbolt")
print(f"{move.name} - Power: {move.base_power}, Type: {move.type}")

# Ability model
ability = dex.get_ability("lightning-rod")
print(f"{ability.name} - {ability.description}")

Stat Calculations

LocalDex includes methods for calculating Pokemon stats:

# Calculate stats with IVs, EVs, and level
hp = dex.get_hp_stat_from_species("pikachu", iv=31, ev=252, level=100)
attack = dex.get_attack_stat_from_species("pikachu", iv=31, ev=252, level=100)

# Generic stat calculation
hp = dex.calculate_hp(base=35, iv=31, ev=252, level=100)
attack = dex.calculate_other_stat(base=55, iv=31, ev=252, level=100, nature_modifier=1.1)

License

MIT License - see LICENSE file for details.

Data Sources

Data sourced from Pokemon Showdown and PokeAPI.

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

localdex-0.2.50.tar.gz (615.6 kB view details)

Uploaded Source

Built Distribution

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

localdex-0.2.50-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

Details for the file localdex-0.2.50.tar.gz.

File metadata

  • Download URL: localdex-0.2.50.tar.gz
  • Upload date:
  • Size: 615.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for localdex-0.2.50.tar.gz
Algorithm Hash digest
SHA256 5ba01001a7f28f6c8356cda3218a77a8c45a021ed6bb149b0cc68bb8e3a79932
MD5 b7894b32924d4f5d8044f8057d78ba34
BLAKE2b-256 59a3cf8b42007cf22f7ea2125b4f37fcac29f75c31c2c12be8e6952d53656e52

See more details on using hashes here.

File details

Details for the file localdex-0.2.50-py3-none-any.whl.

File metadata

  • Download URL: localdex-0.2.50-py3-none-any.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for localdex-0.2.50-py3-none-any.whl
Algorithm Hash digest
SHA256 0032544a222aedfad7a1dcfcf58c76b91bcfd58a7c42ffa4b47c9584f88a48b5
MD5 c5dcc099dfaf7a3937ec4587e1c9d006
BLAKE2b-256 b422887ab78df43f96e5df4aefba06d17e6f6d1f8ff1644d94b0f4721e572310

See more details on using hashes here.

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