pydifact
Pydifact is a library that aims to provide complete support for reading and writing EDIFACT files. These file format, despite being old, is still a standard in many business cases. In Austria e.g., it is used for the transfer of medical reports between medical doctors.
Decision gist · record as of 2026-08-14
Yes, if you need to work with EDIFACT files in Python and can tolerate an Alpha-stage API. The library is actively maintained, has no dependencies, installs easily, and solves a real gap in the Python ecosystem. The main caveat is that the API is not yet stable—pin your version and test carefully before upgrading. If you need a production-hardened EDIFACT tool immediately, review the alternatives listed in the documentation first.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with a recent release; marked Alpha (Development Status 3) so the API may still shift.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute this library freely provided you include the license notice.
last release 2026-04-10 (126 days) · last repo commit 2026-08-05 · 190 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 236,781 downloads/mo, #8,976 on PyPI
Alternatives
Verify before relying
from pydifact.segmentcollection import Interchange
interchange = Interchange.from_str(
"UNA:+,? '"
"UNB+UNOC:1+1234+3333+200102:2212+42'"
"UNH+42z42+PAORES:93:1:IA'"
"MSG+1:45'"
"UNT+5+42z42'UNZ+2+42'"
)
for message in interchange.get_messages():
for segment in message.segments:
print(f"Segment tag: {segment.tag}")- Whether the Alpha status API instability poses a risk for production use in your context.
- Performance characteristics when parsing very large EDIFACT files (extended tests exist but results not published).
- Completeness of support for all UN/EDIFACT message types beyond the documented examples.
What it is and what it does
Pydifact is a Python port of a PHP EDIFACT library that lets you work with UN/EDIFACT interchange files—a decades-old but still widely used format for business document exchange, particularly in medical, logistics, and trading sectors. It provides three main workflows: parsing interchanges from files or strings into navigable message and segment objects; iterating directly over segments; and constructing new interchanges programmatically from scratch with custom segments.
The library handles the low-level syntax of EDIFACT (delimiters, segment markers, element separators) so you work with structured message objects instead of raw text. It has no external dependencies, installs quickly, and runs on modern Python versions. The codebase is actively maintained but still marked as Alpha, meaning the API may change—a trade-off to be aware of if you are locking this into production workflows.
Use it for
- Parse incoming EDIFACT purchase orders or invoices from trading partners into Python objects for validation or database import.
- Generate EDIFACT interchanges programmatically to send standardized EDI messages to external systems.
- Extract and transform specific segments from large EDIFACT files for reporting or data migration.
- Build EDI middleware that reads, validates, and re-serializes EDIFACT messages between legacy and modern systems.
- Integrate EDIFACT support into medical or logistics applications that must exchange documents with regulated partners.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to work with EDIFACT files in Python and can tolerate an Alpha-stage API.
The library is actively maintained, has no dependencies, installs easily, and solves a real gap in the Python ecosystem. The main caveat is that the API is not yet stable—pin your version and test carefully before upgrading. If you need a production-hardened EDIFACT tool immediately, review the alternatives listed in the documentation first.
Install
pydifact on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with a recent release; marked Alpha (Development Status 3) so the API may still shift.
Requires Python 3.10 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute this library freely provided you include the license notice.
Quickstart
from pydifact.segmentcollection import Interchange
interchange = Interchange.from_str(
"UNA:+,? '"
"UNB+UNOC:1+1234+3333+200102:2212+42'"
"UNH+42z42+PAORES:93:1:IA'"
"MSG+1:45'"
"UNT+5+42z42'UNZ+2+42'"
)
for message in interchange.get_messages():
for segment in message.segments:
print(f"Segment tag: {segment.tag}")
Verify before relying
- Whether the Alpha status API instability poses a risk for production use in your context.
- Performance characteristics when parsing very large EDIFACT files (extended tests exist but results not published).
- Completeness of support for all UN/EDIFACT message types beyond the documented examples.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 126 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 236,781 / month, #8,976 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Topic :: Software Development :: Libraries |
Evidence: pydifact-0.2.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “EDIFACT parser”
- pydifactPydifact parses and serializes UN/EDIFACT interchange files, allowing…
- ArpeggioArpeggio is a recursive descent parser with memoization that…
- parsyParsy is a parser combinator library that lets you build complex text…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also interchange · pyx12 · pycollada · phpserialize · vobject · avro-python3 · python-oxmsg · sendsafely · sarif-om · pydicom