pyreqif
Python library to read, edit, and repackage ReqIF documents (.reqif / .reqifz), the OMG standard commonly used to exchange requirements between manufacturer and supplier (e.g. automotive lastenheft).
This version is prepared per defect for reqif from VW.
In case you have another OEM file please contact me.
Two classes:
Reqif: a single.reqiffile. Reads each requirement (SPEC-OBJECT) with its text, and two configurable fields designed for the supplier workflow: comment (Kommentar Lieferant M, XHTML) and status (Status Lieferant M, enumerated). Allows editing them, exporting/importing via Excel (with a validation dropdown for the status, and images embedded in the cell if a resolver is provided), and detects images embedded in each requirement's text.Reqifz: a.reqifz(a zip with one or more.reqiffiles plus their attachments). Extracts to a working directory, exposes each.reqifas aReqif, and repackages everything back while keeping the attachments intact.
Installation
pip install pyreqifz
(the package name on PyPI is pyreqifz — pyreqif was already taken — but the module is still imported as pyreqif.)
Basic usage
from pyreqif import Reqifz
with Reqifz("lastenheft.reqifz") as pack:
for doc in pack:
print(doc, "->", len(doc), "requirements")
doc = pack.get(0) # or pack.get("file_name.reqif")
# read
req = doc.get("_a1b2c3...")
print(req.text, req.comment, req.status, req.images)
# edit (None leaves the field unchanged, "" clears it)
doc.update("_a1b2c3...", comment="Accepted, no changes.", status="akzeptiert")
# export to Excel, with the first image of each requirement
# embedded in its cell ("Image" column)
doc.to_excel("requirements.xlsx", image_resolver=pack.image_path)
# import back (only touches comment and status)
doc.update_from_excel("requirements_reviewed.xlsx")
# repackage with the changes
pack.save("lastenheft_edited.reqifz")
A standalone (uncompressed) .reqif is used the same way, without going through Reqifz (but then to_excel() can't embed images, since it doesn't know where the attachments are — pass your own image_resolver if you have them elsewhere):
from pyreqif import Reqif
doc = Reqif("document.reqif")
doc.update("_a1b2c3...", status="Klärungsbedarf")
doc.save("document_edited.reqif")
Attribute names
By default, the standard ReqIF names are used for the text (ReqIF.Text / ReqIF.ChapterName as fallback) and the field names for this specific supplier workflow (Kommentar Lieferant M / Status Lieferant M). If your document uses other names, create a subclass:
from pyreqif import Reqif
class MyReqif(Reqif):
COMMENT_ATTR = "Supplier Comment"
STATUS_ATTR = "Supplier Status"
Development
uv venv
uv pip install -e ".[dev]"
uv run pytest
GitHub
https://github.com/ErnestoAvedillo/pyreqif
Contact
Ernesto Avedillo Carretero — eavedillo@yahoo.es
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyreqifz-0.1.2.tar.gz.
File metadata
- Download URL: pyreqifz-0.1.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e38da075416c9d21657be026c1bb455f3f624b5adb7e023be0ed0a0d482ac255
|
|
| MD5 |
eec386611476e4a17732a1270d57afd0
|
|
| BLAKE2b-256 |
600dd268582c5bf79b8d3a2a27ec8da1e5d5b1ef0c86bba5aaf156c511ab7d8a
|
File details
Details for the file pyreqifz-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyreqifz-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ab073c31e6af0fa73e5439ce7f8fb21bf4c192eccade18ccd9ef88a56844f3c
|
|
| MD5 |
6914c9dae822686412190d3ec6f09afb
|
|
| BLAKE2b-256 |
ab6c156efb9822a5128cf63352648072bc1c1a0dcdff81fd807d0af690e57a52
|