STJLib
A Python library for the Standard Transcription JSON (STJ) format.
Overview
STJLib provides data classes and utilities for working with STJ files, which are used to represent transcribed audio and video data in a structured, machine-readable JSON format.
For more information about the STJ format, please refer to the STJ Specification.
Documentation
Full documentation is available at stjlib.readthedocs.io. This includes:
- Detailed API reference
- Usage examples
- Advanced usage guides
- Contributing guidelines
Features
- Full support for STJ format version 0.6.1
- Comprehensive validation system with severity levels (ERROR, WARNING, INFO)
- Time value precision handling with IEEE 754 round-to-nearest-even
- Strict language code validation (ISO 639-1/639-3)
- Support for zero-duration segments
- Word timing modes (complete, partial, none)
- Enhanced speaker and style validation
- Extensions field validation with reserved namespace protection
Quick Start
Installation
pip install stjlib
Basic Usage
from stjlib import StandardTranscriptionJSON
# Load and validate an existing STJ file
stj = StandardTranscriptionJSON.from_file('path/to/file.stjson', validate=True)
# Or create a new STJ document
stj = StandardTranscriptionJSON(version="0.6.1")
# Add transcriber information
stj.metadata.transcriber = {
"name": "TestTranscriber",
"version": "1.0"
}
# Add a simple segment
segment = {
"start": 0.0,
"end": 2.0,
"text": "Hello world"
}
stj.transcript.segments.append(segment)
# Save to file
stj.save('output.stjson')
# Access metadata and transcript data
print(stj.metadata)
print(stj.transcript)
For more examples and detailed usage instructions, please refer to our documentation.
File Format Support
STJLib supports the Standard Transcription JSON (STJ) format with the following file extensions:
- Primary (Recommended):
.stjson - Alternative:
.stj - Alternative:
.stj.json(systems supporting double extensions)
MIME Type: application/vnd.stj+json
Validation Features
- Severity levels: ERROR, WARNING, INFO
- Detailed location information in error messages
- Time value precision validation
- Language code validation (ISO 639-1/639-3)
- Segment ordering and overlap validation
- Speaker and style validation
- URI format validation
- Extensions validation with namespace protection
Development
Setting Up Development Environment
# Clone the repository
git clone https://github.com/yaniv-golan/stjlib.git
cd stjlib
# Install development dependencies
pip install -e .
pip install -r requirements-dev.txt
Running Tests
pytest
Releasing
Releases are automated via GitHub Actions and PyPI Trusted Publishing. See docs/internal/release-process.md for the exact steps (update changelog/version, tag vX.Y.Z, and push—CI handles the rest).
Building Documentation Locally
cd docs
make html
The documentation will be available in docs/build/html.
Contributing
We welcome contributions to stjlib! Please see our Contributing Guide for more details on how to get started.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
- For bugs and feature requests, please open an issue
- For other questions, start a GitHub Discussion
Metadata
Release files for stjlib 0.6.4
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 | Actions |
|---|---|---|---|---|
| stjlib-0.6.4.tar.gz | 50.1 kB | With provenance | Details for stjlib-0.6.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stjlib-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for stjlib-0.6.4-py3-none-any.whl |
Total release size: 91.1 kB
Release files / stjlib-0.6.4.tar.gz
| Download URL | stjlib-0.6.4.tar.gz |
|---|---|
| Size | 50.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7830eba65719fbd12ef305fdb64979d1865d84624149850db1eb476ad4e1cec8
|
|
BLAKE2b-256 checksum How to use checksums |
fa12af6714e6434cbfad33bf657de94bbbd5aa1c9f28647b9ede1ceffb7d60cd
|
| 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 Nov 15, 2025.
Transparency logRelease files / stjlib-0.6.4-py3-none-any.whl
| Download URL | stjlib-0.6.4-py3-none-any.whl |
|---|---|
| Size | 41.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85ee85bd889fb7623a4cef88152a65d8c770f60a6ecaa93f9681fa16f61d38a8
|
|
BLAKE2b-256 checksum How to use checksums |
b18208fafe56a022d65f8c771ab281117c7698d2a30a1efa2eec7b1a09d320c2
|
| 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 Nov 15, 2025.
Transparency logSecurity for stjlib 0.6.4
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.
Attestation for stjlib-0.6.4.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 Nov 15, 2025.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.