|
| 1 | +# `pyspssio` engine spike |
| 2 | + |
| 3 | +**Status:** investigated only; not a runtime dependency and not selected by the |
| 4 | +public adapter. |
| 5 | + |
| 6 | +This is a bounded technical spike for evaluating |
| 7 | +[`pyspssio`](https://pypi.org/project/pyspssio/) 0.5.1 as a future SPSS |
| 8 | +engine. The existing `pyreadstat` engine remains unchanged. |
| 9 | + |
| 10 | +## Environment and runtime result |
| 11 | + |
| 12 | +The probe used Python 3.12 and `pyspssio==0.5.1` in a local development |
| 13 | +virtual environment. The wheel includes IBM SPSS I/O Modules 28.0.1.0 native |
| 14 | +libraries for Linux, macOS and Windows. No installed IBM SPSS Statistics |
| 15 | +application was needed for the probe. |
| 16 | + |
| 17 | +A local round trip created both a `.sav` and a `.zsav`, then read each |
| 18 | +back. The following metadata survived in both files: |
| 19 | + |
| 20 | +- UTF-8 encoding, variable names and storage widths; |
| 21 | +- variable and value labels; |
| 22 | +- numeric user-missing values; |
| 23 | +- measurement levels, roles, alignments and display widths; |
| 24 | +- file attributes and variable attributes; |
| 25 | +- case-weight variable; |
| 26 | +- a dichotomous multiple-response set. |
| 27 | + |
| 28 | +The public API used was `read_metadata()`, `read_sav()` and |
| 29 | +`write_sav()`; it supports both `.sav` and `.zsav` according to the |
| 30 | +suffix. |
| 31 | + |
| 32 | +## Material limitations found |
| 33 | + |
| 34 | +This is not yet a complete-fidelity engine. |
| 35 | + |
| 36 | +1. **Variable sets did not round trip.** A `var_sets` definition supplied to |
| 37 | + `write_sav()` was absent from the metadata read back. The upstream source |
| 38 | + itself notes a dictionary-commit / 8-byte-compatible-name limitation for |
| 39 | + variable sets. |
| 40 | +2. **Print and write formats are not independently represented by the public |
| 41 | + API.** `Header.var_formats` reads the print format; its setter calls both |
| 42 | + `spssSetVarPrintFormat` and `spssSetVarWriteFormat` with the same value. |
| 43 | + An OpenStatSpec exporter must retain and restore the two formats separately. |
| 44 | +3. **No public document-text or file-label property was found** in |
| 45 | + `Header`. These must be added upstream or accessed through a supported |
| 46 | + lower-level binding before this engine can satisfy the full profile. |
| 47 | +4. The functional probe covers one modern Unicode file. It does not establish |
| 48 | + compatibility for legacy code-page SAV files, long-string edge cases, or |
| 49 | + arbitrary pre-existing SPSS files. |
| 50 | + |
| 51 | +## License and CI boundary |
| 52 | + |
| 53 | +The Python wrapper is MIT, but its wheel contains IBM I/O Modules under a |
| 54 | +separate IBM licence. In particular, the accompanying redistribution terms |
| 55 | +apply to the bundled native libraries and are not covered by this repository's |
| 56 | +Apache-2.0 licence. |
| 57 | + |
| 58 | +Therefore this spike intentionally: |
| 59 | + |
| 60 | +- does **not** add `pyspssio` to project dependencies; |
| 61 | +- does **not** run it in GitHub Actions; and |
| 62 | +- does **not** change adapter capability claims. |
| 63 | + |
| 64 | +Adopting it requires a maintainer licence/distribution review and an explicit |
| 65 | +optional-engine packaging decision. CI can then test it only on platforms and |
| 66 | +under terms approved for installing the bundled IBM modules. |
| 67 | + |
| 68 | +## Next implementation slice |
| 69 | + |
| 70 | +If approved after that review, add a private `PyspssioEngine` behind the |
| 71 | +existing engine boundary, initially with a hermetic SAV/ZSAV metadata fixture. |
| 72 | +Do not make it default until the implementation proves or deliberately reports |
| 73 | +each of these separately: file label/documents, variable sets, independent |
| 74 | +print/write formats, custom attributes, multiple-response sets, roles, |
| 75 | +alignment, display width and legacy encodings. |
0 commit comments