Installing and Testing

Most users will want to simply install the latest version, hosted on PyPI:

pip install peewee

Peewee has optional Sqlite C extensions which are not bundled as part of the wheel. If you wish to use these, you can install Peewee via source distribution:

pip install peewee --no-binary :all:

Installing with git

The project is hosted at https://github.com/coleifer/peewee and can be installed using git:

git clone https://github.com/coleifer/peewee.git
cd peewee
pip install .

Running tests

You can test your installation by running the test suite.

python runtests.py

You can test specific features or specific database drivers using the runtests.py script. To view the available test runner options, use:

python runtests.py --help

Note

To run tests against Postgres or MySQL you need to create a database named “peewee_test”. To test the Postgres extension module, you will also want to install the HStore extension in the postgres test database:

-- install the hstore extension on the peewee_test postgres db.
CREATE EXTENSION hstore;

Driver support

Database

Driver

Implementation

Sqlite

sqlite3

SqliteDatabase

Postgres

psycopg2

PostgresqlDatabase

Postgres

psycopg3

PostgresqlDatabase

MySQL

pymysql

MySQLDatabase

Sqlite (async)

aiosqlite

AsyncSqliteDatabase

Postgres (async)

asyncpg

AsyncPostgresqlDatabase

MySQL (async)

aiomysql

AsyncMySQLDatabase

Sqlite (alternate)

cysqlite

CySqliteDatabase

Sqlite (alternate)

apsw

APSWDatabase

SqlCipher

sqlcipher3

SqlCipherDatabase

MySQL (alternate)

mysql-connector

MySQLConnectorDatabase

MariaDB (alternate)

mariadb-connector

MariaDBConnectorDatabase