graintrace.neper_env#
Locate a user-provided NEPER binary and build a subprocess environment for it.
graintrace drives NEPER as an external tool; like CUBIT/SCULPT it is not a pip package and must be installed by the user. Install NEPER once (see https://neper.info/doc/introduction.html#installing-neper) and graintrace will find it, in this order:
an explicit
neper_path/env=passed to the builder,the
NEPERenvironment variable (absolute path to theneperbinary),the
neperkey of agraintrace_tools.json(seegraintrace.mcp.tool_paths),
neperonPATH(shutil.which).
gmsh, by contrast, is a pip package (declared in pyproject.toml and
installed with graintrace), so it needs no discovery here.
For the legacy convenience of a from-source build on Linux, pass
auto_install=True (opt-in): it builds GSL, OpenBLAS and NEPER into
~/.local exactly as older graintrace did. The default path never downloads or
compiles anything.
- graintrace.neper_env.find_neper(neper_path=None)[source]#
Resolve the
neperbinary path, orNoneif it cannot be found.Order: explicit
neper_path->NEPERenv var -> tools.jsonneperkey ->shutil.which("neper").
- graintrace.neper_env.build_env(neper_bin=None)[source]#
Copy
os.environand, given aneper_bin, put its dir/libs on the path.Prepends the binary’s directory to
PATHand the siblinglib/lib64of its install prefix toLD_LIBRARY_PATHso a self-built NEPER (e.g. under~/.local/bin) finds its GSL/OpenBLAS shared libraries.
- graintrace.neper_env.resolve_neper_env(neper_path=None, auto_install=False)[source]#
Return
(neper_bin, env)for driving NEPER, or raise a clear error.Looks NEPER up via
find_neper(). If not found andauto_installis True, builds it from source under~/.local(Linux only); otherwise raisesRuntimeErrorwith install guidance.