Warning This repository is experimental and bare-bones at the moment. It's not ready for use, but discussions and contributions are welcome!
You can pronounce this package like "slurpee," or really any other way you
want. This celerpy
package will be the Python-based front end to the
Celeritas binary codes and
include a user-friendly execution interface, visualization components, and
postprocessing utilities.
Development is a little weird if you're not used to modern python projects,
especially because python development and packaging evolves so
quickly.
To isolate the development environment, pyenv
and pip
install a toolchain locally.
External dependencies (easily installed through Homebrew or another package manager):
- pyenv, which will install its own python versions in an isolated environment
After cloning the repository, run make pre-commit
to:
- Install the development version of python specified in
.python-version
to yourpyenv
prefix (default:~/.pyenv
, configurable with thePYENV_ROOT
variable) - Set up a virtual environment in
.venv
that will contain all the development dependencies, including acelerpy
symlink in its environment that will point to your working copy - Install pre-commit hooks that use the tools just installed in your virtual environment.
At this point you can modify the python code and run tests without having to
reinstall the dependencies, and every git commit
will run the tests
automatically. (Use git commit --no-verify
to disable.)
The makefile specifies a few useful targets:
style
: apply style fixups to all the python files in developmenttest
: run testspip
: reinstall all the dependencies in your virtual environmentrebuild_dependencies
: update therequirements
file if you add a new dependency topyproject.toml
You can also test independently once your virtual environment is set up. For example, to run a single python test function from a single python test, with the most verbose output and sending stdout/stderr to the console, run:
$ . .venv/bin/activate
$ pytest -vv -s test/test_process.py -k test_context