-
Notifications
You must be signed in to change notification settings - Fork 635
Getting Data
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.
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.)
You have two options here.
You can use Git, like I do, if you're familiar with source control:
git clone https://[email protected]/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.
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:
- Get virtualenv. It's in most repositores as
python-virtualenv
, or you can usepip install virtualenv
, or get it manually if you must. - Create a virtualenv for the
pokedex
project by runningvirtualenv some_directory_name
. This will make a directory with a little Python environment inside it. - Move the
pokedex
project into your shiny new virtualenv. - Run
bin/python setup.py develop
. Make sure you run thebin/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 samebin/
directory.
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 needmysqldb
.
If you don't care, you can use the default SQLite, but this won't work if you used sudo
before.
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
).