- Click on this link / Use This Template button in the GitHub page above to create a brand new python project with built in build and unit test system enabled.
- TODO: Edit this file for each project you create.
- Verify that Python-3 and pip3 should be installed in your system. terminal>
pip3 -V
- Install pyb:
pip3 install pybuilder
- Verify Pyb installation :
pyb --version
# If pyb command is not found, you will have to add pyb to path.
# follow these instructions to add pyb to path.
# for ubuntu/bash:
> echo 'export PATH=$PATH:/<path/to/pyb/bin>' >> ~/.bashrc
# this is usually /home/<home folder>/.local/bin
> source ~/.bashrc
pyb install_dependencies
# Pyb should work without pyb install_dependencies, but unfortunately it doesnt.
# See details: here https://github.com/pybuilder/pybuilder/issues/727
pyb -v
- That's all you need to build the project.
- Details about Test failures if any can be found in file
target\reports\unittest
- The binary artifacts will be available in the target folder.
# To skip integration tests during build use the below command
pyb -x run_integration_tests
# To run only integration tests use the below command
pyb run_integration_tests -x run_unit_tests
-
pyb clean
-
pyb clean && rm -rf .pybuilder
- Tutorial: https://pybuilder.io/documentation/tutorial
- To make changes to build scripts see this: https://pythonhosted.org/pybuilder/walkthrough-new.html
- This project uses Flake8 as the default linter for coding style enforcement.
- Refer https://flake8.pycqa.org/en/latest/ for more details.
- Before raising a pull request contributors are advised to run the below command locally to ensure there are no Flake8 warnings.
pyb analyze
- Please ensure build passes on running the above command without any warnings. Examples of Flake 8 warnings shown below:
E501 line too long (125 > 120 characters)
F403 'from local_settings import *' used; unable to detect undefined names
F401 'django.contrib.auth.views as auth_views' imported but unused
Support is present in source. .idea
files are avilable when you clone this repo. Just open the folder in pycharm.
- Vim's config file is usually located in
~/.vimrc
. Locate the Vim rc file. - create/Append the file with this config file.
- Use
src/main/python/<module>
to add your python module. - Write unit tests in
src/unittest/
directory mirroring the same module structure insrc/main
directory. - The build artifacts can be found in
target
directory.
- Dependencies are managed through the build.py file.
- Refer https://pybuilder.io/documentation/plugins#installing-dependencies to see how this can be done.
- After updating dependencies, run the following command.
pyb install_dependencies
- Write unit tests in
src/unittest/
directory mirroring the same module structure insrc/main
directory. - Use One of the two below supported testing suites.
- Python unit test framework : https://docs.python.org/3/library/unittest.html
- Mockito spying framewrk, see docs: https://mockito-python.readthedocs.io/en/latest/
Follow the above two links on details on how to write tests.
- Write integration tests in
src/integrationtest/python/
directory. - Integration test file names should end with
_tests.py
. - Refer https://pybuilder.io/documentation/plugins#running-python-integration-tests for more details.
pyb -v
runs unit tests as part of every build- Default coverage is set to 70%. To change the defaults, see https://pybuilder.io/documentation/plugins#measuring-unittest-coverage
- We use pybuilder as the build tool.
- https://www.youtube.com/watch?v=iQU18hAjux4&