Skip to content

Commit 6aea9dc

Browse files
authored
feat: Conda/Mamba-based installation script (#138)
* feat: conda or mamba-based installation script * docs: conda-based installation script * fix: reflect README * feat: getopts for -h option * feat: detects an existing mellea environment and try to remove it * feat: added -y option * fix: enforce VLLM_USE_V1 = 0
1 parent 4622c99 commit 6aea9dc

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ uv run --with mellea docs/examples/tutorial/example.py
111111
| MCP | <a target="_blank" rel="noopener noreferrer" href="https://colab.research.google.com/github/generative-computing/mellea/blob/main/docs/examples/notebooks/mcp_example.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> | Mellea + MCP |
112112
113113
114-
### Installing from source
114+
### `uv`-based installation from source
115115
116116
Fork and clone the repositoy:
117117
@@ -137,7 +137,7 @@ If you are planning to contribute to the repo, it would be good to have all the
137137
uv pip install '.[all]' --group dev --group notebook --group docs
138138
```
139139
140-
or
140+
or
141141
142142
```bash
143143
uv sync --all-extras --all-groups
@@ -149,6 +149,20 @@ If you want to contribute, ensure that you install the precommit hooks:
149149
pre-commit install
150150
```
151151
152+
### `conda`/`mamba`-based installation from source
153+
154+
Fork and clone the repositoy:
155+
156+
```bash
157+
git clone ssh://git@github.com/<my-username>/mellea.git && cd mellea/
158+
```
159+
160+
It comes with an installation script, which does all the commands listed above:
161+
162+
```bash
163+
conda/install.sh
164+
```
165+
152166
## Getting started with validation
153167
154168
Mellea supports validation of generation results through a **instruct-validate-repair** pattern.

conda/environment.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
name: mellea
3+
channels:
4+
- conda-forge
5+
dependencies:
6+
- python=3.12 # note: at the time of writing, xformer (< vllm) has a broken wheel for 3.13. https://github.com/facebookresearch/xformers/issues/740#issuecomment-2753869337
7+
- uv
8+
variables:
9+
VLLM_USE_V1: 0 # need this to make outlines work

conda/install.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash -e
2+
3+
CONDA=""
4+
if which mamba > /dev/null
5+
then
6+
CONDA=$(which mamba)
7+
fi
8+
if which conda > /dev/null
9+
then
10+
CONDA=$(which conda)
11+
fi
12+
13+
if [ -z $CONDA ]
14+
then
15+
echo "Error: conda or mamba is not installed or is not in the PATH."
16+
echo "Go to "
17+
echo "* https://github.com/conda-forge/miniforge (open source)"
18+
echo "* https://www.anaconda.com/download/success (registration required)"
19+
echo "to obtain a conda/mamba installer."
20+
else
21+
echo "Using $CONDA for environment setup"
22+
fi
23+
24+
25+
usage(){
26+
echo "Usage: install.sh [-h] [-y]"
27+
echo
28+
echo "-h : show this help"
29+
echo "-y : Adds '-y' option to '$CONDA env [create|remove|...]' command arguments."
30+
exit 1
31+
}
32+
33+
CONDA_OPTIONS=""
34+
while getopts "yh" OPTNAME ; do
35+
case "${OPTNAME}" in
36+
h)
37+
usage
38+
;;
39+
y)
40+
CONDA_OPTIONS="-y"
41+
shift 1
42+
;;
43+
:)
44+
# If expected argument omitted:
45+
echo "Error: -${OPTARG} requires an argument."
46+
exit 1
47+
;;
48+
*)
49+
# If unknown (any other) option:
50+
echo "Error: -${OPTARG} unknown."
51+
exit 1
52+
;;
53+
esac
54+
done
55+
56+
if $CONDA env list | grep -q mellea
57+
then
58+
echo "An existing mellea environment was found."
59+
$CONDA env remove $CONDA_OPTIONS -n mellea
60+
fi
61+
62+
63+
# note:
64+
# this is a portable way (works in linux and osx) to get the directory of this script.
65+
# readlink -ef may not work on osx.
66+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
67+
$CONDA env create $CONDA_OPTIONS -f $SCRIPT_DIR/environment.yml
68+
69+
$CONDA run -n mellea uv pip install -e .[all] --group dev --group notebook --group docs
70+
71+
$CONDA run -n mellea pre-commit install

0 commit comments

Comments
 (0)