Skip to content
Sanky edited this page Feb 24, 2012 · 22 revisions

If you're like most people, you just want to get a hold of the data for your own nefarious purposes. Lucky for you, I have made this as simple as I can imagine. As long as you know your way around a terminal, anyway. You do, right?

For more exhaustive documentation on using the pokedex program, see CLI.

0. Install the prerequisites

On install Git, Python, and the Distribute and Virtualenv libraries for Python. MAKE SURE YOU USE PYTHON 2, NOT 3.

On Debian or Ubuntu, that would be sudo apt-get install git python python-distribute python-virtualenv.

On Windows, get Git and Python. Then get the distribute_setup.py and run it using Python, by typing C:\python\python27\bin\python C:\wherever\distribute_setup.py in the command line (substitute whatever paths you have). (We don't have instructions for Virtualenv yet, so just skip that, or figure it out and update this page.)

1. Get the code.

You have two options here.

You can use Git, like I do, if you're familiar with source control:

git clone git://github.com/veekun/pokedex.git

Or you can just go to the Downloads tab on Github and use one of the Download buttons to get a recent copy.

2. "Install" the code.

You have to do this for two reasons: (a) to make sure you have all the right libraries installed, and (b) to create the pokedex program, which actually loads the data into a database for you.

Generally you can do this with:

python setup.py develop

(Windows users will want to use the full path, e.g. C:\python\python27\bin\python instead of just python.)

You might have to invoke sudo if you're on a good platform, because this will install necessary libraries to your system Python directory.

If you'd rather not do that (good for you!), you should instead:

  1. Get virtualenv. It's in most repositores as python-virtualenv, or you can use pip install virtualenv, or get it manually if you must.
  2. Create a virtualenv for the pokedex project by running virtualenv some_directory_name. This will make a directory with a little Python environment inside it. If your system defaults to Python 3 or you run into other version-related problems, make sure you use the --python=python2 argument (or similar).
  3. Move the pokedex project into your shiny new virtualenv.
  4. Run bin/python setup.py develop. Make sure you run the bin/python inside your virtualenv. This will install libraries and the pokedex program only inside the virtualenv and will not touch your system Python. Note that the pokedex program will then end up inside that same bin/ directory.

3. Prep your database.

A lot of people come ask for help, only to realize they sort of forgot this bit. Here's a quick checklist:

  • Be sure you know which database engine you're using!
  • Be sure you've actually created the database!
  • Be sure you have Python support for it installed! Out of the box, Python ONLY supports SQLite! For PostgreSQL, you'll need psycopg2; for MySQL, you'll need mysqldb.

If you don't care, you can use the default SQLite, but this won't work if you used sudo before.

4. Load the data.

For the default SQLite, just do:

pokedex load

(Windows users will use C:\Python27\Scripts\pokedex.exe or similar instead of python).

For different databases, do this:

pokedex load -e postgresql://username:password@localhost/database

Or, you know, something like that. This will churn away for a while (a pretty lonw while, actually). When it's done, you should have a database full of data. Congrats!

For more stuff you can do with the pokedex program, and better instructions on how to use load, see the pokedex documentation (pokedex -h).

Clone this wiki locally