Skip to main content

SELlib

Read and write the file formats an SEL protective relay project is made of — the ones AcSELerator QuickSet produces.

Nothing here talks to a relay, opens a socket, or knows what a web request is.

Renamed. This library was published as selfiles for 1.x. From 2.0.0 it is SELlib, and the import moved with it — import sellib, not import selfiles. Nothing else changed in 2.0.0; the major is the rename. The selfiles distribution has been removed from PyPI, so there is no version of it left to install: import selfiles does not resolve to anything, and a requirements file naming it will fail rather than quietly install something older.

import sellib
from sellib.rdb import process_upload
from sellib.dnp_map import parse, discover

sellib.configure(user_data_dir="~/.pacct/data", cache_dir="/var/cache/rdb")

info = process_upload(open("substation.rdb", "rb").read(), "substation.rdb")
for relay in info.relays:
    print(relay.name, relay.model, relay.ip)
module what it reads
sellib.rdb, .rdb_cache the RDB (an OLE compound database): relays, models, addresses, extracted into a content-addressed cache
sellib.settings SET_*.TXT relay settings
sellib.dnp_map SET_D<n>.TXT, the DNP3 point map
sellib.gle QuickSet logic diagrams — parse, and render a page to SVG
sellib.selogic SELOGIC equations: parse, compare by equivalence, normalise settings
sellib.models per-model registries: block conventions, and valid Relay Word names
sellib.scl what an SCL/SCD holds that is SEL's: the sAddr db: grammar, GOOSE health bits, the bit → MMS item tables. The standard half is py61850
sellib.match cross-match an RDB's relays against an SCD's IEDs
sellib.dnp_profile SEL DNP3 device profile bundles

The one contract to know about

sellib.dnp_map guarantees parse(b).serialize() == b, byte for byte, for every SET_D in the reference corpus. These bytes go back into a protection relay: a settings file that round-trips imperfectly is a relay that behaves in a way nobody asked for. The 0x1C field separator lives inside the line, before the CRLF, and is preserved literally, along with each model's own index padding (BI_1 on a 411L, BI_00 on a 751).

Writing a Compound File back out — needed whenever an edit grows a stream — is cfbwrite, a separate library.

What is not here

Reading an SCL file as an IEC 61850-6 object model — the document, the DataTypeTemplates pool, the Communication section, a per-IED tree of logical nodes, datasets, control blocks and ExtRefs — is py61850, which sellib depends on. None of that is SEL's, and a Siemens or GE file needs exactly the same reader.

What stayed here is what only SEL writes: the db: grammar inside the standard sAddr attribute, and the pubRxStatus health bit inside a <Private> block. Both are read off py61850 model nodes, so the two libraries never parse one file twice and cannot come to disagree about it.

Data

The per-model registries ship with the package. configure(user_data_dir=...) adds an overlay searched first, per model, so a host can add a relay model at runtime without shipping a new release and without repeating the rest.

Install

pip install sellib

Python 3.10+, and py61850 for the standard half of an SCL file. Extracted from PAC CT, where all of it is exercised against a real substation corpus.

Licence

AGPL-3.0-or-later — see LICENSE.

Metadata

Release files for SELlib 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SELlib 3.0.1
File Size Uploaded Provenance Actions
sellib-3.0.1.tar.gz 301.5 kB With provenance Details for sellib-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SELlib 3.0.1
File Interpreter ABI Platform Actions
sellib-3.0.1-py3-none-any.whl Python 3 none any Details for sellib-3.0.1-py3-none-any.whl

Total release size: 578.6 kB

Release files / sellib-3.0.1.tar.gz

Download URL sellib-3.0.1.tar.gz
Size 301.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8b377fd6d3a096ab1c8e22ef4234d71f5470dfeff038a1019f78dfc8284e6891
BLAKE2b-256 checksum
How to use checksums
e36ad758ce9742ed89714d76af128d5166b74170e175ed8333772edecfd11dfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

Release files / sellib-3.0.1-py3-none-any.whl

Download URL sellib-3.0.1-py3-none-any.whl
Size 277.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fde1f45af499bfc7252cf6609fdafa7c089e1d0776b72ea3452be58c9b9904ee
BLAKE2b-256 checksum
How to use checksums
b9ae56491be1d985767ea0a9bba2b37192ddf68755777f13165584f0d3b5c349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

Security for SELlib 3.0.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sellib-3.0.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 Sep 8, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page