A streamlined Python Parser for 4C input files
Project description
FourCIPP (FourC Input Python Parser) holds a Python Parser to simply interact with 4C YAML input files. This tool provides a streamlined approach to data handling for third party tools.
Overview
Installation
Python Environment
FourCIPP is a Python project supporting Python versions 3.10 - 3.13. To use FourCIPP it is recommended to install it into a virtual Python environment such as Conda/Miniforge or venv.
An exemplary Conda/Miniforge environment can be created and loaded with
# Create the environment (this only has to be done once)
conda create -n fourcipp python=3.13
# Activate the environment
conda activate fourcipp
To now install FourCIPP different ways exist.
Installation from PyPI
FourCIPP is published on PyPI as a universal wheel, meaning you can install it on Windows, Linux and macOS with:
pip install fourcipp
or a specific version with:
pip install fourcipp==0.28.0
Installation from Github (most recent version)
Additionally, the latest main version of FourCIPP can be installed directly from Github via:
pip install git+https://github.com/4C-multiphysics/fourcipp.git@main
Installation from source
If you intend on developing FourCIPP it is crucial to install FourCIPP from source, i.e., cloning the repository from Github. You can then either install it in a non-editable or editable fashion.
-
Install all requirements without fixed versions in a non-editable fashion via:
# located at the root of the repository pip install .
and without fixed versions in an editable fashion via:
# located at the root of the repository pip install -e .
Note: This is the default behavior. This allows to use fourcipp within other projects without version conflicts.
-
Alternatively, you can install all requirements with fixed versions in a non-editable fashion with:
pip install .[safe]
and with fixed versions in an editable fashion via:
# located at the root of the repository pip install -e .[safe]
Once installed, FourCIPP is ready to be used 🎉
Quickstart example
from fourcipp.fourc_input import FourCInput
# Create a new 4C input via
input_4C = FourCInput()
# Or load an existing input file
input_4C = FourCInput.from_4C_yaml(input_file_path)
# Add or overwrite sections
input_4C["PROBLEM TYPE"] = {"PROBLEMTYPE": "Structure"}
input_4C["PROBLEM SIZE"] = {"DIM": 3, "ELEMENTS": 1_000}
# Update section parameter
input_4C["PROBLEM SIZE"]["ELEMENTS"] = 1_000_000
# Add new parameter
input_4C["PROBLEM SIZE"]["NODES"] = 10_000_000
# Remove section
removed_section = input_4C.pop("PROBLEM SIZE")
# Dump to file
input_4C.dump(input_file_path, validate=True)
Configuration
FourCIPP utilizes the 4C_metadata.yaml and schema.json files generated during the 4C build to remain up-to-date with your 4C build. By default, the files for the latest 4C input version can be found in src/fourcipp/config. You can add custom metadata and schema paths to the configuration file src/fourcipp/config/config.yaml by adding a new profile:
profile: your_custom_files
profiles:
your_custom_files:
4C_metadata_path: /absolute/path/to/your/4C_metadata.yaml
json_schema_path: /absolute/path/to/your/4C_schema.json
default:
4C_metadata_path: 4C_metadata.yaml
json_schema_path: 4C_schema.json
description: 4C metadata from the latest successful nightly 4C build
4C_docker_main:
4C_metadata_path: /home/user/4C/build/4C_metadata.yaml
json_schema_path: /home/user/4C/build/4C_schema.json
description: 4C metadata in the main 4C docker image
and select it using the profile entry.
Developing FourCIPP
If you plan on actively developing FourCIPP it is advisable to install in editable mode with the additional developer requirements like
pip install -e .[dev]
Note: The developer requirements can also be installed in non-editable installs. Finally, you can install the pre-commit hook with:
pre-commit install
Dependency Management
To ease the dependency update process pip-tools is utilized. To create the necessary requirements.txt file simply execute
pip-compile --all-extras --output-file=requirements.txt requirements.in
To upgrade the dependencies simply execute
pip-compile --all-extras --output-file=requirements.txt --upgrade requirements.in
License
This project is licensed under a MIT license. For further information check LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fourcipp-1.84.0.tar.gz.
File metadata
- Download URL: fourcipp-1.84.0.tar.gz
- Upload date:
- Size: 729.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b60a308e73a744d6655959f426dd0003fe5ceb6666f77b8c1e7d048a0468826
|
|
| MD5 |
3e74cf4dd5d53f6138891a20a3b66125
|
|
| BLAKE2b-256 |
33abf0193274f836463d0bc97b910e66fc6647e1194821ab96d084dc7f272c62
|
Provenance
The following attestation bundles were made for fourcipp-1.84.0.tar.gz:
Publisher:
publish_pypi.yaml on 4C-multiphysics/fourcipp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fourcipp-1.84.0.tar.gz -
Subject digest:
5b60a308e73a744d6655959f426dd0003fe5ceb6666f77b8c1e7d048a0468826 - Sigstore transparency entry: 1214479349
- Sigstore integration time:
-
Permalink:
4C-multiphysics/fourcipp@b96316ae4cb7e9ad10dd24436b9ccec5aaac902e -
Branch / Tag:
refs/tags/v1.84.0 - Owner: https://github.com/4C-multiphysics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yaml@b96316ae4cb7e9ad10dd24436b9ccec5aaac902e -
Trigger Event:
push
-
Statement type:
File details
Details for the file fourcipp-1.84.0-py3-none-any.whl.
File metadata
- Download URL: fourcipp-1.84.0-py3-none-any.whl
- Upload date:
- Size: 787.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc65c11f312c57691408b47fa745592c11aa54918744fc4dc038cbd3dab77c35
|
|
| MD5 |
0c4864d6d5e10daea2e852bb705582e1
|
|
| BLAKE2b-256 |
42bc4e2f90e735d1a8a66ba7c2eba07db2915f51abb3924b85ad74ef3f465f41
|
Provenance
The following attestation bundles were made for fourcipp-1.84.0-py3-none-any.whl:
Publisher:
publish_pypi.yaml on 4C-multiphysics/fourcipp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fourcipp-1.84.0-py3-none-any.whl -
Subject digest:
cc65c11f312c57691408b47fa745592c11aa54918744fc4dc038cbd3dab77c35 - Sigstore transparency entry: 1214479402
- Sigstore integration time:
-
Permalink:
4C-multiphysics/fourcipp@b96316ae4cb7e9ad10dd24436b9ccec5aaac902e -
Branch / Tag:
refs/tags/v1.84.0 - Owner: https://github.com/4C-multiphysics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yaml@b96316ae4cb7e9ad10dd24436b9ccec5aaac902e -
Trigger Event:
push
-
Statement type: