Welcome to Pykemon’s documentation!¶
Contents:
Pykemon¶
A python wrapper for PokeAPI
- Free software: BSD license
- Documentation: http://pykemon.rtfd.org.
Usage¶
Even simpler:
>>> import pykemon
>>> client = pykemon.V1Client()
>>> p = client.get_pokemon(uid=1)
[<Pokemon - Bulbasaur>]
Features¶
- Generate Python objects from PokeAPI resources.
- Human-friendly API
Installation¶
At the command line:
$ easy_install pykemon
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv pykemon
$ pip install pykemon
New API¶
Since version 0.2.0, Pykemon now works with Beckett, an easy to use API Client Framework:
>>> client = pykemon.V1Client()
>>> bulba = client.get_pokemon(uid=1)[0]
<Pokemon | Bulbasaur>
>>> bulba.name
Bulbasaur
The following methods work with this client and all take a uid parameter:
- get_pokemon
- get_move
- get_sprite
- get_ability
- get_game
- get_type
- get_egg
Version 0.1* API¶
Then you can start grabbing stuff from the API:
>>> pykemon.get(pokemon='mew')
<Pokemon - Mew>
>>> pykemon.get(pokemon_id=1)
<Pokemon - Bulbasaur>
Fully supports all the resources on PokeAPI:
>>> pykemon.get(move_id=15)
<Move - Cut>
>>> pykemon.get(ability_id=1)
<Ability - stench>
Resources that have other abilities linked are displayed as dicts:
>>> p = pykemon.get(pokemon_id=1)
>>> p
<Pokemon - Bulbasaur>
>>> p.evolutions
{'Ivysaur': '/api/v1/pokemon/2/'}
With the resource uri information you can request the linked resources easily.
Each resource is accessible, with it’s own object-oriented representation. Every resource can be accessed with the term:
resource_id
Where ‘resource’ is replaced depending on the resource you want:
pokemon_id
move_id
ability_id
egg_id
type_id
description_id
game_id
sprite_id
The Pokemon resource can also be requested using the name:
>>> pykemon.get(pokemon='rotom')
<Pokemon - Rotom>
Make sure you use lower case strings!
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/phalt/pykemon/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
Pykemon could always use more documentation, whether as part of the official Pykemon docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/phalt/pykemon/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up pykemon for local development.
Fork the pykemon repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/pykemon.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv pykemon $ cd pykemon/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 pykemon tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travis-ci.org/phalt/pykemon/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Paul Hallett <paulandrewhallett@gmail.com>
History¶
0.2.0 (2016-06-11)¶
- Beckett API Client framework added
0.1.2 (2014-1-3)¶
- Sprite attribute added to Pokemon class
0.1.1 (2013-12-24)¶
- Description attribute added to Pokemon class
0.1.0 (2013-12-23)¶
- First release on PyPI.
- All PokeAPI resources fully supported and represented in an object-oriented style.
- Easy-to-use API: just one method!