Skip to content

micromechanical

mkdocs doxygen asv wakatime

Micromechanical model for granular materials

Install the package from pre-built wheels

Install GitHub CLI and Python 3.8+ first.

Download the latest pre-built wheels from GitHub releases and install them with pip (only if you have the access to the hailin-wang/micromechanical repository):

gh release download --pattern *.whl --pattern *.tar.gz --dir wheelhouse --clobber --repo hailin-wang/micromechanical
pip install --find-links wheelhouse micromechanical[all]

Build and install the package from source

Generate pybind11 binding sources

It is recommended to generate the pybind11 binding sources on Linux or Windows Subsystem for Linux (WSL) on Windows. Binder on Windows is not tested and may not work properly.

Install binder to generate the pybind11 binding sources:

pip install cppbinder==1.4.2.4

Make sure that the binder executable is in the system PATH. Type binder --help to see if the installation is successful. Update the configuration file micromechanical/cpp/binder_config.txt and micromechanical/cpp/binder-includes.hpp if necessary. Generate the pybind11 binding sources with the following command in the micromechanical/cpp directory:

cd micromechanical/cpp
make bindings

Reformat the generated pybind11 binding sources with (in the root directory):

make format

Build and install the package

Please install one of the following C/C++ compilers to build the C++ extension:

Install the package from the source with pip:

# Install dependencies with pinned versions
pip install -r https://micromechanical.hailin.wang/requirements.txt
pip install -e .[all]

or with pdm:

pip install pdm
pdm install --group :all

Generate the bindings stubs wit:

make stubs format

Run tests

Run tests with tox with all supported Python versions, backends, and precisions:

tox

or directly with pytest under the current Python version, preferred backend (cpp), and precision (double):

pytest