This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·129 lines (108 loc) · 2.61 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·129 lines (108 loc) · 2.61 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
#!/bin/bash
# SPDX-FileCopyrightText: 2025 Semiotic AI, Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Development and installation commands
python_command() {
poetry run python
}
shell_command() {
poetry shell
}
# Setup commands
permissions_command() {
chmod +x token-api/token.sh
}
dev_command() {
cd token-api
./token.sh dev
cd ..
}
# Rust crate commands
rust_build_command() {
echo "building rust crate..."
cd crates/tokenscout-dataset
cargo build --release
cd ../..
}
rust_bindings_command() {
echo "building and installing python bindings..."
# Get the virtual env path from the python project directory
VENV_PATH=$(cd token-api && poetry env info --path)
if [ -z "$VENV_PATH" ]; then
echo "Error: Poetry environment not found in token-api/"
echo "Please run './run.sh dev' or 'cd token-api && poetry install' first."
exit 1
fi
echo "Installing bindings into: $VENV_PATH"
cd crates/tokenscout-dataset
VIRTUAL_ENV="$VENV_PATH" maturin develop --release
cd ../..
}
rust_test_command() {
echo "running rust tests..."
cd crates/tokenscout-dataset
cargo test
cd ../..
}
# Pre-commit commands
pre_commit_command() {
cd token-api
./token.sh pre-commit
cd ..
}
# Helper function to show usage
show_usage() {
echo "Usage: $0 [command]"
echo "Commands:"
# Basic commands
echo " python - Run Python with Poetry environment"
echo " shell - Start a Poetry shell"
# Setup commands
echo " permissions - Set permissions for the token-api scripts"
echo " dev - Install dependencies for token-api"
# Rust crate commands
echo " rust-build - Build the Rust crate (release mode)"
echo " rust-bindings - Build and install Python bindings with maturin"
echo " rust-test - Run Rust tests"
# Pre-commit commands
echo " pre-commit - Run the pre-commit checks"
}
# Main execution logic
if [ $# -eq 0 ]; then
show_usage
exit 1
fi
command="$1"
shift
case "$command" in
python)
python_command "$@"
;;
shell)
shell_command "$@"
;;
permissions)
permissions_command "$@"
;;
dev)
dev_command "$@"
;;
rust-build)
rust_build_command "$@"
;;
rust-bindings)
rust_bindings_command "$@"
;;
rust-test)
rust_test_command "$@"
;;
pre-commit)
pre_commit_command "$@"
;;
*)
echo "Unknown command: $command"
show_usage
exit 1
;;
esac