PyP6Xer

 
 

Open Source Python Library for Primavera P6 XER Files

Parse, Analyze & Manipulate Primavera P6 XER Files with Zero Dependencies via Free Python API.

What is PyP6Xer?

PyP6Xer is a powerful open source Python library designed for parsing, analyzing, and manipulating Primavera P6 XER (eXchange ERport) files. It provides an intuitive, object-oriented interface to access all project data including activities, resources, calendars, WBS, and relationships without requiring external dependencies. The library supports comprehensive schedule analysis, resource management, and earned value calculations, making it ideal for construction, engineering, and project management professionals.

With PyP6Xer, developers can read XER files, extract structured data, perform critical path analysis, check schedule quality, and export modified data back to XER format. The library follows Pythonic design principles and offers clean APIs for accessing projects, tasks, resources, and their interdependencies. It enables integration with other systems, custom reporting, portfolio analysis, and advanced scheduling metrics using only Python's standard library, ensuring portability and ease of deployment.

Previous Next

Getting Started with PyP6Xer

Install PyP6Xer from PyPI using pip with the command pip install PyP6XER. Alternatively, clone the source code from the PyP6Xer GitHub repository and install it in development mode using pip install -e .. The library requires Python 3.6 or higher and has zero external dependencies, relying solely on Python's standard library for maximum portability and ease of deployment. Once installed, you can begin parsing XER files and accessing project data through its intuitive object-oriented API.

Install PyP6Xer via PIP Command

pip install PyP6XER

Parse XER Files & Access Project Data

PyP6Xer enables developers to load and parse Primavera P6 XER files with minimal code. Using the Reader class, you can load an XER file and access projects, activities, resources, and relationships through a clean object-oriented interface. Each element exposes attributes like task codes, durations, status codes, and more. The library filters data by project context automatically, allowing efficient navigation of large project portfolios. This makes it ideal for building custom reporting tools, data validation scripts, and integration pipelines that require structured access to P6 project data without complex parsing logic.

How to Load and Access Project Data via Python API?

from xerparser.reader import Reader

# Load an XER file
xer = Reader("project.xer")

# Access projects and activities
for project in xer.projects:
    print(f"Project: {project.proj_short_name}")
    for activity in project.activities:
        print(f"  {activity.task_code}: {activity.task_name}")
        print(f"  Duration: {activity.duration} days")

Critical Path & Schedule Analysis

PyP6Xer includes built-in tools for critical path identification and schedule quality analysis. Developers can calculate float values, identify activities with zero or negative total float, and detect scheduling issues such as multiple start activities or overly long durations. The library exposes key scheduling attributes like early/late dates, total float, and activity status, enabling comprehensive schedule health checks. This functionality supports project managers in validating schedule integrity, optimizing resource allocation, and ensuring compliance with scheduling best practices without requiring external tools or manual data processing.

How to Identify Critical Path Activities via Python?

# Find critical activities
critical_activities = []
for activity in xer.activities:
    if activity.total_float_hr_cnt is not None and activity.total_float_hr_cnt <= 0:
        critical_activities.append(activity)

print(f"Critical Path: {len(critical_activities)} activities")
for activity in critical_activities:
    print(f"  {activity.task_code}: {activity.task_name}")

Resource Allocation & Utilization Analysis

PyP6Xer provides robust support for resource management and utilization analysis. Developers can access resource assignments, calculate total assigned hours, identify over-allocated resources, and analyze resource costs across activities. The library supports labor, material, and equipment resources, along with their rates and categories. This enables portfolio-level resource leveling, capacity planning, and cost forecasting. By aggregating assignment quantities and costs, teams can generate detailed resource reports, optimize workforce distribution, and ensure project timelines align with available resources.

Earned Value Management & Performance Metrics

PyP6Xer supports earned value management (EVM) calculations by exposing cost-related fields such as target cost, actual costs, and physical completion percentages. Developers can compute key EVM metrics including Planned Value (PV), Earned Value (EV), Actual Cost (AC), Cost Performance Index (CPI), and Schedule Performance Index (SPI). This enables automated project performance reporting, trend analysis, and forecasting. Teams can integrate these metrics into dashboards, trigger alerts for cost overruns, and monitor project health across portfolios using standardized EVM methodologies directly within Python.