# You can set these variables from the command line.
SPHINXOPTS=
SPHINXBUILD= /bin/sphinx-build
PAPER=
SPHINXPROJ= Jetconf
SOURCEDIR= .
BUILDDIR= _build
# User-friendly check for sphinx-build
ifeq($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
It is highly recommended to set up a virtual environment for Jetconf
development. The following procedure uses the ``venv`` module for this
purpose (it is included in the standard Python library since
version 3.3).
Development Environment
=======================
#. Install the latest stable **Python3** version.
#. Clone the Jetconf project in a directory of your choice::
$ git clone https://github.com/CZ-NIC/jetconf.git
#. Create the virtual environment::
$ python3 -m venv jetconf
#. Activate the virtual environment::
$ cd jetconf
$ source bin/activate
#. Install required standard packages inside the virtual environment::
$ make install-deps
If you are prompted to upgrade ``pip``, you can do that, too.
When you are inside the virtual environment, the shell prompt should change to
something like::
(jetconf) $
To leave the virtual environment, just do::
$ deactivate
.. tip::
The virtual environment can be entered anytime later by executing step 4.
The steps preceding it need to be performed just once.
The setup described above has a few consequences that have to be kept in mind:
- Any project files that need to go to ``bin`` (executable Python scripts),``include`` or ``lib`` have to be added as exceptions to *.gitignore*, for example::
!bin/jetconf
- After adding a new Python module dependency, it is necessary to run::
$ make deps
and commit the new content of ``requirements.txt``.
.. Tools and Rules
===============
Programming Style
-----------------
We can mostly follow `Google Python Style Guide <https://google.github.io/styleguide/pyguide.html>`_.
All module-level functions and class/object methods should be annotated with type hints.
For other values, type hints should be used where it seems important.
See `PEP 0484 <https://www.python.org/dev/peps/pep-0484/>`_.
Static Type Checking
--------------------
Later we might use `mypy <http://mypy-lang.org>`_.
Currently it doesn't work well will Python 3.5.
Unit Tests
----------
We use `pytest <http://pytest.org>`_.
Documentation
-------------
We will use [Sphinx](http://www.sphinx-doc.org/en/stable/) for creating documentation.
Docstrings in the code should therefore use Sphinx directives,
see this `example <http://www.sphinx-doc.org/en/stable/domains.html#info-field-lists>`_.
Run from source
===============
For development purposes, Jetconf can also be started directly
@@ -36,12 +38,12 @@ User's certificate with ``_curl`` suffix in ``.pem`` format is needed.
After this command you should get some data from Jetconf server in json. Do not forget to set ``<path_to_pem_cert>`` and ``<jetconf server ip address>``::