C extension for a module with a method to look up Pokémon by their index number.
Project based on information found in a blog post on writing extensions by Adam Lamers, the official Python documentation on building C and C++ extension and various other bits and pieces on the topic found online.
Make sure to work in a virtual environment if you want to install the extension with pip
.
In your venv, run:
$ pip install .
to have pip
install the extension using setup.py
.
Alternatively, you can run setup.py
manually with:
$ python3 setup.py build_ext --inplace
to have the C code compiled into a shared object file (.so
) in your venv.
To start the Python script with which you can test the module, use:
$ python3 test_extension.py
The Pokédex (index or "catalogue" of all Pokémon) used in this example project is based on the list of Pokémon found on The Pokémon Wiki.