blob: d2d13a157ed79342fed803e49fe940d7bcaf566c [file] [log] [blame]
Paul Kehrer0839aa82014-02-11 22:36:51 -06001Getting Started
2===============
3
4Working on ``cryptography`` requires the installation of a small number of
5development dependencies. These are listed in ``dev-requirements.txt`` and they
6can be installed in a `virtualenv`_ using `pip`_. Once you've installed the
7dependencies, install ``cryptography`` in ``editable`` mode. For example:
8
9.. code-block:: console
10
Paul Kehrer450cd022014-02-11 22:46:39 -060011 $ # Create a virtualenv and activate it
12 $ pip install --requirement dev-requirements.txt
13 $ pip install --editable .
Paul Kehrer0839aa82014-02-11 22:36:51 -060014
15You are now ready to run the tests and build the documentation.
16
17Running Tests
18~~~~~~~~~~~~~
19
20``cryptography`` unit tests are found in the ``tests/`` directory and are
21designed to be run using `pytest`_. `pytest`_ will discover the tests
22automatically, so all you have to do is:
23
24.. code-block:: console
25
Paul Kehrer450cd022014-02-11 22:46:39 -060026 $ py.test
27 ...
28 62746 passed in 220.43 seconds
Paul Kehrer0839aa82014-02-11 22:36:51 -060029
30This runs the tests with the default Python interpreter.
31
32You can also verify that the tests pass on other supported Python interpreters.
33For this we use `tox`_, which will automatically create a `virtualenv`_ for
34each supported Python version and run the tests. For example:
35
36.. code-block:: console
37
Paul Kehrer450cd022014-02-11 22:46:39 -060038 $ tox
39 ...
40 ERROR: py26: InterpreterNotFound: python2.6
41 py27: commands succeeded
42 ERROR: pypy: InterpreterNotFound: pypy
43 ERROR: py32: InterpreterNotFound: python3.2
44 py33: commands succeeded
45 docs: commands succeeded
46 pep8: commands succeeded
Paul Kehrer0839aa82014-02-11 22:36:51 -060047
48You may not have all the required Python versions installed, in which case you
49will see one or more ``InterpreterNotFound`` errors.
50
51
52Explicit Backend Selection
53~~~~~~~~~~~~~~~~~~~~~~~~~~
54
55While testing you may want to run tests against a subset of the backends that
56cryptography supports. Explicit backend selection can be done via the
57``--backend`` flag. This flag should be passed to ``py.test`` with a comma
58delimited list of backend names. To use it with ``tox`` you must pass it as
59``tox -- --backend=openssl``.
60
61Building Documentation
62~~~~~~~~~~~~~~~~~~~~~~
63
64``cryptography`` documentation is stored in the ``docs/`` directory. It is
65written in `reStructured Text`_ and rendered using `Sphinx`_.
66
67Use `tox`_ to build the documentation. For example:
68
69.. code-block:: console
70
Paul Kehrer450cd022014-02-11 22:46:39 -060071 $ tox -e docs
72 ...
73 docs: commands succeeded
74 congratulations :)
Paul Kehrer0839aa82014-02-11 22:36:51 -060075
76The HTML documentation index can now be found at
77``docs/_build/html/index.html``.
78
79.. _`pytest`: https://pypi.python.org/pypi/pytest
80.. _`tox`: https://pypi.python.org/pypi/tox
81.. _`virtualenv`: https://pypi.python.org/pypi/virtualenv
82.. _`pip`: https://pypi.python.org/pypi/pip
83.. _`sphinx`: https://pypi.python.org/pypi/Sphinx
84.. _`reStructured Text`: http://sphinx-doc.org/rest.html