Skip to main content

mspdi

Read and write Microsoft Project XML (MSPDI) in pure Python, standard library only. Plans load into plain dataclasses (project, tasks, links, resources, assignments, calendars) and write back with the element order Microsoft Project requires.

Used by the free resource-leveling scheduler at https://gantt.kindoflost.com

Install

pip install mspdi

Python 3.9+. No dependencies.

Example

import mspdi

project = mspdi.read("plan.xml")            # File > Save As > XML Format in MS Project
for t in project.tasks:
    if not t.summary:
        print(t.uid, t.name, t.start, t.duration_minutes / project.minutes_per_day, "days")
        for link in t.links:                 # stored on the successor
            print("   after", link.pred_uid, link.type, link.lag_minutes, "min lag")

task = project.task(5)
task.constraint_type = mspdi.SNET           # Start no earlier than...
task.constraint_date = task.start
mspdi.write(project, "out.xml")             # summaries, FinishDate, IDs repaired for you

# edit a real export WITHOUT losing anything the model does not carry:
patched = mspdi.patch.patch_schedule(open("plan.xml", "rb").read(), {5: (start, finish)}, snet=[5])

What the gotchas are (and where they live in the code)

  • MSPDI is an ordered xsd:sequence. Project silently drops an out-of-order element and still opens cleanly. ConstraintDate follows CalendarUID; PredecessorLink is last.
  • Link Type: 0=FF, 1=FS, 2=SF, 3=SS. LinkLag and LevelingDelay are tenths of a minute; LevelingDelay is elapsed time and needs LevelingDelayFormat present.
  • UID is identity, ID is row position. Milestones are 17:00 on both ends. Summary durations are the working-day span of their children.
  • Project recomputes the schedule on open: a date only sticks if you write a constraint.

See the docstrings in mspdi/writer.py and mspdi/patch.py.

Limitations

  • Pure parser/writer: no scheduling engine. It does not compute dates, critical paths or leveling.
  • write() builds a fresh file from the model: custom fields, baselines, notes on tasks beyond Notes, extended attributes, and unmodelled elements are NOT kept. Use mspdi.patch to edit a real export in place.
  • Calendars: base-calendar weekdays/working times and dated exceptions are read. Exception writing follows the published schema but has not been verified in real Microsoft Project. Resource and task calendars are read as UIDs only and not interpreted.
  • Not written: percent complete beyond PercentComplete, baselines, costs, splits, recurring tasks, effort-driven scheduling, material/cost resources' rates.
  • Element order and unit behaviour were measured against Microsoft Project 2010-era exports and one hands-on session in a current Project; other versions are untested. Not affiliated with Microsoft. .mpp and .xer are not supported (save as XML first).
  • Dates are naive local times, exactly as MSPDI stores them.

License

MIT. Copyright (c) 2026 Mario (Kind of Lost).

Metadata

Release files for mspdi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mspdi 0.1.0
File Size Uploaded Provenance Actions
mspdi-0.1.0.tar.gz 19.9 kB Without provenance Details for mspdi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mspdi 0.1.0
File Interpreter ABI Platform Actions
mspdi-0.1.0-py3-none-any.whl Python 3 none any Details for mspdi-0.1.0-py3-none-any.whl

Total release size: 39.0 kB

Release files / mspdi-0.1.0.tar.gz

Download URL mspdi-0.1.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8c893f7ac4c5ebcca6d3f27d1d424bc4bd8cd99e80a7def2359ff375fcb11df0
BLAKE2b-256 checksum
How to use checksums
69cc64fd66107391da474f5947b2b19f99e90141d8234b3bfff4cc8b774670ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.5

Release files / mspdi-0.1.0-py3-none-any.whl

Download URL mspdi-0.1.0-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe0abaceb39a4adc6389d30349f86477995a2b7bd59a74d5dbc6a9a6be3f1a47
BLAKE2b-256 checksum
How to use checksums
6af3bd2f4645abf188b0e88b52bd3f710c5b340664a69fb034b0ebc999cc9c4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.5

Security for mspdi 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page