New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

quick-xmltodict

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quick-xmltodict

Efficient XML-to-dict conversion backed by Rust

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

quick-xmltodict

Efficient XML-to-dict conversion backed by Rust.

>>> from quick_xmltodict import parse

>>> xml = """
... <movies>
...     <movie>
...         <title>Her</title>
...         <director>Spike Jonze</director>
...         <year>2013</year>
...         <genre>Science Fiction, Drama, Romance</genre>
...     </movie>
...     <movie>
...         <title>Encanto</title>
...         <director>Byron Howard, Jared Bush</director>
...         <year>2021</year>
...         <genre>Animation, Family, Fantasy</genre>
...     </movie>
... </movies>
... """

>>> parse(xml)

{'movies': {'movie': [{'director': 'Spike Jonze',
                       'genre': 'Science Fiction, Drama, Romance',
                       'title': 'Her',
                       'year': '2013'},
                      {'director': 'Byron Howard, Jared Bush',
                       'genre': 'Animation, Family, Fantasy',
                       'title': 'Encanto',
                       'year': '2021'}]}}

Features

quick-xmltodict is a Rust-backed XML-to-dict conversion package designed to be fast and efficient. It has a single function, parse, that takes an XML string and returns a Python dictionary. You should be able to use this function as a drop-in replacement for the xmltodict.parse function from the original xmltodict package (used without any extra arguments). Like xmltodict, quick-xmltodict follows this schema for converting XML to JSON.

quick-xmltodict currently does not support namespace expansion, or the reverse operation (dict-to-XML conversion). For these features, use the original xmltodict package.

Performance

Since xmltodict uses the non-validating C-based expat parser from Python's standard library, it is already very fast. quick-xmltodict is nonetheless about 2-5 times faster than xmltodict.

Contributing

PRs are very welcome! Please make sure to run the tests before submitting a PR.

Development

This project uses Poetry to manage the environment and Python dependencies, so you'll need to have it installed in addition to Python and Rust.

To install the development environment and run the test suite:

poetry install
poetry run maturin develop
poetry run pytest

Be sure to run poetry run maturin develop after making changes to the Rust code. Add the -r flag for a release build (for example, if you want to run benchmarks).

It's recommended to install the pre-commit hooks:

poetry run pre-commit install

This ensures that linting and formatting are run automatically on every commit.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc