Skip to main content

A python module for getting useful data out of ixbrl files.

Project description

ixbrl-parse

Test status PyPI version PyPI - Python Version PyPI - License Documentation Status

A python module for getting useful data out of iXBRL™ and XBRL™ files. The library is at an early stage - feedback and improvements are very welcome.

Full documentation is available at ixbrl-parse.readthedocs.io

For more about the iXBRL™ and XBRL™ standards, see the specification site and XBRL International. This tool is not affiliated with XBRL International.

Changelog

Requirements

The module requires BeautifulSoup and lxml to parse the documents.

If you're using Python 3.13 you may need to ensure that the libxml2-dev and libxslt-dev packages have been installed.

word2number is used to process the numeric items with the numsenwords format.

How to install

You can install from pypi using pip:

pip install ixbrlparse

How to use

You can run the module directly to extract data from an iXBRL™ file.

ixbrlparse example_file.html
# or
python -m ixbrlparse example_file.html

While primarily designed for iXBRL™ files, the parser should also work for XBRL™ files.

The various options for using this can be found through:

python -m ixbrlparse -h
# optional arguments:
#   -h, --help            show this help message and exit
#   --outfile OUTFILE     Where to output the file
#   --format {csv,json,jsonlines,jsonl}
#                         format of the output
#   --fields {numeric,nonnumeric,all}
#                         Which fields to output

You can also use as a python module (see the documentation for more details)

Development

The module is setup for development using hatch. It should be possible to run tests and linting without needed hatch, however.

Run tests

Tests can be run with pytest:

hatch run test

Without hatch, you'll need to run:

pip install -e .[test]
python -m pytest tests

Test coverage

Run tests then report on coverage

hatch run cov

Without hatch, you'll need to run:

pip install -e .[test]
coverage run -m pytest tests
coverage report

Run tests then run a server showing where coverage is missing

hatch run cov-html

Without hatch, you'll need to run:

pip install -e .[test]
coverage run -m pytest tests
coverage report
coverage html
python -m http.server -d htmlcov

Run typing checks

hatch run lint:typing

Without hatch, you'll need to run:

pip install -e .[lint]
mypy --install-types --non-interactive src/ixbrlparse tests

Linting

Ruff should be run before committing any changes.

To check for any changes needed:

hatch run lint:style

Without hatch, you'll need to run:

pip install -e .[lint]
ruff check .
ruff format --check --diff .

To run any autoformatting possible:

hatch run lint:fmt

Without hatch, you'll need to run:

pip install -e .[lint]
ruff format .
ruff check --fix .

Run all checks at once

hatch run lint:all

Without hatch, you'll need to run:

pip install -e .[lint]
ruff check .
ruff format --check --diff .
mypy --install-types --non-interactive src/ixbrlparse tests

Publish to pypi

hatch build
hatch publish
git tag v<VERSION_NUMBER>
git push origin v<VERSION_NUMBER>

Acknowledgements

Developed by David Kane of Kane Data Ltd

Originally developed for a project with Power to Change looking at how to extract data from financial documents of community businesses.

Thanks to the following users for their contributions:

XBRL™ and iXBRL™ are trademarks of XBRL International, Inc. All rights reserved.

The XBRL™ standards are open and freely licensed by way of the XBRL International License Agreement. Our use of these trademarks is permitted by XBRL International in accordance with the XBRL International Trademark Policy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ixbrlparse-0.11.2.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ixbrlparse-0.11.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file ixbrlparse-0.11.2.tar.gz.

File metadata

  • Download URL: ixbrlparse-0.11.2.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ixbrlparse-0.11.2.tar.gz
Algorithm Hash digest
SHA256 926b27bdaf7b2be243949eadc14ec405a16e7672cbf043c4e4e6b6771c1687c5
MD5 8062e058374910ad453146f7a2963b5c
BLAKE2b-256 3405a4b29504cec1b617ed9f662f35999f38458dc5733f76500056fb59dfa95f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ixbrlparse-0.11.2.tar.gz:

Publisher: publish.yml on kanedata/ixbrl-parse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ixbrlparse-0.11.2-py3-none-any.whl.

File metadata

  • Download URL: ixbrlparse-0.11.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ixbrlparse-0.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 675426f82b91a8ff99977fccf87702d0e97c3e419d21116da96e9907c6e325ed
MD5 752748989551feff12ee430e836ca074
BLAKE2b-256 4df400f972ec7d168d457986fd4b9fb6c46cf103401bccddce91c94980a5b0cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ixbrlparse-0.11.2-py3-none-any.whl:

Publisher: publish.yml on kanedata/ixbrl-parse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page