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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cubitpy-0.2.1.tar.gz (463.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cubitpy-0.2.1-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file cubitpy-0.2.1.tar.gz.

File metadata

  • Download URL: cubitpy-0.2.1.tar.gz
  • Upload date:
  • Size: 463.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for cubitpy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 30d187b7a4a654cc632fa2f472d7a36034969cde57a841ebce33574b2d9a4d88
MD5 42e3dc49d2a03f95001c0edef2dbd978
BLAKE2b-256 c49b6240859ecc8bb121d7dc4a41693e606da21cb295eab3a85a47875023880c

See more details on using hashes here.

File details

Details for the file cubitpy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: cubitpy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for cubitpy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c3e412cacc6c51cd6c6e58f71191e8db89799d524ed77f494f1ce1c19d5720e
MD5 cc2b3d75328dfcd91861c41ec980a511
BLAKE2b-256 fc53a944b9caa740508010d4ab90f6f8f5bc1404f9dee878dccbc701f98956ff

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page