Skip to main content

Multiple File Parser for monitoring and processing updates to a given set of output files.

Project description

Multiparser

PyPI Latest Release PyPI - Python Version multiparser Code style: ruff

Multiparser is module for performing functionality across a set of output files. Given a set of files, and optionally a list of output parameter names or regex filters the module keeps track of changes by monitoring the "last modified" timestamp of each file and executing the assigned callback.

For example, in the case where a set of model outputs were written to a set of files the user is able to specify which files are of importance, the variables to be noted within these files, and a function to execute whenever a change is made to one of these files.

Installation

The module is available in PyPi:

pip install ukaea-multiparser

To install optional extras arrow and fortran list them during the install, e.g.:

pip install ukaea-multiparser[fortran,arrow]

Example

with FileMonitor(
    per_thread_callback=callback_function,
    lock_callback=True,
    interval=10.0,
    flatten_data=True
) as monitor:
    monitor.track(
        path_glob_exprs=["file_of_interest.toml", "out_dir/*.other"],
        tracked_values=[
            "list", "of", "interesting", "values",
            re.compile(r"^list"),
            re.compile(r"of\s"),
            re.compile(r"regular"),
            re.compile(r"Expressions")
        ],
        static=True
    )
    monitor.run()
    ...
    monitor.terminate()

Documentation

For information on use and functionality please see the documentation.

Licensing

Multiparser is provided under the MIT license allowing reuse within both open source and proprietary software.

Contributing

For contributions and development towards improving Multiparser please see the included CONTRIBUTING.md file.


Copyright (c) 2024 UK Atomic Energy Authority

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

ukaea_multiparser-1.0.4.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

ukaea_multiparser-1.0.4-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file ukaea_multiparser-1.0.4.tar.gz.

File metadata

  • Download URL: ukaea_multiparser-1.0.4.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ukaea_multiparser-1.0.4.tar.gz
Algorithm Hash digest
SHA256 fbcd0c1c73095be202be5371af12056f5349b09a3a68577ec4e194f308d471e5
MD5 1816bfa89905e9cd76be55e0ec69d64a
BLAKE2b-256 1f48a3943a88b3faa4dfda359223c52cd9128098d1b5fff6b2f6d93da445803c

See more details on using hashes here.

File details

Details for the file ukaea_multiparser-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for ukaea_multiparser-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4b467c94116d25d26dff083d801f32bf696781a0d47beebad9fb277dcb954692
MD5 a7ee6d9f5fb4a0157284a1979491d314
BLAKE2b-256 2648e079a5f2399a55ab2c197dca05b0112c3f8a0eca452b70c22fbb2d618e7c

See more details on using hashes here.

Supported by

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