cryptography requires the installation of a small number of
development dependencies in addition to the dependencies for
Installation. These are listed in
dev-requirements.txt and they can
be installed in a virtualenv using pip. Before you install them, follow
the build instructions in Installation (be sure to stop before
cryptography). Once you’ve done that, install the
development dependencies, and then install
mode. For example:
$ # Create a virtualenv and activate it $ # Set up your cryptography build environment $ pip install --requirement dev-requirements.txt $ pip install --editable .
Make sure that
pip install --requirement ... has installed the Python
vectors/ and packages on
tests/ . If it didn’t, you may
install them manually by using
pip on each directory.
You will also need to install
enchant using your system’s package manager
to check spelling in the documentation.
There is an upstream bug in
enchant that prevents its installation on
Windows with 64-bit Python. See this Github issue for more information.
The easiest workaround is to use 32-bit Python for
development, even on 64-bit Windows.
You are now ready to run the tests and build the documentation.
OpenSSL on macOS¶
For example, with Homebrew:
$ env LDFLAGS="-L$(brew --prefix email@example.com)/lib" \ CFLAGS="-I$(brew --prefix firstname.lastname@example.org)/include" \ pip install --requirement ./dev-requirements.txt
Alternatively for a static build you can specify
CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 and ensure
LDFLAGS points to the
absolute path for the OpenSSL libraries before calling pip.
You will also need to set these values when Building documentation.
$ pytest ... 62746 passed in 220.43 seconds
This runs the tests with the default Python interpreter.
You can also verify that the tests pass on other supported Python interpreters. For this we use tox, which will automatically create a virtualenv for each supported Python version and run the tests. For example:
$ tox ... py27: commands succeeded ERROR: pypy: InterpreterNotFound: pypy py38: commands succeeded docs: commands succeeded pep8: commands succeeded
You may not have all the required Python versions installed, in which case you
will see one or more
Use tox to build the documentation. For example:
$ tox -e docs ... docs: commands succeeded congratulations :)
The HTML documentation index can now be found at