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
4 changes: 2 additions & 2 deletions .github/workflows/main_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/pytoda"]
path = src/pytoda
url = git@github.com:davidrudlstorfer/pytoda.git
url = git@github.com:maxiludwig/pytoda.git
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<h1 align="center">
PySkel 🐍🩻
LungUtils 🐍🩻
</h1>

<div align="center">

[![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)

</div>

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)
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 .
```
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pyskel
name: lung_utils
channels:
- conda-forge
- nodefaults
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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

Expand All @@ -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"
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pyskel/core/example.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
12 changes: 6 additions & 6 deletions src/pyskel/core/run.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/pyskel/core/utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Utilities for PySkel main routine."""
"""Utilities for LungUtils main routine."""

import logging
import os
Expand All @@ -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",
)

Expand Down
14 changes: 7 additions & 7 deletions src/pyskel/main.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pyskel/main_example_config.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/pyskel/core/test_example.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Loading
Loading