Skip to main content

CubitPy

Utility functions and 4C related functionality for the Cubit and Coreform python interface, Especially for the creation of input files for 4C.

CubitPy test suite

Usage

A tutorial can be found in the /tutorial directory.

Contributing

If you are interested in contributing to CubitPy, we welcome your collaboration. For general questions, feature request and bug reports please open an issue.

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. 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 file.

Installation

CubitPy is developed with python3.13. Other versions of Python might lead to issues. It is recommended to use a python environment container such as conda or venv.

  • conda: A conda environment can be created and loaded with
    conda create -n cubitpy python=3.13
    conda activate cubitpy
    
  • venv: Chose an appropriate directory for this, e.g., /home/user/opt. A virtual environment can be setup with
    • On Debian systems the following packages have to be installed:
      sudo apt-get install python3-venv python3-dev
      
    • Create and load the environment
      cd <path-to-env-folder>
      python -m venv cubitpy-env
      source cubitpy-env/bin/activate
      

To install cubitpy go to the repository root directory

cd path_to_cubitpy

And install cubitpy via pip

pip install .

If you intend to actively develop cubitpy, install it in editable mode

pip install -e ".[dev]"

To run CubitPy it is required to provide a CubitPy configuration file. This file should look like:

cubitpy_mode: "local"  # "local" or "remote"
local_config:
  cubit_path: "/Users/username/opt/Cubit-15.2/Cubit.app"
remote_config:
  user: "username"
  host: "hostname"
  platform: "windows"
  cubit_path: "C:\\Coreform_Cubit_2025.8"

To run CubitPy one can either provide the configuration file then initializing CubitPy, or set an environment variable with the path to the configuration file.

export CUBITPY_CONFIG_PATH=path_to_cubitpy_config.yaml

If you are using a Cubit version that still runs on python2, you need to specify a path to a valid python2.7 executable

export CUBITPY_PYTHON2=path_to_python2.7

Note: for IMCS workstations this path is "/imcs/public/compsim/opt/Python-2.7.18/python".

To check if everything worked as expected, run the test suite (from the root directory)

cd path_to_cubitpy/tests
pytest

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:

pre-commit install

Debugging in VS Code and PyCharm

When debugging, IDEs may try to attach to subprocesses, which can cause issues. The instructions below show how to disable this behavior in VS Code and PyCharm.

VS Code

To prevent the debugger from attaching to subprocesses, add the following to your .vscode/launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Launch current file",
      "type": "debugpy",
      "request": "launch",
      "program": "${file}", // Launches the currently open file
      "console": "integratedTerminal", // or "externalTerminal" if needed
      "subProcess":false, // Disables debugging for subprocesses and libraries
    }
  ]
}

PyCharm

To disable subprocess debugging:

  1. Go to File > Settings
  2. Navigate to: Build, Execution, Deployment > Python Debugger
  3. Uncheck: Attach to subprocess automatically while debugging

Metadata

Release files for cubitpy 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cubitpy 0.2.2
File Size Uploaded
cubitpy-0.2.2.tar.gz 514.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cubitpy 0.2.2
File Interpreter ABI Platform
cubitpy-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 569.6 kB

Release files / cubitpy-0.2.2.tar.gz

Download URL cubitpy-0.2.2.tar.gz
Size 514.0 kB
Tags Source
SHA-256 checksum
How to use checksums
43e5614d846a9463bc0776e07dcb78267b2a8374b8ed3765a959fa4b68c82fdd
BLAKE2b-256 checksum
How to use checksums
a7959d1a1cde77014df8ed23da32fc2ec52cb7d3b84d094f5d1774c880f6149b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / cubitpy-0.2.2-py3-none-any.whl

Download URL cubitpy-0.2.2-py3-none-any.whl
Size 55.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cadc301576257cce80d46ae1e04168d2d013c3c242b6a9126a74871b81f616c
BLAKE2b-256 checksum
How to use checksums
cec00c7a6920a78e288807fbd3895ae29bcc849e004e672bce3324b722e35a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page