How sap-archive/pyrfc works
Based on your provided file tree and README, the project is a Python binding to the SAP NetWeaver RFC SDK. Its goal is to let Python code both call ABAP function modules and serve as a function provider for ABAP (client and server bindings). The repository serves as a low-level integration layer that abstracts SAP’s native RFC libraries (with some parts implemented in Cython for efficiency) so that Python applications can perform asynchronous, non-blocking RFC communications with SAP systems.
Main Components
• Client Module: This is the component that establishes and manages connections to SAP systems. It exposes methods (like “call”) for executing ABAP function modules. Look at examples such as ‘examples/clientIDoc.py’ and ‘examples/clientStfcStructure.py’ as they show typical client usage.
• Server Module: This module allows exposing Python functions to be called from an ABAP system. For example, you see the server components in ‘examples/server’ and server usage in the README.
• Binding/Wrapper Layer: Located in the “src/pyrfc” directory, this part includes the interfaces (including the Cython file _cyrfc.pyx and the C header definitions in csapnwrfc.pxd) that directly interact with the native SAP NW RFC SDK. Supporting modules like _exception.py and _utils.py handle error conversions and other utilities.
• Underlying Native Library Integration: The system depends on the SAP NetWeaver RFC SDK (a native dependency) – this must be clearly indicated as the foundation over which the Python layer is built.
• Build/Development Infrastructure: Configuration files (setup.py, pyproject.toml, MANIFEST.in) and tools (tox.ini for testing, Cython integration) should be indicated as auxiliary elements necessary for building, testing, and deployment.
Structure the Relationships and Interactions
• Next, illustrate the separation between the “Client” and “Server” components. The Client component (using “Connection” from pyrfc) issues RFC calls to SAP systems, while the Server component (using “Server” classes) exposes Python functionality to ABAP.
– From the Client component to the SAP system – indicating “ABAP function module calls”.
– From the SAP system to the Server component – indicating “function invocation by ABAP”.
• Optionally, include components for “Examples” and “Tests” to emphasize that these artifact directories validate and illustrate proper usage.
Architectural Patterns and Design Principles
• Layered Architecture: Clearly separate the native integration (SAP SDK), binding/wrapping (Cython interface), and higher-level Python API (client and server).
• Asynchronous, Non‑blocking Communication: Indicate that both client and server components are built to support non-blocking operations, a key architectural goal.
• Abstraction: Emphasize that the design abstracts SAP’s RFC calls into high-level API calls (e.g., Connection.call, Server.add_function).