Create a Work Breakdown Structure WBS using Python

This short tutorial explains how to create a work breakdown structure WBS using Python. It will provide you with details on setting up the IDE, a list of steps, and sample code to work with MS Project WBS using Python. You will get information to enhance the given code for creating a customized output MPP.

Steps for Building a WBS using Python

  1. Set up the IDE for working with WBS using Aspose.Tasks for Python via .NET
  2. Set the product license and create a blank project
  3. Define a custom WBS code format using the WBSCodeDefinition class object
  4. Add a mask for the WBS code for setting each level numbering format
  5. Add multiple tasks with a defined hierarchy
  6. Recalculate the project to regenerate the WBS code as per the defined configuration
  7. Save the project with the defined WBS code format
  8. Load the project again to read the WBS structure in it

The above steps describe how to work with the project breakdown structure using Python. Set the license, create a new project, define a custom WBS code format along with the mask, and add multiple tasks with a given hierarchy. Recalculate the project to refresh the WBS codes, save the project and load it again to read the WBS structure for all the tasks in the project.

Code for Building a Work Breakdown Structure using Python

This code demonstrates how to create a WBS structure using Python. The output MPP file can be protected by using the MPPSaveOptions.protection_password property, attaching additional custom outline codes alongside the WBS code, or using Task.wbs/wbs_level setters to manually override the autogenerated codes. If you want to use readable alphanumeric codes, try implementing the WBSSequence with uppercase or lowercase letters.

This guide teaches how to apply work breakdown in a project file. To set a predecessor in a project, refer to the article Set predecessor in MS Project using Python.