Development =========== Development Environment Setup ----------------------------- To set up an environment for developing the py-pal module, the requirements mentioned in the section *Installation* must be met. Then 1. Clone this repository locally with git 2. Navigate to the cloned repository 3. Create a virtual environment python -m venv .venv 4. Activate the virtual environment On Microsoft Windows run: .venv\\Scripts\\activate.bat On Linux run: source venv/bin/activate 5. Install the dependencies for the development environment pip install -r dev-requirements.txt or python -m pip install -r dev-requirements Building the *py-pal* module ---------------------------- python setup.py develop With this command, the C extensions are compiled using Cython. Also, it packages all necessary files together and installs them in the current virtual environment. Note, any change to a cython file (.pyx) requires recompilation, i.e. the above command must be executed again. *Attention*, if it is not possible to install Cython by this command, the cython files (.pyx) are not taken into account. This results in the circumstance that the corresponding C/C++ files are not generated and thus, the old C/C++ files get used to build the C extensions. Directly speaking, changes to the cython files will have no effect because they are not processed! Testing ------- The test execution is managed with `pytest`, read more about selecting specific tests and general usage `here `_. Run all regular and Cython tests together from the command line pytest Run all regular tests from the command line pytest tests Run all Cython tests from the command line pytest tests_cython Run a single test from tests/test_complexity_classification.py with plotting enabled. This will generate plots similar to running py-pal from the command line with the -p/--plot flag. The files are placed in the specified folder. set PYPAL_SAVE_PLOTS=plots set PYPAL_SAVE_STATISTICS=data pytest tests\\test_complexity_classification.py::TestComplexityClassification::test_bubble_sort Logging ------- Logging can be helpful for understanding and debugging the *py-pal* module. `py-pal` supports logging and the different verbosity levels. The default log level is ``logging.WARNING``. To run `py-pal` with increased verbosity execute py-pal --log-level=info py-pal --log-level=debug During testing you can configure the general logging level using the *set_log_level* function from py_pal.util .. sourcecode:: python import logging from py_pal.util import set_log_level set_log_level(logging.INFO) It is also possible to configure different logging levels per module with .. sourcecode:: python import logging from py_pal.data_collection import proxy logging.getLogger('py_pal.data_collection.proxy').setLevel(logging.DEBUG) logging.getLogger(proxy.__name__).setLevel(logging.DEBUG)