ixbrl-parse
Introduction
- Python library code, parses iXBRL files.
- Script
ixbrl-dumpemits iXBRL tagged data in a semi-human-readable dump. - Script
ixbrl-reportemits iXBRL tagged data in a human-readable report. This involves downloading referenced XBRL schema to get the human-readable fact labels. - Script
ixbrl-to-rdfemits iXBRL tagged data in RDF. - Script
ixbrl-to-csvoutputs iXBRL tagged data in a CSV format. - Script
ixbrl-to-jsonemits iXBRL tagged data in JSON. - Script
ixbrl-to-xbrlemits iXBRL tagged data as an XBRL instance. - Script
ixbrl-to-kvemits iXBRL in a key-value form easily consumed by scripts. - Script
ixbrl-markdownemits iXBRL tagged data in a markdown report.
Sample data
There's a bunch of sample iXBRL files grabbed from various places in
the ixbrl directory: US 10-K and 10-Q filings, a few random things
from UK companies house, and a couple of sample ESEF filings. This is the
data I've tested with.
Also, accts.html is a sample file created using
gnucash-ixbrl.
Installation
From PyPI (when published)
pip install ixbrl-parse
From source
pip install git+https://github.com/cybermaggedon/ixbrl-parse
For development
git clone https://github.com/cybermaggedon/ixbrl-parse
cd ixbrl-parse
pip install -e ".[dev]"
The dev extra includes pytest and pytest-cov for running tests.
For markdown report support:
pip install ixbrl-parse[markdown]
Usage
Parse iXBRL and output in RDF (default n3 format):
ixbrl-to-rdf accts.html
Parse iXBRL and output in RDF/XML:
ixbrl-to-rdf accts.html --format xml
Parse iXBRL and output in CSV:
ixbrl-to-csv accts.html
Parse iXBRL and output in JSON:
ixbrl-to-json accts.html
Schema labels in JSON:
ixbrl-to-json ixbrl/10k/lyft-20201231.htm -f labeled \
-b https://www.sec.gov/Archives/edgar/data/1759509/000175950921000011/lyft-20201231.htm
Dump iXBRL values:
ixbrl-dump accts.html
Human-readable report:
ixbrl-report accts.html
Human-readable report from SEC EDGAR. Note need to tell ixbrl-report the URL of the original report in order to know where to fetch the custom schema (relative URLs are used):
ixbrl-report ixbrl/10k/lyft-20201231.htm \
-b https://www.sec.gov/Archives/edgar/data/1759509/000175950921000011/lyft-20201231.htm
Dump iXBRL as XBRL:
ixbrl-to-xbrl accts.html
API
You can use the library directly in your Python code:
from lxml import etree as ET
from ixbrl_parse.ixbrl import parse
# Parse an iXBRL file
tree = ET.parse('accts.html')
ixbrl = parse(tree)
# Get data in various formats
data_dict = ixbrl.to_dict()
flat_data = ixbrl.flatten()
rdf_triples = ixbrl.get_triples()
# Access contexts and values
for context in ixbrl.contexts.values():
print(context.entity, context.period)
for value in ixbrl.values.values():
print(value.name, value.to_value())
See the CLI implementations in ixbrl_parse/cli.py for more examples.
Development
Running Tests
The project includes a comprehensive pytest test suite:
# Run all tests
pytest
# Run with coverage
pytest --cov=ixbrl_parse --cov-report=term-missing
# Run specific test file
pytest tests/test_ixbrl.py -v
See tests/README.md for more details on the test suite.
Building
The project uses modern Python packaging with pyproject.toml:
# Build wheel and source distribution
python -m build
# Install in development mode
pip install -e .
What next?
This loads into a Redland RDF sqlite3 store:
ixbrl-to-rdf -i accts.html -f ntriples > accts.ntriples
rdfproc -n -s sqlite accts.db parse accts.ntriples ntriples
rdfproc -s sqlite accts.db print | head
I run a SPARQL store across the data, and view it with LodLive.
Metadata
Release files for ixbrl-parse 0.11.0
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 |
|---|---|---|---|---|
| ixbrl_parse-0.11.0.tar.gz | 36.9 kB | Without provenance | Details for ixbrl_parse-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ixbrl_parse-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for ixbrl_parse-0.11.0-py3-none-any.whl |
Total release size: 69.9 kB
Release files / ixbrl_parse-0.11.0.tar.gz
| Download URL | ixbrl_parse-0.11.0.tar.gz |
|---|---|
| Size | 36.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ad004617fb41156b091484c5e5388a216cc6d1a1928c8999f0916deab313052
|
|
BLAKE2b-256 checksum How to use checksums |
e798b8e734723b2e310727cf14dac6d5e909eaaf6b58777c99824456e4230310
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / ixbrl_parse-0.11.0-py3-none-any.whl
| Download URL | ixbrl_parse-0.11.0-py3-none-any.whl |
|---|---|
| Size | 32.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45da75b2586da7b4f7a0212fff4b39040f71dd529b55f3d14a407f2526536abc
|
|
BLAKE2b-256 checksum How to use checksums |
cdddda2aebd9fc88797c8846721db2c46e7d2fd55e39356cf6ad04287a74323f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for ixbrl-parse 0.11.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.