localdex 0.1.8__py3-none-any.whl → 0.1.20__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.
@@ -1,9 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: localdex
3
- Version: 0.1.8
3
+ Version: 0.1.20
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
@@ -24,6 +22,7 @@ Requires-Python: >=3.8
24
22
  Description-Content-Type: text/markdown
25
23
  Requires-Dist: requests
26
24
  Requires-Dist: typing-extensions
25
+ Requires-Dist: pillow
27
26
  Provides-Extra: core
28
27
  Provides-Extra: gen1
29
28
  Provides-Extra: gen2
@@ -48,9 +47,8 @@ Requires-Dist: black>=22.0.0; extra == "dev"
48
47
  Requires-Dist: isort>=5.0.0; extra == "dev"
49
48
  Requires-Dist: mypy>=1.0.0; extra == "dev"
50
49
  Requires-Dist: flake8>=5.0.0; extra == "dev"
51
- Dynamic: author
52
- Dynamic: home-page
53
- Dynamic: requires-python
50
+ Requires-Dist: pillow>=9.0.0; extra == "dev"
51
+ Requires-Dist: selenium>=4.0.0; extra == "dev"
54
52
 
55
53
  # LocalDex
56
54
 
@@ -70,6 +68,7 @@ A fast, offline-first Python library for Pokemon data access. LocalDex provides
70
68
  - **Type Hints**: Full type support for better development experience
71
69
  - **Multiple Generations**: Support for all Pokemon generations
72
70
  - **Competitive Data**: Includes battle sets and competitive information
71
+ - **Random Battle Sets**: Download and access Pokemon Showdown's random battle data
73
72
 
74
73
  ## Installation
75
74
 
@@ -144,7 +143,19 @@ all_moves = dex.get_all_moves()
144
143
  electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
145
144
  print(f"Electric moves count: {len(electric_moves)}")
146
145
  print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
147
- ```
146
+
147
+ # Random Battle Sets (requires internet for initial download)
148
+ # Get random battle sets for a Pokemon
149
+ venusaur_sets = dex.get_random_battle_sets("venusaur", generation=9)
150
+ if venusaur_sets:
151
+ print(f"Venusaur Gen 9 Level: {venusaur_sets.get('level')}")
152
+ for set_data in venusaur_sets.get('sets', []):
153
+ print(f" Role: {set_data.get('role')}")
154
+ print(f" Moves: {', '.join(set_data.get('movepool', []))}")
155
+
156
+ # Search Pokemon by move in random battles
157
+ giga_drain_users = dex.search_random_battle_pokemon_by_move("Giga Drain", generation=9)
158
+ print(f"Pokemon with Giga Drain in Gen 9: {giga_drain_users[:5]}")
148
159
 
149
160
  ## API Reference
150
161
 
@@ -166,6 +177,15 @@ The main class for accessing Pokemon data.
166
177
  - `get_all_abilities() -> List[Ability]`: Get all abilities
167
178
  - `get_all_items() -> List[Item]`: Get all items
168
179
 
180
+ #### Random Battle Sets Methods
181
+
182
+ - `get_random_battle_sets(pokemon_name: str, generation: int = 9) -> Optional[Dict]`: Get random battle sets for a Pokemon
183
+ - `get_all_random_battle_sets(generation: int = 9) -> Dict`: Get all random battle sets for a generation
184
+ - `search_random_battle_pokemon_by_move(move_name: str, generation: int = 9) -> List[str]`: Search Pokemon by move in random battles
185
+ - `search_random_battle_pokemon_by_ability(ability_name: str, generation: int = 9) -> List[str]`: Search Pokemon by ability in random battles
186
+ - `get_available_random_battle_generations() -> List[int]`: Get available generations for random battles
187
+ - `get_random_battle_formats(generation: int) -> List[str]`: Get available formats for a generation
188
+
169
189
  #### Search Filters
170
190
 
171
191
  ```python
@@ -243,6 +263,89 @@ LocalDex organizes data into logical sets that can be installed independently:
243
263
  - **Items** (`items`): Item data and effects
244
264
  - **Abilities** (`abilities`): Detailed ability information
245
265
 
