Installation
asyncpg has no external dependencies when not using GSSAPI/SSPIauthentication. The recommended way to install it is to usepip:
$pipinstallasyncpg
If you need GSSAPI/SSPI authentication, the recommended way is to use
$pipinstall'asyncpg[gssauth]'This installs SSPI support on Windows and GSSAPI support on non-Windowsplatforms. SSPI and GSSAPI interoperate as clients and servers: an SSPIclient can authenticate to a GSSAPI server and vice versa.
On Linux installing GSSAPI requires a working C compiler and Kerberos 5development files. The latter can be obtained by installinglibkrb5-devpackage on Debian/Ubuntu orkrb5-devel on RHEL/Fedora. (This is neededbecause PyPI does not have Linux wheels forgssapi. Seehere for thedetails.)
It is also possible to use GSSAPI on Windows:
pip install gssapi
InstallKerberos for Windows.
Set the
gsslibparameter or thePGGSSLIBenvironment variable togssapi when connecting.
Building from source
If you want to buildasyncpg from a Git checkout you will need:
To have cloned the repo with–recurse-submodules.
A working C compiler.
CPython header files. These can usually be obtained by installingthe relevant Python development package:python3-dev on Debian/Ubuntu,python3-devel on RHEL/Fedora.
Once the above requirements are satisfied, run the following commandin the root of the source checkout:
$pipinstall-e.
A debug build containing more runtime checks can be created by settingtheASYNCPG_DEBUG environment variable when building:
$envASYNCPG_DEBUG=1pipinstall-e.
Running tests
If you want to run tests you must have PostgreSQL installed.
To execute the testsuite run:
$pythonsetup.pytest