From 0b2c7f7fbb1aff50cc1126e7a92abbc62d73ed72 Mon Sep 17 00:00:00 2001 From: "Jose M. Pizarro" <112697669+JosePizarro3@users.noreply.github.com> Date: Mon, 10 Jun 2024 11:18:37 +0200 Subject: [PATCH] Hotfixes coverage (#18) * Fixing pipeline and README * Moved utils to its own folder Fixed imports --- .github/workflows/actions.yml | 1 + README.md | 2 +- src/pyssmf/hopping_pruning.py | 2 +- src/pyssmf/parsing.py | 4 ++-- src/pyssmf/runner.py | 12 ++++++------ src/pyssmf/tb_hamiltonian.py | 3 ++- src/pyssmf/utils/__init__.py | 17 +++++++++++++++++ src/pyssmf/{ => utils}/utils.py | 0 src/pyssmf/visualization.py | 1 - 9 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 src/pyssmf/utils/__init__.py rename src/pyssmf/{ => utils}/utils.py (100%) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index eec681a..1aea2b6 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -21,6 +21,7 @@ jobs: - name: Install dependencies run: | pip install uv + uv pip install coveralls --system uv pip install '.[dev]' --system - name: mypy run: | diff --git a/README.md b/README.md index 5006e71..bfd96d2 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Our CI/CD pipeline produces a more comprehensive test report using `coverage` an ```sh uv pip install coverage coveralls -python -m pytest --cov=src tests +python -m pytest --cov=src tests ``` ### Run linting and auto-formatting diff --git a/src/pyssmf/hopping_pruning.py b/src/pyssmf/hopping_pruning.py index 51486c2..52dc715 100644 --- a/src/pyssmf/hopping_pruning.py +++ b/src/pyssmf/hopping_pruning.py @@ -17,7 +17,7 @@ import numpy as np import logging -from .schema import Model +from pyssmf.schema import Model class Pruner: diff --git a/src/pyssmf/parsing.py b/src/pyssmf/parsing.py index f70fda2..caba1ac 100644 --- a/src/pyssmf/parsing.py +++ b/src/pyssmf/parsing.py @@ -23,8 +23,8 @@ from nomad.units import ureg # NOMAD schema -from .schema import System, BravaisLattice, Model -from .utils import get_files +from pyssmf.schema import System, BravaisLattice, Model +from pyssmf.utils import get_files re_n = r'[\n\r]' diff --git a/src/pyssmf/runner.py b/src/pyssmf/runner.py index 2036442..bb75baf 100644 --- a/src/pyssmf/runner.py +++ b/src/pyssmf/runner.py @@ -18,12 +18,12 @@ import os from scipy.stats import norm -from .input import ValidLatticeModels -from .schema import Model -from .parsing import MinimalWannier90Parser, ToyModels -from .hopping_pruning import Pruner -from .tb_hamiltonian import TBHamiltonian -from .visualization import plot_hopping_matrices, plot_band_structure, plot_dos +from pyssmf.input import ValidLatticeModels +from pyssmf.schema import Model +from pyssmf.parsing import MinimalWannier90Parser, ToyModels +from pyssmf.hopping_pruning import Pruner +from pyssmf.tb_hamiltonian import TBHamiltonian +from pyssmf.visualization import plot_hopping_matrices, plot_band_structure, plot_dos class Runner(ValidLatticeModels): diff --git a/src/pyssmf/tb_hamiltonian.py b/src/pyssmf/tb_hamiltonian.py index f9b8191..fd703e8 100644 --- a/src/pyssmf/tb_hamiltonian.py +++ b/src/pyssmf/tb_hamiltonian.py @@ -22,7 +22,8 @@ from nomad.atomutils import Formula from nomad.units import ureg -from .schema import Model + +from pyssmf.schema import Model class KSampling: diff --git a/src/pyssmf/utils/__init__.py b/src/pyssmf/utils/__init__.py new file mode 100644 index 0000000..b9bdc0e --- /dev/null +++ b/src/pyssmf/utils/__init__.py @@ -0,0 +1,17 @@ +# +# Copyright: Dr. José M. Pizarro. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .utils import get_files, extract_hdf5_dataset diff --git a/src/pyssmf/utils.py b/src/pyssmf/utils/utils.py similarity index 100% rename from src/pyssmf/utils.py rename to src/pyssmf/utils/utils.py diff --git a/src/pyssmf/visualization.py b/src/pyssmf/visualization.py index f6e58c8..e7b4782 100644 --- a/src/pyssmf/visualization.py +++ b/src/pyssmf/visualization.py @@ -15,7 +15,6 @@ # import numpy as np -import PyQt5 # noqa: F401 import matplotlib.pyplot as plt from matplotlib.widgets import Slider