Repository navigation
Expand file tree
/
Copy pathsetup_dev_env.sh
More file actions
executable file
·159 lines (144 loc) · 5.15 KB
/
Copy pathsetup_dev_env.sh
File metadata and controls
executable file
·159 lines (144 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
# setup_dev_env.sh - Create ssys_dev development environment using uv
#
# Usage:
# ./setup_dev_env.sh # Create environment (interactive)
# ./setup_dev_env.sh --force # Overwrite existing environment without prompting
#
# After running, activate with:
# source ssys_dev/bin/activate
#
# Or use the activate_dev_env.sh script for convenient activation.
set -e
ENV_NAME="ssys_dev"
FORCE=false
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--force|-f)
FORCE=true
shift
;;
--help|-h)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Create the ssys_dev development environment using uv."
echo ""
echo "Options:"
echo " --force, -f Overwrite existing environment without prompting"
echo " --help, -h Show this help message"
echo ""
echo "After setup, activate the environment with:"
echo " source ssys_dev/bin/activate"
echo ""
echo "Or use ./activate_dev_env.sh for convenient activation."
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information."
exit 1
;;
esac
done
# Check if uv is available
if ! command -v uv &> /dev/null; then
echo "Error: uv is not installed."
echo "Install it with: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
# Check for existing environment
if [ -d "$ENV_NAME" ]; then
if [ "$FORCE" = true ]; then
echo "Removing existing $ENV_NAME directory (--force)..."
rm -rf "$ENV_NAME"
else
echo "================================================"
echo "Warning: $ENV_NAME environment already exists!"
echo "================================================"
echo ""
echo "Options:"
echo " 1) To ACTIVATE the existing environment:"
echo " source $ENV_NAME/bin/activate"
echo ""
echo " 2) To RECREATE the environment, run:"
echo " $0 --force"
echo ""
read -p "Do you want to remove and recreate the environment? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
echo "Removing existing $ENV_NAME directory..."
rm -rf "$ENV_NAME"
;;
*)
echo "Aborted. Use 'source $ENV_NAME/bin/activate' to use the existing environment."
exit 0
;;
esac
fi
fi
echo "================================================"
echo "Setting up $ENV_NAME environment with uv"
echo "================================================"
# Create virtual environment with Python 3.12
# This ensures we get a native Python with compatible libroadrunner wheels
# (bypasses any conda/Rosetta Python installations)
echo "Creating virtual environment with Python 3.12..."
uv venv --python 3.12 "$ENV_NAME"
# Activate environment
echo "Activating environment..."
source "$ENV_NAME/bin/activate"
# Install package with dev extras
# Note: libroadrunner, antimony, and python-libsbml are now REQUIRED
# core dependencies (SBML-first architecture), not optional extras.
# Optional extras such as dae and jax are installed explicitly with uv sync.
echo "Installing ssys with dev tools..."
uv pip install -e ".[dev]"
# Verify installation
echo ""
echo "Verifying installation..."
if python -c "import ssys; print(f'ssys version: {ssys.__version__}')" 2>/dev/null; then
echo "✓ ssys installed successfully"
else
echo "✗ ssys import failed"
exit 1
fi
if python -c "import roadrunner; print(f'libroadrunner version: {roadrunner.__version__}')" 2>/dev/null; then
echo "✓ libroadrunner available"
else
echo "✗ libroadrunner NOT available - this is required!"
exit 1
fi
if python -c "import libsbml; print(f'libsbml version: {libsbml.getLibSBMLDottedVersion()}')" 2>/dev/null; then
echo "✓ libsbml available"
else
echo "✗ libsbml NOT available - this is required!"
exit 1
fi
# JAX is optional diagnostic acceleration and is not installed by this helper.
# Register Jupyter kernel for this environment
echo ""
echo "Registering Jupyter kernel..."
if python -m ipykernel install --user --name "$ENV_NAME" --display-name "Python ($ENV_NAME)" 2>/dev/null; then
echo "✓ Jupyter kernel '$ENV_NAME' registered"
else
echo "⚠ Jupyter kernel registration failed (ipykernel may not be installed)"
echo " You can manually register later with:"
echo " python -m ipykernel install --user --name $ENV_NAME --display-name \"Python ($ENV_NAME)\""
fi
echo ""
echo "================================================"
echo "Environment setup complete!"
echo "================================================"
echo ""
echo "To activate the environment:"
echo " source $ENV_NAME/bin/activate"
echo ""
echo "Or use the convenience script:"
echo " ./activate_dev_env.sh"
echo ""
echo "Quick start commands:"
echo " ssys-recast --help # Show CLI help"
echo " python recast_models.py test_models3 # Run test_models3 validation"
echo " pytest tests/ # Run unit tests"
echo ""