PyComposites is a teaching-oriented Python package for thermo-mechanical analysis of thin-walled composite materials.
The package contains tools for Classical Laminate Theory (CLT), laminate failure criteria, and simple plate-equation examples. It is intended for students who need to install the code locally and run the examples during a course or project.
- Python 3.10 or newer
- pip
- git, if you want to download the repository from GitHub
NumPy is installed automatically with the package. The plotting and notebook examples additionally use Matplotlib and Jupyter.
These steps assume little or no Python experience. Use one of the two paths below:
- Windows PowerShell if you installed Python directly on Windows.
- WSL if you use Ubuntu or another Linux distribution inside Windows Subsystem for Linux.
Open PowerShell and run these commands.
python --versionYou should see Python 3.10 or newer, for example Python 3.12.3.
If python is not found, install Python from https://www.python.org/downloads/.
During installation, enable Add python.exe to PATH.
With git:
git clone https://github.com/jjcremmers/pycomposites.git
cd pycompositesWithout git, download the repository as a ZIP file from GitHub, unzip it, and
open a terminal in the unzipped pycomposites folder.
A virtual environment keeps this package and its dependencies separate from the rest of your computer.
python -m venv .venv
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation, run this once and then activate again:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserAfter activation, your prompt usually starts with (.venv).
python -m pip install --upgrade pippython -m pip install .To run plotting examples and Jupyter notebooks as well, install the optional example dependencies:
python -m pip install ".[examples]"For local development, use editable mode instead:
python -m pip install -e ".[examples]"First check that Python can import the package:
python -c "from pycomposites import TransverseIsotropic, Laminate; material = TransverseIsotropic([135e9, 10e9], 0.3, 5e9); laminate = Laminate(); laminate.addMaterial('UD', material); laminate.addLayer('UD', 0.0, 0.125e-3); laminate.addLayer('UD', 90.0, 0.125e-3); print(laminate.getA())"Then run one example:
python examples/python/CLT/example1.pyFinally run the test suite:
python -m unittest discover -s test -vThe installation is complete when the import check runs, the example prints
material properties, and the test suite ends with OK.
deactivateOpen your WSL distribution, for example Ubuntu, and run these commands in the Linux terminal.
python3 --versionYou should see Python 3.10 or newer. If Python is missing, install it with:
sudo apt update
sudo apt install python3 python3-venv python3-pip gitWith git:
git clone https://github.com/jjcremmers/pycomposites.git
cd pycompositesWithout git, download the repository as a ZIP file on Windows, unzip it, and
copy or move it into your WSL home directory. Working inside the Linux home
directory, for example /home/yourname/pycomposites, is usually faster and
more reliable than working under /mnt/c/....
python3 -m venv .venv
source .venv/bin/activateAfter activation, your prompt usually starts with (.venv).
python -m pip install --upgrade pippython -m pip install .To run plotting examples and Jupyter notebooks as well, install the optional example dependencies:
python -m pip install ".[examples]"For local development, use editable mode instead:
python -m pip install -e ".[examples]"python -c "from pycomposites import TransverseIsotropic, Laminate; material = TransverseIsotropic([135e9, 10e9], 0.3, 5e9); laminate = Laminate(); laminate.addMaterial('UD', material); laminate.addLayer('UD', 0.0, 0.125e-3); laminate.addLayer('UD', 90.0, 0.125e-3); print(laminate.getA())"
python examples/python/CLT/example1.py
python -m unittest discover -s test -vThe installation is complete when the import check runs, the example prints
material properties, and the test suite ends with OK.
deactivateStandalone Python examples are in:
examples/python/CLTexamples/python/PlateEquations
Run one from the repository root after installation:
python examples/python/CLT/example1.pyNotebook examples are in examples/jupyter.
Run the test suite from the repository root with the virtual environment activated:
python -m unittest discover -s test -v