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"
message_handling: "default"  # optional: "default", "errors_as_warnings" or "silent"

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

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.5
File Size Uploaded Provenance Actions
cubitpy-0.2.5.tar.gz 516.0 kB Without provenance Details for cubitpy-0.2.5.tar.gz

Built distribution (wheel)

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

Total release size: 572.1 kB

Release files / cubitpy-0.2.5.tar.gz

Download URL cubitpy-0.2.5.tar.gz
Size 516.0 kB
Tags Source
SHA-256 checksum
How to use checksums
456b3914d7c2147c0c3fa5f417c5fe14dd813200b5601ee0366102ae6014f88b
BLAKE2b-256 checksum
How to use checksums
280328073daf7f3e6839d2235a57ffef55b3e0d01f7363ec8b929716751585a1
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.5-py3-none-any.whl

Download URL cubitpy-0.2.5-py3-none-any.whl
Size 56.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56e02d8624fd622dae36471503dee14a908364ff439212802f2c71e85f237b64
BLAKE2b-256 checksum
How to use checksums
9fc74b764486ad15a24d70e1831d094735d05f5892dcf42d081d7b7caee635f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for cubitpy 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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