Metadata-Version: 2.4
Name: ukaea-multiparser
Version: 1.0.5
Summary: Multiple File Parser for monitoring and processing updates to a given set of output files.
Author-email: Kristian Zarębski <kristian.zarebski@ukaea.uk>
License: MIT
License-File: LICENSE
Keywords: logging,monitoring,parsing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: <4.0,>=3.10
Requires-Dist: flatdict>=4.0.1
Requires-Dist: loguru>=0.7.3
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: toml>=0.10.2
Provides-Extra: arrow
Requires-Dist: pandas>=2.2.3; extra == 'arrow'
Requires-Dist: pyarrow>=20.0.0; extra == 'arrow'
Requires-Dist: tables>=3.10.1; extra == 'arrow'
Provides-Extra: fortran
Requires-Dist: f90nml>=1.4.5; extra == 'fortran'
Description-Content-Type: text/markdown

<p align="center">
<img src="https://raw.githubusercontent.com/ukaea/Multiparser/main/docs/media/logo.png", width="200">
</p>

# Multiparser
[![PyPI Latest Release](https://img.shields.io/pypi/v/ukaea-multiparser.svg)](https://pypi.org/project/ukaea-multiparser/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ukaea-multiparser)
 [![multiparser](https://github.com/ukaea/multiparser/actions/workflows/test_run_multiparser.yaml/badge.svg?branch=main)](https://github.com/ukaea/multiparser/actions/workflows/test_run_multiparser.yaml)
 [![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/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:

```sh
pip install ukaea-multiparser
```

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

```sh
pip install ukaea-multiparser[fortran,arrow]
```

## Example

```python
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](https://ukaea.github.io/Multiparser/).

## 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](https://github.com/ukaea/Multiparser/blob/main/CONTRIBUTING.md) file.

---

Copyright (c) 2024 UK Atomic Energy Authority
