localdex 0.1.8__py3-none-any.whl → 0.1.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- localdex/__init__.py +4 -11
- localdex/core.py +187 -2
- localdex/random_battles.py +251 -0
- localdex/sprite_downloader.py +932 -0
- {localdex-0.1.8.dist-info → localdex-0.1.19.dist-info}/METADATA +165 -7
- {localdex-0.1.8.dist-info → localdex-0.1.19.dist-info}/RECORD +9 -7
- {localdex-0.1.8.dist-info → localdex-0.1.19.dist-info}/WHEEL +0 -0
- {localdex-0.1.8.dist-info → localdex-0.1.19.dist-info}/entry_points.txt +0 -0
- {localdex-0.1.8.dist-info → localdex-0.1.19.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: localdex
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.19
|
4
4
|
Summary: A local Pokemon data repository/Pokedex with fast offline access
|
5
|
-
Home-page: https://github.com/yourusername/localdex
|
6
|
-
Author: LocalDex Team
|
7
5
|
Author-email: LocalDex Team <localdex@example.com>
|
8
6
|
License: MIT
|
9
7
|
Project-URL: Homepage, https://github.com/colefoster/localdex
|
@@ -48,9 +46,8 @@ Requires-Dist: black>=22.0.0; extra == "dev"
|
|
48
46
|
Requires-Dist: isort>=5.0.0; extra == "dev"
|
49
47
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
50
48
|
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
51
|
-
|
52
|
-
|
53
|
-
Dynamic: requires-python
|
49
|
+
Requires-Dist: pillow>=9.0.0; extra == "dev"
|
50
|
+
Requires-Dist: selenium>=4.0.0; extra == "dev"
|
54
51
|
|
55
52
|
# LocalDex
|
56
53
|
|
@@ -70,6 +67,7 @@ A fast, offline-first Python library for Pokemon data access. LocalDex provides
|
|
70
67
|
- **Type Hints**: Full type support for better development experience
|
71
68
|
- **Multiple Generations**: Support for all Pokemon generations
|
72
69
|
- **Competitive Data**: Includes battle sets and competitive information
|
70
|
+
- **Random Battle Sets**: Download and access Pokemon Showdown's random battle data
|
73
71
|
|
74
72
|
## Installation
|
75
73
|
|
@@ -144,7 +142,19 @@ all_moves = dex.get_all_moves()
|
|
144
142
|
electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
|
145
143
|
print(f"Electric moves count: {len(electric_moves)}")
|
146
144
|
print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
|
147
|
-
|
145
|
+
|
146
|
+
# Random Battle Sets (requires internet for initial download)
|
147
|
+
# Get random battle sets for a Pokemon
|
148
|
+
venusaur_sets = dex.get_random_battle_sets("venusaur", generation=9)
|
149
|
+
if venusaur_sets:
|
150
|
+
print(f"Venusaur Gen 9 Level: {venusaur_sets.get('level')}")
|
151
|
+
for set_data in venusaur_sets.get('sets', []):
|
152
|
+
print(f" Role: {set_data.get('role')}")
|
153
|
+
print(f" Moves: {', '.join(set_data.get('movepool', []))}")
|
154
|
+
|
155
|
+
# Search Pokemon by move in random battles
|
156
|
+
giga_drain_users = dex.search_random_battle_pokemon_by_move("Giga Drain", generation=9)
|
157
|
+
print(f"Pokemon with Giga Drain in Gen 9: {giga_drain_users[:5]}")
|
148
158
|
|
149
159
|
## API Reference
|
150
160
|
|
@@ -166,6 +176,15 @@ The main class for accessing Pokemon data.
|
|
166
176
|
- `get_all_abilities() -> List[Ability]`: Get all abilities
|
167
177
|
- `get_all_items() -> List[Item]`: Get all items
|
168
178
|
|
179
|
+
#### Random Battle Sets Methods
|
180
|
+
|
181
|
+
- `get_random_battle_sets(pokemon_name: str, generation: int = 9) -> Optional[Dict]`: Get random battle sets for a Pokemon
|
182
|
+
- `get_all_random_battle_sets(generation: int = 9) -> Dict`: Get all random battle sets for a generation
|
183
|
+
- `search_random_battle_pokemon_by_move(move_name: str, generation: int = 9) -> List[str]`: Search Pokemon by move in random battles
|
184
|
+
- `search_random_battle_pokemon_by_ability(ability_name: str, generation: int = 9) -> List[str]`: Search Pokemon by ability in random battles
|
185
|
+
- `get_available_random_battle_generations() -> List[int]`: Get available generations for random battles
|
186
|
+
- `get_random_battle_formats(generation: int) -> List[str]`: Get available formats for a generation
|
187
|
+
|
169
188
|
#### Search Filters
|
170
189
|
|
171
190
|
```python
|
@@ -243,6 +262,89 @@ LocalDex organizes data into logical sets that can be installed independently:
|
|
243
262
|
- **Items** (`items`): Item data and effects
|
244
263
|
- **Abilities** (`abilities`): Detailed ability information
|
245
264
|
|
265
|
+
## Random Battle Sets
|
266
|
+
|
267
|
+
LocalDex can download and access Pokemon Showdown's random battle sets from different generations. This feature requires an internet connection for the initial download, but then works offline.
|
268
|
+
|
269
|
+
### Features
|
270
|
+
|
271
|
+
- **Multiple Generations**: Support for Gen 8 and Gen 9 random battles
|
272
|
+
- **Multiple Formats**: Standard sets, factory sets, doubles sets, and more
|
273
|
+
- **Search Capabilities**: Find Pokemon by moves or abilities in their random battle sets
|
274
|
+
- **Caching**: Downloaded data is cached for offline use
|
275
|
+
- **Optional**: Can be disabled to save memory and avoid downloads
|
276
|
+
|
277
|
+
### Usage
|
278
|
+
|
279
|
+
```python
|
280
|
+
from localdex import LocalDex
|
281
|
+
|
282
|
+
# Initialize with random battles enabled (default)
|
283
|
+
dex = LocalDex(enable_random_battles=True)
|
284
|
+
|
285
|
+
# Get random battle sets for a specific Pokemon
|
286
|
+
venusaur_sets = dex.get_random_battle_sets("venusaur", generation=9)
|
287
|
+
if venusaur_sets:
|
288
|
+
print(f"Level: {venusaur_sets['level']}")
|
289
|
+
for set_data in venusaur_sets['sets']:
|
290
|
+
print(f"Role: {set_data['role']}")
|
291
|
+
print(f"Moves: {', '.join(set_data['movepool'])}")
|
292
|
+
print(f"Abilities: {', '.join(set_data['abilities'])}")
|
293
|
+
print(f"Tera Types: {', '.join(set_data['teraTypes'])}")
|
294
|
+
|
295
|
+
# Search for Pokemon with specific moves
|
296
|
+
giga_drain_users = dex.search_random_battle_pokemon_by_move("Giga Drain", generation=9)
|
297
|
+
print(f"Pokemon with Giga Drain: {giga_drain_users}")
|
298
|
+
|
299
|
+
# Search for Pokemon with specific abilities
|
300
|
+
chlorophyll_users = dex.search_random_battle_pokemon_by_ability("Chlorophyll", generation=9)
|
301
|
+
print(f"Pokemon with Chlorophyll: {chlorophyll_users}")
|
302
|
+
|
303
|
+
# Get all random battle sets for a generation
|
304
|
+
all_gen9_sets = dex.get_all_random_battle_sets(generation=9)
|
305
|
+
print(f"Total Pokemon in Gen 9: {len(all_gen9_sets)}")
|
306
|
+
|
307
|
+
# Get available generations and formats
|
308
|
+
generations = dex.get_available_random_battle_generations()
|
309
|
+
formats = dex.get_random_battle_formats(9)
|
310
|
+
print(f"Available generations: {generations}")
|
311
|
+
print(f"Gen 9 formats: {formats}")
|
312
|
+
|
313
|
+
# Disable random battles to save memory
|
314
|
+
dex_lightweight = LocalDex(enable_random_battles=False)
|
315
|
+
```
|
316
|
+
|
317
|
+
### Data Structure
|
318
|
+
|
319
|
+
#### Generation 9 Sets
|
320
|
+
```json
|
321
|
+
{
|
322
|
+
"venusaur": {
|
323
|
+
"level": 84,
|
324
|
+
"sets": [
|
325
|
+
{
|
326
|
+
"role": "Bulky Support",
|
327
|
+
"movepool": ["Giga Drain", "Leech Seed", "Sleep Powder"],
|
328
|
+
"abilities": ["Chlorophyll", "Overgrow"],
|
329
|
+
"teraTypes": ["Steel", "Water"]
|
330
|
+
}
|
331
|
+
]
|
332
|
+
}
|
333
|
+
}
|
334
|
+
```
|
335
|
+
|
336
|
+
#### Generation 8 Data
|
337
|
+
```json
|
338
|
+
{
|
339
|
+
"venusaur": {
|
340
|
+
"level": 84,
|
341
|
+
"moves": ["gigadrain", "leechseed", "sleeppowder"],
|
342
|
+
"doublesMoves": ["earthpower", "energyball", "leechseed"],
|
343
|
+
"doublesLevel": 80
|
344
|
+
}
|
345
|
+
}
|
346
|
+
```
|
347
|
+
|
246
348
|
## CLI Usage
|
247
349
|
|
248
350
|
LocalDex includes a command-line interface for quick data access:
|
@@ -277,4 +379,60 @@ LocalDex uses data from:
|
|
277
379
|
- [Pokemon Showdown](https://github.com/smogon/pokemon-showdown)
|
278
380
|
- [PokeAPI](https://pokeapi.co/) (for initial data collection)
|
279
381
|
|
382
|
+
## Sprite Downloading and Usage
|
383
|
+
|
384
|
+
LocalDex can download and manage Pokémon and item sprites directly from Pokémon Showdown. This feature allows you to access local sprite images for use in your applications. The sprite extraction process uses parallel processing for significantly improved performance.
|
385
|
+
|
386
|
+
### Downloading Sprites
|
387
|
+
|
388
|
+
```python
|
389
|
+
from localdex import LocalDex
|
390
|
+
|
391
|
+
# Initialize with default parallel processing (8 workers)
|
392
|
+
dex = LocalDex()
|
393
|
+
|
394
|
+
# Download and extract all Pokémon and item sprites (requires internet for first run)
|
395
|
+
dex.download_all_sprites()
|
396
|
+
|
397
|
+
# Or customize the number of worker threads for parallel processing
|
398
|
+
dex_fast = LocalDex(sprite_max_workers=16) # More workers for faster processing
|
399
|
+
dex_lightweight = LocalDex(sprite_max_workers=4) # Fewer workers for lower resource usage
|
400
|
+
```
|
401
|
+
|
402
|
+
### Accessing Sprite Paths
|
403
|
+
|
404
|
+
```python
|
405
|
+
# Get the local file path to a Pokémon sprite
|
406
|
+
sprite_path = dex.get_pokemon_sprite_path("Pikachu")
|
407
|
+
print(sprite_path) # e.g., /path/to/data/sprites/pokemon/pikachu.png
|
408
|
+
|
409
|
+
# Get the local file path to an item sprite
|
410
|
+
item_sprite_path = dex.get_item_sprite_path("Leftovers")
|
411
|
+
print(item_sprite_path) # e.g., /path/to/data/sprites/items/leftovers.png
|
412
|
+
```
|
413
|
+
|
414
|
+
### Listing Available Sprites
|
415
|
+
|
416
|
+
```python
|
417
|
+
# List all available Pokémon sprites
|
418
|
+
pokemon_sprites = dex.list_available_sprites("pokemon")
|
419
|
+
print(pokemon_sprites)
|
420
|
+
|
421
|
+
# List all available item sprites
|
422
|
+
item_sprites = dex.list_available_sprites("items")
|
423
|
+
print(item_sprites)
|
424
|
+
```
|
425
|
+
|
426
|
+
### Accessing Sprite Metadata
|
427
|
+
|
428
|
+
```python
|
429
|
+
# Get metadata for all Pokémon sprites
|
430
|
+
pokemon_meta = dex.get_sprite_metadata("pokemon")
|
431
|
+
print(pokemon_meta["Pikachu"])
|
432
|
+
|
433
|
+
# Get metadata for all item sprites
|
434
|
+
item_meta = dex.get_sprite_metadata("items")
|
435
|
+
print(item_meta["Leftovers"])
|
436
|
+
```
|
437
|
+
|
280
438
|
|
@@ -1,9 +1,11 @@
|
|
1
|
-
localdex/__init__.py,sha256=
|
1
|
+
localdex/__init__.py,sha256=hrXzDvHAGSDUNhnajIGpxEbeMrO1sy9AiAuqs15muTs,544
|
2
2
|
localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
|
3
|
-
localdex/core.py,sha256=
|
3
|
+
localdex/core.py,sha256=I8LwvKxtmEgdYtdEBVQLLp3JwafM8FhmvMrMpgxXkvA,28792
|
4
4
|
localdex/data_loader.py,sha256=hi9aSTto5Ti-OBGOgrQ-XwD5hmivsUwS1uC4rulhwQI,11366
|
5
5
|
localdex/download_data.py,sha256=ibAHDxL60sV4LVN9isCmf8vvd_aI9IQbyjJpU0FHGUo,18869
|
6
6
|
localdex/exceptions.py,sha256=Z02-8Kci6jFDk2nnGdVSHZJMDDWE9vuwuASs4VM3To8,2777
|
7
|
+
localdex/random_battles.py,sha256=xRGQ6v-g9NG1-4jcQJWHOfskNUv-tFXspCXPRdctdmQ,9213
|
8
|
+
localdex/sprite_downloader.py,sha256=q4ropKb6vCZmAHbetIXLOzcdbk50oa53Vv_WiiXbOk8,41379
|
7
9
|
localdex/data/abilities/adaptability.json,sha256=FGEEZmL80YVcIXHV-h287Wu-UJycM1QEJxiOHK2I4mY,289
|
8
10
|
localdex/data/abilities/aerilate.json,sha256=KRZOVH2KGdEQ_3UktFoXoagUOaC8jIPZ6Ti-YGzW44s,301
|
9
11
|
localdex/data/abilities/aftermath.json,sha256=Awv_8jquu3pM4CemD5ylS1v83ABrqGtrgMEkL-1ldBk,285
|
@@ -4790,8 +4792,8 @@ localdex/models/ability.py,sha256=AQzv3XUHHl4sustMJjPDDjJOjXu2GMLTfcM3-tqQ_1w,30
|
|
4790
4792
|
localdex/models/item.py,sha256=zXao8F-jBPUGq_YLeGeYeK_dZVI7aZMXtWOPwR3qusY,4677
|
4791
4793
|
localdex/models/move.py,sha256=hfgcWI4ziz5MMvc9ddmkotxzYYdrSUqZZQ72IU5tucs,7629
|
4792
4794
|
localdex/models/pokemon.py,sha256=v5zkxY1NGGR-MczFCZe9fHt6u_BAqAjMiQZlpcLXVGc,5408
|
4793
|
-
localdex-0.1.
|
4794
|
-
localdex-0.1.
|
4795
|
-
localdex-0.1.
|
4796
|
-
localdex-0.1.
|
4797
|
-
localdex-0.1.
|
4795
|
+
localdex-0.1.19.dist-info/METADATA,sha256=LfwrdPZ8k5DZAg7in5j7CSnMFOre8rivO1koAlar1qA,14087
|
4796
|
+
localdex-0.1.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4797
|
+
localdex-0.1.19.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
|
4798
|
+
localdex-0.1.19.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
|
4799
|
+
localdex-0.1.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|