266
+ ## Random Battle Sets
267
+
268
+ 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.
269
+
270
+ ### Features
271
+
272
+ - **Multiple Generations**: Support for Gen 8 and Gen 9 random battles
273
+ - **Multiple Formats**: Standard sets, factory sets, doubles sets, and more
274
+ - **Search Capabilities**: Find Pokemon by moves or abilities in their random battle sets
275
+ - **Caching**: Downloaded data is cached for offline use
276
+ - **Optional**: Can be disabled to save memory and avoid downloads
277
+
278
+ ### Usage
279
+
280
+ ```python
281
+ from localdex import LocalDex
282
+
283
+ # Initialize with random battles enabled (default)
284
+ dex = LocalDex(enable_random_battles=True)
285
+
286
+ # Get random battle sets for a specific Pokemon
287
+ venusaur_sets = dex.get_random_battle_sets("venusaur", generation=9)
288
+ if venusaur_sets:
289
+ print(f"Level: {venusaur_sets['level']}")
290
+ for set_data in venusaur_sets['sets']:
291
+ print(f"Role: {set_data['role']}")
292
+ print(f"Moves: {', '.join(set_data['movepool'])}")
293
+ print(f"Abilities: {', '.join(set_data['abilities'])}")
294
+ print(f"Tera Types: {', '.join(set_data['teraTypes'])}")
295
+
296
+ # Search for Pokemon with specific moves
297
+ giga_drain_users = dex.search_random_battle_pokemon_by_move("Giga Drain", generation=9)
298
+ print(f"Pokemon with Giga Drain: {giga_drain_users}")
299
+
300
+ # Search for Pokemon with specific abilities
301
+ chlorophyll_users = dex.search_random_battle_pokemon_by_ability("Chlorophyll", generation=9)
302
+ print(f"Pokemon with Chlorophyll: {chlorophyll_users}")
303
+
304
+ # Get all random battle sets for a generation
305
+ all_gen9_sets = dex.get_all_random_battle_sets(generation=9)
306
+ print(f"Total Pokemon in Gen 9: {len(all_gen9_sets)}")
307
+
308
+ # Get available generations and formats
309
+ generations = dex.get_available_random_battle_generations()
310
+ formats = dex.get_random_battle_formats(9)
311
+ print(f"Available generations: {generations}")
312
+ print(f"Gen 9 formats: {formats}")
313
+
314
+ # Disable random battles to save memory
315
+ dex_lightweight = LocalDex(enable_random_battles=False)
316
+ ```
317
+
318
+ ### Data Structure
319
+
320
+ #### Generation 9 Sets
321
+ ```json
322
+ {
323
+ "venusaur": {
324
+ "level": 84,
325
+ "sets": [
326
+ {
327
+ "role": "Bulky Support",
328
+ "movepool": ["Giga Drain", "Leech Seed", "Sleep Powder"],
329
+ "abilities": ["Chlorophyll", "Overgrow"],
330
+ "teraTypes": ["Steel", "Water"]
331
+ }
332
+ ]
333
+ }
334
+ }
335
+ ```
336
+
337
+ #### Generation 8 Data
338
+ ```json
339
+ {
340
+ "venusaur": {
341
+ "level": 84,
342
+ "moves": ["gigadrain", "leechseed", "sleeppowder"],
343
+ "doublesMoves": ["earthpower", "energyball", "leechseed"],
344
+ "doublesLevel": 80
345
+ }
346
+ }
347
+ ```
348
+
246
349
  ## CLI Usage
247
350
 
248
351
  LocalDex includes a command-line interface for quick data access:
@@ -277,4 +380,60 @@ LocalDex uses data from:
277
380
  - [Pokemon Showdown](https://github.com/smogon/pokemon-showdown)
278
381
  - [PokeAPI](https://pokeapi.co/) (for initial data collection)
279
382
 
383
+ ## Sprite Downloading and Usage
384
+
385
+ 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.
386
+
387
+ ### Downloading Sprites
388
+
389
+ ```python
390
+ from localdex import LocalDex
391
+
392
+ # Initialize with default parallel processing (8 workers)
393
+ dex = LocalDex()
394
+
395
+ # Download and extract all Pokémon and item sprites (requires internet for first run)
396
+ dex.download_all_sprites()
397
+
398
+ # Or customize the number of worker threads for parallel processing
399
+ dex_fast = LocalDex(sprite_max_workers=16) # More workers for faster processing
400
+ dex_lightweight = LocalDex(sprite_max_workers=4) # Fewer workers for lower resource usage
401
+ ```
402
+
403
+ ### Accessing Sprite Paths
404
+
405
+ ```python
406
+ # Get the local file path to a Pokémon sprite
407
+ sprite_path = dex.get_pokemon_sprite_path("Pikachu")
408
+ print(sprite_path) # e.g., /path/to/data/sprites/pokemon/pikachu.png
409
+
410
+ # Get the local file path to an item sprite
411
+ item_sprite_path = dex.get_item_sprite_path("Leftovers")
412
+ print(item_sprite_path) # e.g., /path/to/data/sprites/items/leftovers.png
413
+ ```
414
+
415
+ ### Listing Available Sprites
416
+
417
+ ```python
418
+ # List all available Pokémon sprites
419
+ pokemon_sprites = dex.list_available_sprites("pokemon")
420
+ print(pokemon_sprites)
421
+
422
+ # List all available item sprites
423
+ item_sprites = dex.list_available_sprites("items")
424
+ print(item_sprites)
425
+ ```
426
+
427
+ ### Accessing Sprite Metadata
428
+
429
+ ```python
430
+ # Get metadata for all Pokémon sprites
431
+ pokemon_meta = dex.get_sprite_metadata("pokemon")
432
+ print(pokemon_meta["Pikachu"])
433
+
434
+ # Get metadata for all item sprites
435
+ item_meta = dex.get_sprite_metadata("items")
436
+ print(item_meta["Leftovers"])
437
+ ```
438
+
280
439
 
@@ -1,9 +1,11 @@
1
- localdex/__init__.py,sha256=rAVSDHi5KVKNiMaKgZZ04_Kl7j2KPCZuWO7OuDU6id8,748
1
+ localdex/__init__.py,sha256=hrXzDvHAGSDUNhnajIGpxEbeMrO1sy9AiAuqs15muTs,544
2
2
  localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
3
- localdex/core.py,sha256=9sLLrT60mMtPYVg5ybRRteIFnw3nkj4-XMLhlfLC2jo,20891
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.8.dist-info/METADATA,sha256=cgxNvLj3bLSU7lQY488Z1QcuvHfJhGzrx790kt4oTQY,8332
4794
- localdex-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4795
- localdex-0.1.8.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
4796
- localdex-0.1.8.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
4797
- localdex-0.1.8.dist-info/RECORD,,
4795
+ localdex-0.1.20.dist-info/METADATA,sha256=ac1o8E2NVgUmFBnb7om4hclyKVN4FbQ4UcRqFGRszVE,14109
4796
+ localdex-0.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4797
+ localdex-0.1.20.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
4798
+ localdex-0.1.20.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
4799
+ localdex-0.1.20.dist-info/RECORD,,