How can I change the configuration in pybuilder, and how does the configuration in pybuilder work?.
How Do I find out the possible configuration values and their defaults, how do I override or change them per project / per module / on the commmmandline / in settings files? Which are the settings files?
It is very easy to change the configuration of an exisiting project. Visit the build.py
file in the root directory of your project and make sure it has this code in it:
from pybuilder.core import init
and also this (without the dots):
@init
def initialize(project):
...
Plugins are configured using their so called properties
. There is a list of available plugin properties and their default values available here: http://pybuilder.github.io/documentation/plugins.html If you do not configure something the default value will be used.
There is also a python core plugin, where you can change default directories:
http://pybuilder.github.io/documentation/plugins.html#Pythondeployment
This example shows how to change a property of a plugin:
project.set_property('unittest_module_glob', '*_unittest')
This will set the property unittest_module_glob
of the unittest
plugin to the value '*_unittest'.
There are attributes
to describe the whole project. For instance to change the version attribute of the project use a line like this one in the initialize
method:
project.version = "0.1.14"
Your .\build.py
could look like this now:
from pybuilder.core import use_plugin
from pybuilder.core import init
use_plugin("python.core")
use_plugin("python.unittest")
name = "myfirstproject"
default_task = "publish"
@init
def initialize(project):
project.version = "0.1.14"
project.set_property('unittest_module_glob', '*_unittest')
Properties can also be set or overridden using command line switches:
$ pyb -P unittest_module_glob="*_unittest"
Much of all this is explained on the settings page:
http://pybuilder.github.io/documentation/manual.html#Project-specificconfiguration