diff --git a/.github/workflows/main_documentation.yml b/.github/workflows/main_documentation.yml index 07fd83d..15a3a83 100644 --- a/.github/workflows/main_documentation.yml +++ b/.github/workflows/main_documentation.yml @@ -24,12 +24,12 @@ jobs: git submodule foreach --recursive pip install -e . pip install -e . - name: Generate documentation - run: pdoc --html --output-dir docs src/pyskel + run: pdoc --html --output-dir docs src/lung_utils - name: Upload documentation artifact uses: actions/upload-pages-artifact@v3 with: name: documentation - path: docs/pyskel + path: docs/lung_utils deploy: name: Deploy documentation permissions: diff --git a/.github/workflows/pull_request_pipeline.yml b/.github/workflows/pull_request_pipeline.yml index e4d5305..bf8745f 100644 --- a/.github/workflows/pull_request_pipeline.yml +++ b/.github/workflows/pull_request_pipeline.yml @@ -78,7 +78,7 @@ jobs: git submodule foreach --recursive pip install -e . pip install -e . - name: Generate documentation - run: pdoc --html --output-dir docs src/pyskel + run: pdoc --html --output-dir docs src/lung_utils - name: Upload documentation artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/.gitmodules b/.gitmodules index 840db85..ef203df 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "src/pytoda"] path = src/pytoda - url = git@github.com:davidrudlstorfer/pytoda.git + url = git@github.com:maxiludwig/pytoda.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd81288..d95b93b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: rev: 1.7.9 hooks: - id: bandit - args: ["-c", "pyproject.toml", "-r", "-ll", "src/pyskel/", "tests/"] + args: ["-c", "pyproject.toml", "-r", "-ll", "src/lung_utils/", "tests/"] additional_dependencies: ["bandit[toml]"] - repo: https://github.com/psf/black rev: 24.4.2 @@ -32,7 +32,7 @@ repos: rev: v1.7.5 hooks: - id: docformatter - args: ["--in-place", "--config=./pyproject.toml", "-r", "src/pyskel/", "tests/"] + args: ["--in-place", "--config=./pyproject.toml", "-r", "src/lung_utils/", "tests/"] - repo: https://github.com/kplaube/pre-commit-dodgy rev: 0.0.2 hooks: @@ -45,12 +45,12 @@ repos: rev: 1.7.0 hooks: - id: interrogate - args: [--fail-under=100, --ignore-init-module, --style=google, -vv, src/pyskel/, tests/] + args: [--fail-under=100, --ignore-init-module, --style=google, -vv, src/lung_utils/, tests/] - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: - id: isort - args: ["--profile", "black", "--line-length", "79", "--filter-files", "--src", "[src/pyskel/, tests/]"] + args: ["--profile", "black", "--line-length", "79", "--filter-files", "--src", "[src/lung_utils/, tests/]"] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.10.0 hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a2198e..f6328ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to PySkel +# Contributing to LungUtils We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: - Reporting a bug @@ -23,7 +23,7 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu ## Any contributions you make will be under the MIT Software License In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. -## Report bugs using Github's [issues](https://github.com/davidrudlstorfer/pyskel/issues) +## Report bugs using Github's [issues](https://github.com/maxiludwig/lung_utils/issues) We use GitHub issues to track public bugs. Report a bug by opening a new issue - it's that easy! ## Write bug reports with detail, background, and sample code diff --git a/LICENSE.md b/LICENSE.md index 3ad9f3a..adb3d79 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 David Rudlstorfer +Copyright (c) 2024 Maxi Ludwig Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 90d3e07..e5f8d90 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@

- PySkel 🐍🩻 + LungUtils 🐍🩻

