Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/test-python-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
- name: Install python library
run: |
cd post-processing
python -m pip install --upgrade pip
python -m pip install -r post-processing/requirements.txt
python -m pip install .
python -m pip install .[dev]
- name: Run unit tests
run: |
python -m unittest discover -s post-processing
- name: Type check with mypy
run: |
python -m mypy post-processing
python -m mypy post-processing/vernier
python -m mypy post-processing/tests
- name: Run CLI tools
run: |
cd post-processing/tools
./summarise_vernier.py vernier-output-example-collated
summarise-vernier post-processing/vernier/tools/vernier-output-example-collated
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,4 @@ documentation/Sphinx/doxylog

# Python junk
__pycache__/
*.egg-info
23 changes: 23 additions & 0 deletions post-processing/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[build-system]
requires = ['setuptools']
build-backend = 'setuptools.build_meta'

[project]
name = "Vernier"
description = "Python post-processing library for Vernier profiling tool"
license = {file = 'LICENSE'}
requires-python = '>=3.9'
dependencies = ['numpy']
version = '0.4.0'

[project.optional-dependencies]
dev = ['mypy']

[project.scripts]
summarise-vernier = 'vernier.tools.summarise_vernier:main'

[project.urls]
homepage = 'https://github.com/MetOffice/Vernier'
documentation = 'https://MetOffice.github.io/Vernier'
repository = 'https://github.com/MetOffice/Vernier'

2 changes: 0 additions & 2 deletions post-processing/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion post-processing/tests/test_cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def setUp(self):
"""
Initialise useful attributes for testing.
"""
self.tools_dir = Path(__file__).parent.parent / 'tools'
self.tools_dir = Path(__file__).parent.parent / 'vernier' / 'tools'
self.test_data_dir = Path(__file__).parent / 'data'
# pylint: disable=line-too-long
self.test_data_kgo = (
Expand Down
2 changes: 1 addition & 1 deletion post-processing/tests/test_vernier_calliper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# pylint: disable=wrong-import-position
sys.path.append(str(Path(__file__).parent.parent))
from vernier.vernier_data import VernierCalliper
from vernier.lib.vernier_data import VernierCalliper


class TestVernierCalliper(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion post-processing/tests/test_vernier_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# pylint: disable=wrong-import-position
sys.path.append(str(Path(__file__).parent.parent))
from vernier.vernier_reader import VernierReader
from vernier.lib.vernier_reader import VernierReader


class TestVernierReader(unittest.TestCase):
Expand Down
8 changes: 4 additions & 4 deletions post-processing/vernier/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from vernier.vernier_data import VernierData
from vernier.vernier_data import VernierCalliper
from vernier.vernier_data import VernierDataCollation
from vernier.vernier_reader import VernierReader
from vernier.lib.vernier_data import VernierData
from vernier.lib.vernier_data import VernierCalliper
from vernier.lib.vernier_data import VernierDataCollation
from vernier.lib.vernier_reader import VernierReader

__all__ = [
"VernierCalliper",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def filter(self, calliper_keys: list[str]):

:returns: A new VernierData object containing only the
filtered callipers.
:rtype: :py:class:`vernier.VernierData`
:rtype: :py:class:`vernier.lib.vernierData`

:raises ValueError: if no callipers are found that match calliper_keys.

Expand Down Expand Up @@ -286,15 +286,15 @@ def aggregate(self, vernier_data_list=None, internal_consistency=True):
objects.

:param vernier_data_list: A list of VernierData objects to combine.
:type vernier_datalist: list[:py:class:`vernier.VernierData`]
:type vernier_datalist: list[:py:class:`vernier.lib.vernierData`]

:param bool internal_conistency: If set to True (default), callipers
between all items in the
vernier_data_list must be identical.

:returns: A single VernierData object containing the data from all
VernierData objects in vernier_data_list.
:rtype: :py:class:`vernier.VernierData`
:rtype: :py:class:`vernier.lib.vernierData`

:raises ValueError: if internal_consistency is set to True and callipers
between items in vernier_data_list are not
Expand Down Expand Up @@ -449,7 +449,7 @@ def get(self, calliper_key: str, rank: Optional[int] = None, thread: Optional[in

:returns: A VernierCalliper instance containing the data of all
callipers matching the calliper_key
:rtype: :py:class:`vernier.VernierCalliper`
:rtype: :py:class:`vernier.lib.vernierCalliper`

"""
if calliper_key not in self.calliper_list():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from concurrent import futures
from pathlib import Path
import os
from vernier.vernier_data import VernierData
from vernier.lib.vernier_data import VernierData


class VernierReader():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ def process_args():
return parser.parse_args()


if __name__ == "__main__":

def main():
"""
Main function to process Vernier output and generate summary.
"""
args = process_args()
timers = VernierReader(args.vernier_output).load()
timers.write_txt_output()


if __name__ == "__main__":
main()
Loading