10. Development

This section only needs to be read by developers of the pywbem package. People that want to make a fix or develop some extension, and people that want to test the project are also considered developers for the purpose of this section.

10.1. Repository

The repository for pywbem is on GitHub:


10.2. Setting up the development environment

It is recommended to use Linux as the development environment for pywbem. OS-X should work as well, but Windows requires a number of manual setup steps.

  1. Clone the Git repo of this project and switch to its working directory:

    $ git clone git@github.com:pywbem/pywbem.git
    $ cd pywbem
  2. It is recommended that you set up a virtual Python environment. Have the virtual Python environment active for all remaining steps.

  3. Install pywbem and its prerequisites for installing and running it as described in Installation. This will install Python packages into the active Python environment, and OS-level packages.

  4. On Windows, perform the setup steps described in Manual setup on Windows. On Linux and OS-X, the corresponding setup is performed automatically as part of the next step.

  5. Install the prerequsites for pywbem development. This will install Python packages into the active Python environment, and OS-level packages:

    $ make develop
  6. This project uses Make to do things in the currently active Python environment. The command:

    $ make

    displays a list of valid Make targets and a short description of what each target does.

10.2.1. Manual setup on Windows

For development of pywbem, it is recommended to use one of the Unix-like environments on Windows (such as CygWin, MinGW, Babun, or Gow). The pywbem tests that run on the Appveyor CI use CygWin.

Note that Unix-like environments on Windows bring their own Python, so double check that the active Python environment is the one you want to install to.

The development environment needs the xmllint utility and the lxml Python package.

The lxml Python package for Windows meanwhile comes as a binary wheel archive that includes all of its dependencies, so it has no additional dependencies you would need to take care about.

The xmllint utility is part of CygWin and likely also part of the other Unix-like environments.

10.3. Prerequisite operating system packages for development

The following table lists the prerequisite operating system packages along with their version requirements for development of pywbem, for the supported operating systems and Linux distributions.

The prerequisite operating system packages for installing and running pywbem are also needed for development, and can be found in section Prerequisite operating system packages for install.

This section is just for information. These packages will be installed as part of the steps described in Setting up the development environment.

Op.system / Distribution Package name Version requirements Notes
Linux RedHat family (RHEL, CentOS, Fedora)      
Linux Debian family (Ubuntu, Debian, LinuxMint)      
Linux SUSE family (SLES, openSUSE)      
Windows xmllint    

10.4. Building the documentation

The ReadTheDocs (RTD) site is used to publish the documentation for the pywbem package at http://pywbem.readthedocs.io/

This page is automatically updated whenever the Git repo for this package changes the branch from which this documentation is built.

In order to build the documentation locally from the Git work directory, issue:

$ make builddoc

The top-level document to open with a web browser will be build_doc/html/docs/index.html.

10.5. Testing

To run unit tests in the currently active Python environment, issue one of these example commands:

$ make test                                              # Run all unit tests
$ PYTHONPATH=. py.test testsuite/test_cim_obj.py -s      # Run only this test source file
$ PYTHONPATH=. py.test InitCIMInstanceName -s            # Run only this test class
$ PYTHONPATH=. py.test -k InitCIMInstanceName or Bla -s  # py.test -k expressions are possible

Invoke py.test --help for details on the expression syntax of its -k option.

To run the unit tests and some more commands that verify the project is in good shape in all supported Python environments, use Tox:

$ tox                              # Run all tests on all supported Python versions
$ tox -e py27                      # Run all tests on Python 2.7

10.6. Updating the DMTF MOF Test Schema

Pywbem uses DMTF CIM Schemas in its CI testing. The schema used is stored in the form received from the DMTF in the directory testsuite/schema and is expanded and compiled in testsuite/test_mof_compiler.py as part of the tests.

Since the DMTF regularly updates the schema, the pywbem project tries to stay up-to-date with the current schema. At the same time, earlier schemas can be used for testing also by changing the definitions for the dmtf schema to be tested.

The schema used for testing can be modified by modifying the test file:


Detailed information on this process is in testsuite/dmtf_mof_schema_def.py

10.7. Developing PyWBEM Ipython Documentation Notebooks

The pywbem developers are using ipython notebooks to demonstrate the use of pywbem. Today we generally have one notebook per operation or group of operations including definition of the operation, references back to the pywbem documentation, and one or more examples (hopefully examples that will actually execute against a wbem server)

These can easily be extended or supplemented using a local ipython or jupyter server by:

1. Install ipython or Jupyter software using pip or pip3. The notebook server may be installed as root or within a python virtual environment. For example:

$ sudo pip install ipython
$ sudo pip3 install ipython
$ sudo pip install jupyter

The notebook server may be installed as root or within a python virtual environment.

2. Start the local ipython/jupyter notebook server in the notebook directory (pywbem/docs/notebooks) referencing that directory in the command line call:

$ ipython notebook docs/notebooks
$ jupyter notebook docs/notebooks

This will start the local ipython/juypter notebook server and on the first page displayed in your web browser all existing pywbem ipython notebooks will be available for editing. New ones can be created using the commands on that ipython server web page.

New and changed notebooks must go through the same contribution process as other components of pywbem to be integrated into the github repository.

10.8. Contributing

Third party contributions to this project are welcome!

In order to contribute, create a Git pull request, considering this:

  • Test is required.
  • Each commit should only contain one “logical” change.
  • A “logical” change should be put into one commit, and not split over multiple commits.
  • Large new features should be split into stages.
  • The commit message should not only summarize what you have done, but explain why the change is useful.
  • The commit message must follow the format explained below.

What comprises a “logical” change is subject to sound judgement. Sometimes, it makes sense to produce a set of commits for a feature (even if not large). For example, a first commit may introduce a (presumably) compatible API change without exploitation of that feature. With only this commit applied, it should be demonstrable that everything is still working as before. The next commit may be the exploitation of the feature in other components.

For further discussion of good and bad practices regarding commits, see:

10.9. Core Development Team

Anyone can contribute to pywbem via pull requests as described in the previous section.

The pywbem project has a core development team that holds regular web conferences and that is using Slack for offline communication, on the Slack workspace: https://pywbem.slack.com.

The web conference and the Slack workspace are by invitation, and if you want to participate in the core team, please open an issue to let us know.