-[![Pipeline](https://github.com/davidrudlstorfer/pyskel/actions/workflows/main_pipeline.yml/badge.svg)](https://github.com/davidrudlstorfer/pyskel/actions/workflows/main_pipeline.yml) -[![Documentation](https://github.com/davidrudlstorfer/pyskel/actions/workflows/main_documentation.yml/badge.svg)](https://davidrudlstorfer.github.io/pyskel/) -[![Coverage badge](https://github.com/davidrudlstorfer/pyskel/raw/python-coverage-comment-action-data/badge.svg)](https://github.com/davidrudlstorfer/pyskel/tree/python-coverage-comment-action-data) +[![Pipeline](https://github.com/maxiludwig/lung_utils/actions/workflows/main_pipeline.yml/badge.svg)](https://github.com/maxiludwig/lung_utils/actions/workflows/main_pipeline.yml) +[![Documentation](https://github.com/maxiludwig/lung_utils/actions/workflows/main_documentation.yml/badge.svg)](https://maxiludwig.github.io/lung_utils/) +[![Coverage badge](https://github.com/maxiludwig/lung_utils/raw/python-coverage-comment-action-data/badge.svg)](https://github.com/maxiludwig/lung_utils/tree/python-coverage-comment-action-data)
-PySkel (**Py**thon **Skel**eton) is a quick-start Python repository to act as a skeleton for various projects around the multiphysics research code [4C](https://www.4c-multiphysics.org/) and leverages utilities from [PyToDa](https://github.com/davidrudlstorfer/pytoda). It includes the following basic amenities and tools: +LungUtils (**Py**thon **Skel**eton) is a quick-start Python repository to act as a skeleton for various projects around the multiphysics research code [4C](https://www.4c-multiphysics.org/) and leverages utilities from [PyToDa](https://github.com/maxiludwig/pytoda). It includes the following basic amenities and tools: - [PyTest](https://docs.pytest.org/) testing framework including an enforced minimum coverage check - Automated [Github CI/CD](https://resources.github.com/devops/ci-cd/) - Exhaustive [Pre-Commit](https://pre-commit.com) framework to automatically check code formatting and code quality - Automatically generated [Documentation](https://pdoc.dev) based on the included Python docstrings -- Pre-defined framework to gather global settings (see [`main_example_config.yaml`](./src/pyskel/main_example_config.yaml)) and execute a specific workflow +- Pre-defined framework to gather global settings (see [`main_example_config.yaml`](./src/lung_utils/main_example_config.yaml)) and execute a specific workflow The remaining parts of the readme are structured as follows: - [Setup](#setup) - [Installation](#installation) - [Execution](#execution) - - [Execute PySkel](#execute-pyskel) + - [Execute LungUtils](#execute-lung_utils) - [Run testing framework and create coverage report](#run-testing-framework-and-create-coverage-report) - [Create documentation](#create-documentation) - [Dependency Management](#dependency-management) @@ -33,18 +33,18 @@ The remaining parts of the readme are structured as follows: ## Setup -To setup a project based on PySkel simply follow these steps: +To setup a project based on LungUtils simply follow these steps: 1. On Github create a new repository with `Use this template` and `Create a new repository`. 2. Clone your new repository to your local machine and setup the project according to the installation procedure down below. -3. Rename all occurrences of PySkel to your new code project's name. +3. Rename all occurrences of LungUtils to your new code project's name. 4. Within your GitHub project's settings, enable GitHub Pages for GitHub Actions (`Settings` -> `Pages` -> `Source` = `GitHub Actions`). 5. Create a new branch protection rule for the main branch on GitHub (`Settings` -> `Branches` -> `Add rule` -> Set up your rules`). 6. Activate to automatically delete branches after merging (`Settings` -> `General` -> `Automatically delete head branches`) ## Installation -For a quick and easy start an Anaconda/Miniconda environment is highly recommended. Other ways to install PySkel are possible but here the installation procedure is explained based on a conda install. After installing Anaconda/Miniconda +For a quick and easy start an Anaconda/Miniconda environment is highly recommended. Other ways to install LungUtils are possible but here the installation procedure is explained based on a conda install. After installing Anaconda/Miniconda execute the following steps: - Create a new Anaconda environment based on the [`environment.yml`](./environment.yml) file: @@ -54,7 +54,7 @@ conda env create -f environment.yml - Activate your newly created environment: ``` -conda activate pyskel +conda activate lung_utils ``` - Initialize all submodules @@ -67,7 +67,7 @@ git submodule update --init --recursive git submodule --quiet foreach --recursive pip install -e . ``` -- Install all PySkel requirements with: +- Install all LungUtils requirements with: ``` pip install -e . ``` @@ -81,18 +81,18 @@ Now you are up and running 🎉 ## Execution -### Execute PySkel +### Execute LungUtils -To execute PySkel either run +To execute LungUtils either run ``` -pyskel +lung_utils ```` -to execute PySkel with the provided exemplary config or use +to execute LungUtils with the provided exemplary config or use ``` -pyskel --config_file_path ../path/to/config.yaml +lung_utils --config_file_path ../path/to/config.yaml ```` to utilize your own externally provided config file. Therein, all necessary configurations can be found. @@ -110,7 +110,7 @@ pytest To locally create the documentation from the provided docstrings simply run ``` -pdoc --html --output-dir docs src/pyskel +pdoc --html --output-dir docs src/lung_utils ``` ## Dependency Management diff --git a/environment.yml b/environment.yml index 7f0b7d1..435b680 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: pyskel +name: lung_utils channels: - conda-forge - nodefaults diff --git a/pyproject.toml b/pyproject.toml index 94d7ffb..636bc3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,10 +5,10 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] -name = "PySkel" +name = "LungUtils" version = "1.0" -authors = [{ name = "David Rudlstorfer" }] -maintainers = [{ name = "David Rudlstorfer" }] +authors = [{ name = "Maxi Ludwig" }] +maintainers = [{ name = "Maxi Ludwig" }] description = "A quick start Python skeleton with many amenities" readme = "README.md" license = {file = "LICENSE.md"} @@ -20,13 +20,13 @@ dynamic = ["dependencies"] [tool.setuptools.packages.find] where = ["src"] -include = ["pyskel"] +include = ["lung_utils"] [tool.setuptools.dynamic] dependencies = { file = ["requirements.txt"] } [project.scripts] -pyskel = "pyskel.main:main" +lung_utils = "lung_utils.main:main" ## Tools @@ -46,8 +46,8 @@ relative_files = true profile = "black" line_length = 79 filter_files = true -src_paths = ["src/pyskel/", "tests/"] +src_paths = ["src/lung_utils/", "tests/"] [tool.pytest.ini_options] testpaths = ["tests"] -addopts = "-p pytest_cov --cov-report=term --cov-report=html --cov-fail-under=90 --cov=src/pyskel/ --cov-append" +addopts = "-p pytest_cov --cov-report=term --cov-report=html --cov-fail-under=90 --cov=src/lung_utils/ --cov-append" diff --git a/requirements.in b/requirements.in index 8940fee..f830194 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -# This file contains all the requirements for PySkel +# This file contains all the requirements for LungUtils # dependencies from conda environment.yml numba==0.59.1 diff --git a/src/pyskel/core/example.py b/src/pyskel/core/example.py index 7359289..48c20a2 100644 --- a/src/pyskel/core/example.py +++ b/src/pyskel/core/example.py @@ -1,4 +1,4 @@ -"""Exemplary function to be executed within PySkel.""" +"""Exemplary function to be executed within LungUtils.""" def exemplary_function(a: float, b: float) -> float: diff --git a/src/pyskel/core/run.py b/src/pyskel/core/run.py index 261393a..6141e5a 100644 --- a/src/pyskel/core/run.py +++ b/src/pyskel/core/run.py @@ -1,17 +1,17 @@ -"""Runner which executes the main routine of PySkel.""" +"""Runner which executes the main routine of LungUtils.""" import logging import time from typing import Any -from pyskel.core.example import exemplary_function -from pyskel.core.utilities import RunManager +from lung_utils.core.example import exemplary_function +from lung_utils.core.utilities import RunManager -log = logging.getLogger("pyskel") +log = logging.getLogger("lung_utils") -def run_pyskel(config: Any) -> None: - """General run procedure of PySkel. +def run_lung_utils(config: Any) -> None: + """General run procedure of LungUtils. Args: config (Any): Munch type object containing all configs for current diff --git a/src/pyskel/core/utilities.py b/src/pyskel/core/utilities.py index 8e0363f..b371778 100644 --- a/src/pyskel/core/utilities.py +++ b/src/pyskel/core/utilities.py @@ -1,4 +1,4 @@ -"""Utilities for PySkel main routine.""" +"""Utilities for LungUtils main routine.""" import logging import os @@ -7,29 +7,29 @@ import yaml from pytoda.logger import log_full_width, print_header, setup_logging -log = logging.getLogger("pyskel") +log = logging.getLogger("lung_utils") class RunManager: - """Helper functions to manage a PySkel run.""" + """Helper functions to manage a LungUtils run.""" def __init__(self, config): self.config = config def init_run(self) -> None: - """Set up PySkel run including logger.""" + """Set up LungUtils run including logger.""" setup_logging( self.config.general.log_to_console, self.config.general.log_file, self.config.general.output_directory, self.config.general.sim_name, - "pyskel", + "lung_utils", ) print_header( - title="PySkel", + title="LungUtils", description="General Python Skeleton", ) diff --git a/src/pyskel/main.py b/src/pyskel/main.py index 3b791f4..caf367e 100644 --- a/src/pyskel/main.py +++ b/src/pyskel/main.py @@ -1,15 +1,15 @@ -"""Main routine of PySkel.""" +"""Main routine of LungUtils.""" import argparse import os import yaml from munch import munchify -from pyskel.core.run import run_pyskel +from lung_utils.core.run import run_lung_utils def main() -> None: - """Call PySkel runner with config. + """Call LungUtils runner with config. Raises: RuntimeError: If provided config is not a valid file. @@ -20,21 +20,21 @@ def main() -> None: "-cfp", help="Path to config file.", type=str, - default="src/pyskel/main_example_config.yaml", + default="src/lung_utils/main_example_config.yaml", ) args = parser.parse_args() if not os.path.isfile(args.config_file_path): raise RuntimeError( - "Config file not found! PySkel can not be executed!" + "Config file not found! LungUtils can not be executed!" ) # load config and convert to simple namespace for easier access with open(args.config_file_path, "r") as file: config = munchify(yaml.safe_load(file)) - # execute pyskel - run_pyskel(config) + # execute lung_utils + run_lung_utils(config) if __name__ == "__main__": # pragma: no cover diff --git a/src/pyskel/main_example_config.yaml b/src/pyskel/main_example_config.yaml index 2732143..a9831b8 100644 --- a/src/pyskel/main_example_config.yaml +++ b/src/pyskel/main_example_config.yaml @@ -1,5 +1,5 @@ general: output_directory: output sim_name: test_sim - log_file: pyskel.log + log_file: lung_utils.log log_to_console: true diff --git a/tests/pyskel/core/test_example.py b/tests/pyskel/core/test_example.py index de6a344..7d0315d 100644 --- a/tests/pyskel/core/test_example.py +++ b/tests/pyskel/core/test_example.py @@ -1,6 +1,6 @@ """Test example.""" -from pyskel.core.example import exemplary_function +from lung_utils.core.example import exemplary_function def test_exemplary_function() -> None: diff --git a/tests/pyskel/core/test_run.py b/tests/pyskel/core/test_run.py index dc7f4f4..2cec935 100644 --- a/tests/pyskel/core/test_run.py +++ b/tests/pyskel/core/test_run.py @@ -3,22 +3,22 @@ from unittest.mock import MagicMock, patch from munch import munchify -from pyskel.core.run import run_pyskel +from lung_utils.core.run import run_lung_utils -def test_run_pyskel() -> None: - """Test run procedure of PySkel.""" +def test_run_lung_utils() -> None: + """Test run procedure of LungUtils.""" mock_config = munchify({"key": "value"}) mock_run_manager = MagicMock() - with patch("pyskel.core.run.RunManager", return_value=mock_run_manager): + with patch("lung_utils.core.run.RunManager", return_value=mock_run_manager): mock_exemplary_function = MagicMock(return_value="Exemplary output") with patch( - "pyskel.core.run.exemplary_function", mock_exemplary_function + "lung_utils.core.run.exemplary_function", mock_exemplary_function ): - run_pyskel(mock_config) + run_lung_utils(mock_config) mock_run_manager.init_run.assert_called_once() mock_exemplary_function.assert_called_once() diff --git a/tests/pyskel/core/test_utilities.py b/tests/pyskel/core/test_utilities.py index c28cc07..d182510 100644 --- a/tests/pyskel/core/test_utilities.py +++ b/tests/pyskel/core/test_utilities.py @@ -7,7 +7,7 @@ import yaml from munch import munchify -from pyskel.core.utilities import RunManager +from lung_utils.core.utilities import RunManager def test_run_manager_init_run() -> None: @@ -16,11 +16,11 @@ def test_run_manager_init_run() -> None: mock_config = MagicMock() with ( - patch("pyskel.core.utilities.setup_logging") as mock_setup_logging, - patch("pyskel.core.utilities.print_header") as mock_print_header, - patch("pyskel.core.utilities.log_full_width") as mock_log_full_width, + patch("lung_utils.core.utilities.setup_logging") as mock_setup_logging, + patch("lung_utils.core.utilities.print_header") as mock_print_header, + patch("lung_utils.core.utilities.log_full_width") as mock_log_full_width, patch( - "pyskel.core.utilities.RunManager.write_config" + "lung_utils.core.utilities.RunManager.write_config" ) as mock_write_config, ): run_manager = RunManager(mock_config) @@ -32,7 +32,7 @@ def test_run_manager_init_run() -> None: mock_config.general.log_file, mock_config.general.output_directory, mock_config.general.sim_name, - "pyskel", + "lung_utils", ) mock_print_header.assert_called_once() mock_log_full_width.assert_called_once_with("RUN STARTED") @@ -87,8 +87,8 @@ def test_run_manager_finish_run() -> None: mock_config = MagicMock() with ( - patch("pyskel.core.utilities.log_full_width") as mock_log_full_width, - patch("pyskel.core.utilities.log") as mock_log, + patch("lung_utils.core.utilities.log_full_width") as mock_log_full_width, + patch("lung_utils.core.utilities.log") as mock_log, ): run_manager = RunManager(mock_config) diff --git a/tests/pyskel/test_main.py b/tests/pyskel/test_main.py index 28ae6ff..fd5d80f 100644 --- a/tests/pyskel/test_main.py +++ b/tests/pyskel/test_main.py @@ -6,7 +6,7 @@ import pytest import yaml from munch import munchify -from pyskel.main import main +from lung_utils.main import main def test_main_config_file_exists(tmp_path: Path) -> None: @@ -29,12 +29,12 @@ def test_main_config_file_exists(tmp_path: Path) -> None: "builtins.open", mock_open(read_data=yaml.dump(mock_config_data)) ): with patch("yaml.safe_load", return_value=mock_config_data): - mock_run_pyskel = MagicMock() - with patch("pyskel.main.run_pyskel", mock_run_pyskel): + mock_run_lung_utils = MagicMock() + with patch("lung_utils.main.run_lung_utils", mock_run_lung_utils): # Run main function main() - captured_config = mock_run_pyskel.call_args[0][0] + captured_config = mock_run_lung_utils.call_args[0][0] assert captured_config == munchify(mock_config_data)