Requirements, Installation, and Testing¶
PyDelphin releases are available on PyPI and the source code is on GitHub. For most users, the easiest and recommended way of installing PyDelphin is from PyPI via pip, as it installs any required dependencies and makes the delphin command available (see PyDelphin at the Command Line). If you wish to inspect or contribute code, or if you need the most up-to-date features, PyDelphin may be used directly from its source files.
PyDelphin works with Python 3.6 and higher, regardless of the platform. Certain features, however, may require additional dependencies or may be platform specific, as shown in the table below:
Module or Function
Linux and Mac only
See Installing Extra Dependencies for information about installing with “extras”, including those needed for PyDelphin development (which are not listed in the table above).
Installing from PyPI¶
Install the latest releast from PyPI using pip:
[~]$ pip install pydelphin
If you already have an older version of PyDelphin installed, you can
upgrade it by adding the
--upgrade flag to the command.
It is strongly recommended to use virtual environments to keep Python packages and dependencies confined to a specific environment. For more information, see here: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments
Installing from Source¶
Clone the repository from GitHub to get the latest source code:
[~]$ git clone https://github.com/delph-in/pydelphin.git
Install from the source code using pip as before but give it the path to the repository instead of the name of the PyPI project:
[~]$ cd pydelphin/ [~/pydelphin]$ pip install .
Installing from source does not require internet access once the
repository has been cloned, but it does require internet to install
any dependencies. Also note that if the project directory is named
pydelphin (the default) and you install from the directory above
it, you mustn’t just use the directory name as this will cause
pip to install from PyPI; instead, make it look path-like
by prefixing it with
pip install ./pydelphin).
For development, you may also want to use pip’s
option to install PyDelphin as “editable”, meaning it installs the
dependencies but uses the local source files for PyDelphin’s code,
otherwise changes you make to PyDelphin won’t be reflected in your
(virtual) environment unless you reinstall PyDelphin.
It is not recommended to install from source using
install, because uninstalling or updating PyDelphin and its
dependencies becomes more difficult.
Installing Extra Dependencies¶
Some features require dependencies beyond what the standard install provides. The purpose of keeping these dependencies optional is to reduce the install size for users who do not make use of the additional features.
If you need to use some of these features, such as
delphin.repp, install the extra dependencies with pip as
before but with an install parameter in brackets after
pydelphin. For instance:
[~]$ pip install pydelphin[web,repp]
Without the install parameter, the PyDelphin code will still be
installed but its dependencies will not be. The rest of PyDelphin will
work but those features may raise an
ImportError or issue a
In addition, there are some dependencies that are only necessary for developers of PyDelphin to run unit tests and build documentation.
The extras that PyDelphin defines are as follows:
Required for using the
Optional for advanced regex features with
Required for building documentation
Required for running tests
Required for making releases (includes
Running Unit Tests¶
PyDelphin’s unit tests are not distributed on PyPI, so if you wish to
run the unit tests you’ll need to get the source code. The tests are
written for pytest, which is installed if you used the
dev install parameters described above. Once pytest is
installed (note: it may also be called py.test), run it to
perform the unit tests:
This will detect and run any unit tests it finds. It is best to run the pytest in a virtual environment with a clean install of PyDelphin to ensure that the local Python environment is not conflicting with PyDelphin’s dependencies and also to ensure that PyDelphin specifies all its dependencies.