aplwin-sf
Read APL+Win component files (.sf) from Python.
APL+Win stores source code and data in a proprietary binary format called
"component files" (file extension .sf). This library parses them and decodes
APL+Win's character encoding to Unicode, producing readable UTF-8 text.
Installation
pip install aplwin-sf
Quick start
Python API
from aplwin_sf import read_functions
for fn in read_functions("myfuncs.sf"):
print(fn.name, len(fn.text), "chars")
from aplwin_sf import decode
raw = b"\x95IO\x061"
print(decode(raw)) # ⎕IO←1
Command line
# Print all functions to stdout
aplwin-sf myfuncs.sf
# Extract a directory of .sf files to .apl text files
aplwin-sf /path/to/sf/files/ -o apl_source/
What it does
-
Parses the binary
.sfformat — scans for function-text sub-objects by looking for the∇(del) marker that begins every APL function definition. -
Decodes APL+Win's character encoding — a single-byte encoding based on Code Page 437 with APL symbol overlays. Maps bytes like
0x95→⎕,0x06→←,0xE2→⍳, etc. -
Extracts function metadata — parses function names from headers, handling niladic, monadic, and dyadic forms.
API
read_functions(source) → list[Function]
Extract all APL functions from a .sf file.
source— a file path (strorPath) or rawbytes- Returns a list of
Function(name, text, offset, raw)objects
read_file(source) → ComponentFile
Read a .sf file and return a ComponentFile(path, functions, size).
decode(data: bytes) → str
Decode APL+Win encoded bytes to a Unicode string.
APL_MAP: dict[int, str]
The complete byte → Unicode character mapping table.
Background
APL+Win is a commercial APL implementation for Windows, originally by
Manugistics (now APL2000/Cognizant). It stores APL objects — functions,
variables, arrays — in "component files" with the .sf extension.
These files use a proprietary binary format with no public documentation.
This library was developed by reverse-engineering the format from real .sf
files, with the character encoding cross-referenced against the ∆AV table
from Dyalog's aplwincfs project.
Character encoding notes
APL+Win's file encoding is not the same as the ⎕AV (atomic vector)
mapping. The ⎕AV maps logical character positions; the file encoding maps
raw byte values from the APL+Win font/codepage. For example:
| Byte | File encoding | Dyalog ∆AV |
|---|---|---|
| 0x86 | ⍴ (rho) |
≠ |
| 0x8D | ↓ (drop) |
⌈ |
| 0x8F | × (times) |
⌊ |
| 0xE8 | ⌊ (floor) |
⌽ |
| 0xFD | ⌈ (ceiling) |
¯ |
The file encoding in this library was validated against actual APL source
code in context (e.g., 10× must be "ten times", not "ten floor").
License
MIT
Metadata
Release files for aplwin-sf 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aplwin_sf-0.1.1.tar.gz | 21.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aplwin_sf-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / aplwin_sf-0.1.1.tar.gz
| Download URL | aplwin_sf-0.1.1.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97b3bee6a7151fedef65290b695255f4cd4c5e41c49b310a65c4e49cdad52b8a
|
|
BLAKE2b-256 checksum How to use checksums |
137cf0b1c9f69179ba111e474fd0b02f96404632b56607f14a190dd91695053d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logRelease files / aplwin_sf-0.1.1-py3-none-any.whl
| Download URL | aplwin_sf-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5f1e9e8bf06c8e02b02ef68d662db2e05dc5b4f3552e3f0e2d2f0879e340021
|
|
BLAKE2b-256 checksum How to use checksums |
2e3a0f18b35dfe5e2eaefa2e885e452381ee6e247c33bbb5f4807b54766641ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logSecurity for aplwin-sf 0.1.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for aplwin_sf-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 13, 2026.
Transparency logA 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.