localdex 0.1.6__py3-none-any.whl → 0.1.7a2__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/cli.py CHANGED
@@ -27,6 +27,7 @@ Examples:
27
27
  localdex ability lightningrod
28
28
  localdex list-pokemon --generation 1
29
29
  localdex export --format json --output pokemon_data.json
30
+ localdex demo
30
31
  """
31
32
  )
32
33
 
@@ -89,6 +90,10 @@ Examples:
89
90
  stats_parser = subparsers.add_parser("stats", help="Show data statistics")
90
91
  stats_parser.add_argument("--format", choices=["text", "json"], default="text", help="Output format")
91
92
 
93
+ # Demo command
94
+ demo_parser = subparsers.add_parser("demo", help="Run the LocalDex demo")
95
+ demo_parser.add_argument("--quiet", action="store_true", help="Suppress output (for testing)")
96
+
92
97
  args = parser.parse_args()
93
98
 
94
99
  if not args.command:
@@ -116,6 +121,8 @@ Examples:
116
121
  return handle_export_command(dex, args)
117
122
  elif args.command == "stats":
118
123
  return handle_stats_command(dex, args)
124
+ elif args.command == "demo":
125
+ return handle_demo_command(dex, args)
119
126
  else:
120
127
  print(f"Unknown command: {args.command}")
121
128
  return 1
@@ -371,6 +378,64 @@ def handle_stats_command(dex: LocalDex, args) -> int:
371
378
  return 1
372
379
 
373
380
 
381
+ def handle_demo_command(dex: LocalDex, args) -> int:
382
+ """Handle the demo command."""
383
+ try:
384
+ if not args.quiet:
385
+ print("=== LocalDex Demo ===\n")
386
+
387
+ # Get Pokemon by name
388
+ pikachu = dex.get_pokemon("pikachu")
389
+ if not args.quiet:
390
+ print(f"{pikachu.name} - {pikachu.types}")
391
+
392
+ # Get Pokemon by ID
393
+ charizard = dex.get_pokemon_by_id(6)
394
+ if not args.quiet:
395
+ print(f"{charizard.name} - HP: {charizard.base_stats.hp}")
396
+
397
+ # Get Pokemon stats
398
+ bulbasaur = dex.get_pokemon("bulbasaur")
399
+ if not args.quiet:
400
+ print(f"{bulbasaur.name} - Attack: {bulbasaur.base_stats.attack}, Speed: {bulbasaur.base_stats.speed}")
401
+
402
+ # Get moves
403
+ thunderbolt = dex.get_move("thunderbolt")
404
+ if not args.quiet:
405
+ print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}, Type: {thunderbolt.type}")
406
+
407
+ # Get abilities (note: use dashes in names like "lightning-rod")
408
+ lightning_rod = dex.get_ability("lightning-rod")
409
+ if not args.quiet:
410
+ print(f"{lightning_rod.name} - {lightning_rod.description}")
411
+
412
+ # Search Pokemon by type (case-insensitive)
413
+ fire_types = dex.search_pokemon(type="fire")
414
+ if not args.quiet:
415
+ print(f"Fire type Pokemon: {[p.name for p in fire_types[:5]]}")
416
+
417
+ # Search Pokemon by stat
418
+ fast_pokemon = dex.search_pokemon(min_speed=120)
419
+ if not args.quiet:
420
+ print(f"Very fast Pokemon: {[p.name for p in fast_pokemon[:5]]}")
421
+
422
+ # Get all moves of a specific type (case-insensitive)
423
+ all_moves = dex.get_all_moves()
424
+ electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
425
+ if not args.quiet:
426
+ print(f"Electric moves count: {len(electric_moves)}")
427
+ print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
428
+
429
+ if not args.quiet:
430
+ print("\n=== Demo completed successfully! ===")
431
+
432
+ return 0
433
+
434
+ except Exception as e:
435
+ print(f"Error running demo: {e}", file=sys.stderr)
436
+ return 1
437
+
438
+
374
439
  def print_pokemon_text(pokemon) -> None:
375
440
  """Print Pokemon information in text format."""
376
441
  print(f"Pokemon: {pokemon.name} (#{pokemon.id})")
localdex/core.py CHANGED
@@ -450,7 +450,7 @@ class LocalDex:
450
450
  evo_item=data.get("evoItem"),
451
451
  egg_groups=data.get("eggGroups"),
452
452
  gender_ratio=data.get("genderRatio"),
453
- generation=data.get("gen"),
453
+ generation=data.get("generation"),
454
454
  description=data.get("description"),
455
455
  is_legendary=data.get("isLegendary", False),
456
456
  is_mythical=data.get("isMythical", False),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: localdex
3
- Version: 0.1.6
3
+ Version: 0.1.7a2
4
4
  Summary: A local Pokemon data repository/Pokedex with fast offline access
5
5
  Home-page: https://github.com/yourusername/localdex
6
6
  Author: LocalDex Team
@@ -59,7 +59,7 @@ A fast, offline-first Python library for Pokemon data access. LocalDex provides
59
59
  [![PyPI version](https://badge.fury.io/py/localdex.svg)](https://badge.fury.io/py/localdex)
60
60
  [![Python versions](https://img.shields.io/pypi/pyversions/localdex.svg)](https://pypi.org/project/localdex/)
61
61
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
62
- [![Tests](https://github.com/yourusername/localdex/workflows/Test/badge.svg)](https://github.com/yourusername/localdex/actions)
62
+ [![Tests](https://github.com/colefoster/localdex/workflows/release/badge.svg)](https://github.com/colefoster/localdex/actions)
63
63
 
64
64
  ## Features
65
65
 
@@ -102,31 +102,6 @@ pip install localdex[abilities] # Ability data
102
102
  pip install localdex[full]
103
103
  ```
104
104
 
105
- ### Development Installation
106
-
107
- ```bash
108
- git clone https://github.com/yourusername/localdex.git
109
- cd localdex
110
- pip install -e .[dev]
111
- ```
112
-
113
- ## Development & Automation
114
-
115
- This project uses GitHub Actions for automated testing, data updates, and PyPI releases. See [GITHUB_ACTIONS_SETUP.md](GITHUB_ACTIONS_SETUP.md) for detailed setup instructions.
116
-
117
- ### Quick Setup for Contributors
118
-
119
- 1. **Fork and clone** the repository
120
- 2. **Install dependencies**: `pip install -e .[dev]`
121
- 3. **Run tests**: `pytest`
122
- 4. **Update data**: `python -m localdex.download_data`
123
- 5. **Create pull request**
124
-
125
- ### Automated Workflows
126
-
127
- - **Test**: Runs on every PR and push to main
128
- - **Data Updates**: Weekly automated Pokemon data updates
129
- - **Release**: Automated PyPI releases on version tags
130
105
 
131
106
  ## Quick Start
132
107
 
@@ -154,17 +129,19 @@ print(f"{thunderbolt.name} - Power: {thunderbolt.base_power}, Type: {thunderbolt
154
129
 
155
130
  # Get abilities (note: use dashes in names like "lightning-rod")
156
131
  lightning_rod = dex.get_ability("lightning-rod")
157
- print(f"{lightning_rod.name} - {lightning_rod.short_description}")
132
+ print(f"{lightning_rod.name} - {lightning_rod.description}")
158
133
 
159
- # Get all Pokemon of a specific type (basic example)
160
- all_pokemon = dex.get_all_pokemon()
161
- fire_pokemon = [p for p in all_pokemon if "Fire" in p.types]
162
- print(f"Fire type Pokemon count: {len(fire_pokemon)}")
163
- print(f"First 5 Fire Pokemon: {[p.name for p in fire_pokemon[:5]]}")
134
+ # Search Pokemon by type (case-insensitive)
135
+ fire_types = dex.search_pokemon(type="fire")
136
+ print(f"Fire type Pokemon: {[p.name for p in fire_types[:5]]}")
164
137
 
165
- # Get all moves of a specific type
138
+ # Search Pokemon by stat
139
+ fast_pokemon = dex.search_pokemon(min_speed=120)
140
+ print(f"Very fast Pokemon: {[p.name for p in fast_pokemon[:5]]}")
141
+
142
+ # Get all moves of a specific type (case-insensitive)
166
143
  all_moves = dex.get_all_moves()
167
- electric_moves = [m for m in all_moves if m.type == "Electric"]
144
+ electric_moves = [m for m in all_moves if m.type.lower() == "electric"]
168
145
  print(f"Electric moves count: {len(electric_moves)}")
169
146
  print(f"First 5 Electric moves: {[m.name for m in electric_moves[:5]]}")
170
147
  ```
@@ -266,89 +243,6 @@ LocalDex organizes data into logical sets that can be installed independently:
266
243
  - **Items** (`items`): Item data and effects
267
244
  - **Abilities** (`abilities`): Detailed ability information
268
245
 
269
- ## Examples
270
-
271
- ### Pokemon Battle Simulator
272
-
273
- ```python
274
- from localdex import LocalDex
275
-
276
- dex = LocalDex()
277
-
278
- def simulate_battle(pokemon1_name: str, pokemon2_name: str):
279
- pokemon1 = dex.get_pokemon(pokemon1_name)
280
- pokemon2 = dex.get_pokemon(pokemon2_name)
281
-
282
- print(f"{pokemon1.name} vs {pokemon2.name}")
283
- print(f"{pokemon1.name} types: {pokemon1.types}")
284
- print(f"{pokemon2.name} types: {pokemon2.types}")
285
-
286
- # Calculate type effectiveness
287
- for move in pokemon1.moves[:4]: # First 4 moves
288
- effectiveness = calculate_effectiveness(move.type, pokemon2.types)
289
- print(f"{move.name} effectiveness: {effectiveness}x")
290
-
291
- simulate_battle("pikachu", "charizard")
292
- ```
293
-
294
- ### Pokemon Team Builder
295
-
296
- ```python
297
- from localdex import LocalDex
298
-
299
- dex = LocalDex()
300
-
301
- def build_balanced_team():
302
- team = []
303
-
304
- # Get a water type
305
- water_pokemon = dex.search_pokemon(type="Water", min_speed=80)
306
- if water_pokemon:
307
- team.append(water_pokemon[0])
308
-
309
- # Get a fire type
310
- fire_pokemon = dex.search_pokemon(type="Fire", min_attack=100)
311
- if fire_pokemon:
312
- team.append(fire_pokemon[0])
313
-
314
- # Get a grass type
315
- grass_pokemon = dex.search_pokemon(type="Grass", min_special_attack=90)
316
- if grass_pokemon:
317
- team.append(grass_pokemon[0])
318
-
319
- return team
320
-
321
- team = build_balanced_team()
322
- for pokemon in team:
323
- print(f"{pokemon.name} - {pokemon.types}")
324
- ```
325
-
326
- ### Move Database
327
-
328
- ```python
329
- from localdex import LocalDex
330
-
331
- dex = LocalDex()
332
-
333
- def analyze_moves():
334
- # Get all moves
335
- all_moves = dex.get_all_moves()
336
-
337
- # Find the strongest moves
338
- strong_moves = [move for move in all_moves if move.base_power >= 120]
339
- print(f"Strong moves (120+ power): {len(strong_moves)}")
340
-
341
- # Find status moves
342
- status_moves = [move for move in all_moves if move.category == "Status"]
343
- print(f"Status moves: {len(status_moves)}")
344
-
345
- # Find moves by type
346
- fire_moves = [move for move in all_moves if move.type == "Fire"]
347
- print(f"Fire moves: {len(fire_moves)}")
348
-
349
- analyze_moves()
350
- ```
351
-
352
246
  ## CLI Usage
353
247
 
354
248
  LocalDex includes a command-line interface for quick data access:
@@ -373,30 +267,6 @@ localdex list-pokemon
373
267
  localdex export --format json --output pokemon_data.json
374
268
  ```
375
269
 
376
- ## Performance
377
-
378
- LocalDex is optimized for fast access:
379
-
380
- - **Memory Efficient**: Data is loaded on-demand
381
- - **Fast Lookups**: Optimized data structures for quick searches
382
- - **Caching**: Frequently accessed data is cached in memory
383
- - **Indexed Searches**: Pre-built indexes for common search patterns
384
-
385
- ## Contributing
386
-
387
- Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
388
-
389
- ### Development Setup
390
-
391
- ```bash
392
- git clone https://github.com/yourusername/localdex.git
393
- cd localdex
394
- pip install -e .[dev]
395
- pytest # Run tests
396
- black . # Format code
397
- mypy . # Type checking
398
- ```
399
-
400
270
  ## License
401
271
 
402
272
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -407,6 +277,4 @@ LocalDex uses data from:
407
277
  - [Pokemon Showdown](https://github.com/smogon/pokemon-showdown)
408
278
  - [PokeAPI](https://pokeapi.co/) (for initial data collection)
409
279
 
410
- ## Changelog
411
280
 
412
- See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.
@@ -1,6 +1,6 @@
1
1
  localdex/__init__.py,sha256=rAVSDHi5KVKNiMaKgZZ04_Kl7j2KPCZuWO7OuDU6id8,748
2
- localdex/cli.py,sha256=79NpeQQYwuDuM6wODUX1AOUppTPULD5T0qgTH5uKd2c,16797
3
- localdex/core.py,sha256=3uIV5F94oLfvaOF1FbXkqKG5Xigg0yaEcd6guT_44Nk,20884
2
+ localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
3
+ localdex/core.py,sha256=9sLLrT60mMtPYVg5ybRRteIFnw3nkj4-XMLhlfLC2jo,20891
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
@@ -4790,8 +4790,8 @@ localdex/models/ability.py,sha256=AQzv3XUHHl4sustMJjPDDjJOjXu2GMLTfcM3-tqQ_1w,30
4790
4790
  localdex/models/item.py,sha256=zXao8F-jBPUGq_YLeGeYeK_dZVI7aZMXtWOPwR3qusY,4677
4791
4791
  localdex/models/move.py,sha256=hfgcWI4ziz5MMvc9ddmkotxzYYdrSUqZZQ72IU5tucs,7629
4792
4792
  localdex/models/pokemon.py,sha256=v5zkxY1NGGR-MczFCZe9fHt6u_BAqAjMiQZlpcLXVGc,5408
4793
- localdex-0.1.6.dist-info/METADATA,sha256=MFUsMphzcwYkxi7-77LK56mZ6IELXTRJVEtecIeDIBo,11767
4794
- localdex-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4795
- localdex-0.1.6.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
4796
- localdex-0.1.6.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
4797
- localdex-0.1.6.dist-info/RECORD,,
4793
+ localdex-0.1.7a2.dist-info/METADATA,sha256=0gt5qUt-cFiq2YpYKIkZUEEAISAGx-NJYvLm0JOsZJs,8300
4794
+ localdex-0.1.7a2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
4795
+ localdex-0.1.7a2.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
4796
+ localdex-0.1.7a2.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
4797
+ localdex-0.1.7a2.dist-info/RECORD,,