Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contributing #41

Merged
merged 4 commits into from
Nov 18, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
. ${SPACK_ACTIVATION_SCRIPT}
spack load python@3.12.1
# Create the virtual environment
python3 -m venv $PYTHON_VENV
python -m venv $PYTHON_VENV
source $PYTHON_VENV/bin/activate
# Update pip
pip install --upgrade pip
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
language_version: python3.12
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CubitPy: Cubit utility functions and a cubit wrapper for python3
CubitPy: Utility functions and 4C related functionality for the Cubit and
Coreform python interface

MIT License

Expand Down
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
[![build-test](https://github.com/imcs-compsim/cubitpy/actions/workflows/.github/workflows/build-test.yml/badge.svg)](https://github.com/imcs-compsim/cubitpy/actions/workflows/.github/workflows/build-test.yml)

# Cubitpy
# CubitPy

Cubit features and utilities functions, especially for the creation of input files for 4C.
It is tested with Cubit15.2.
Utility functions and 4C related functionality for the Cubit and Coreform python interface,
Especially for the creation of input files for 4C.

## Usage

A tutorial can be found in the `/tutorial` directory.

## Code formating
## Contributing

CubitPy uses the python code formatter [black](https://github.com/psf/black).
The testsuite checks if all files are formatted accordingly.
If you are interested in contributing to CubitPy, we welcome your collaboration.
For general questions, feature request and bug reports please open an [issue](https://github.com/imcs-compsim/cubitpy/issues).

If you contribute actual code, fork the repository and make the changes in a feature branch.
Depending on the topic and amount of changes you also might want to open an [issue](https://github.com/imcs-compsim/cubitpy/issues).
To merge your changes into the CubitPy repository, create a pull request to the `main` branch.
A few things to keep in mind:
- It is highly encouraged to add tests covering the functionality of your changes, see the test suite in `tests/`.
- CubitPy uses `black` to format python code.
Make sure to apply `black` to the changed source files.
- Feel free to add yourself to the [CONTRIBUTORS](CONTRIBUTORS) file.

## Installation

Cubitpy is developed with `python3.8`.
CubitPy is developed with `python3.12`.
Other versions of Python might lead to issues.
It is recommended to use virtual environments with `python`.
On Debian systems the following packages have to be installed
Expand All @@ -26,15 +35,15 @@ sudo apt-get install python3-venv python3-dev

Now a virtual environment can be created (chose an appropriate directory for this, e.g., `/home/user/opt`)
```bash
python3 -m venv cubitpy-env
python -m venv cubitpy-env
```

The created virtual environment can be loaded with
```bash
source cubitpy-env/bin/activate
```

From now on we assume that the virtual enviroment is loaded.
From now on we assume that the virtual environment is loaded.
To install `cubitpy` go to the repository root directory
```bash
cd path_to_cubitpy
Expand All @@ -58,5 +67,10 @@ export CUBIT_ROOT=path_to_cubit_root_directory
To check if everything worked as expected, run the tests from within the `tests` directory
```bash
cd path_to_cubitpy/tests
pytest -q testing.py
pytest -q testing.py
```

If you intend to actively develop CubitPy, please make sure to install the `pre-commit` hook within the python environment to follow our style guides:
```bash
pre-commit install
```
3 changes: 2 additions & 1 deletion cubitpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubit_group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubit_utility.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubit_wrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
7 changes: 4 additions & 3 deletions cubitpy/cubit_wrapper/cubit_wrapper_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down Expand Up @@ -121,7 +122,7 @@ def is_cubit_type(obj):

# Now start an endless loop (until None is sent) and perform the cubit functions
while 1:
# Get input from python3.
# Get input from the python host.
receive = channel.receive()

# If None is sent, break the connection and exit
Expand Down Expand Up @@ -249,7 +250,7 @@ def deserialize_item(item):
"The id {} is not in the cubit_objects dictionary".format(cubit_id)
)

# Return to python3
# Return to python host
channel.send(None)

else:
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubit_wrapper/cubit_wrapper_host.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubit_wrapper/cubit_wrapper_utility.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubitpy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubitpy_to_dat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/cubitpy_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/geometry_creation_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion cubitpy/mesh_creation_functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ name = "CubitPy"
authors = [
{name = "Ivo Steinbrecher", email = "ivo.steinbrecher@unibw.de"},
]
description = "CubitPy: Utility functions for the cubit python interface"
description = "CubitPy: Utility functions and 4C related functionality for the Cubit and Coreform python interface"
readme = "README.md"
license = {file = "LICENSE"}
dependencies = [
"black",
"black==22.12.0",
"execnet==1.9.0",
"netCDF4",
"numpy"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_configurations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# Test the deletion of objects.
# Save stderr in variable.
python3 test_delete.py
python test_delete.py

# Exit status to fail gitlab pipeline.
ERRORSTRING=$(python3 test_delete.py 2>&1)
ERRORSTRING=$(python test_delete.py 2>&1)
if [[ -z "$ERRORSTRING" ]]; then
# if std error was empy, test was ok
echo "Deletion test OK!"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion tests/testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion tests/testing_header.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion tests/testing_tutorial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion tutorial/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
3 changes: 2 additions & 1 deletion tutorial/tutorial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# CubitPy: Cubit utility functions and a cubit wrapper for python3
# CubitPy: Utility functions and 4C related functionality for the Cubit and
# Coreform python interface
#
# MIT License
#
Expand Down
Loading