Skip to content

Commit 14cdef9

Browse files
committed
feat: add poetry setup dev
1 parent 3a2185f commit 14cdef9

16 files changed

+157
-10
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Shared Scripts Development Rules
2+
3+
## Code Quality
4+
5+
- Run `make lint` at the end of any code changes to ensure code quality
6+
7+
## Discussion Mode
8+
9+
- **Discussion Mode**: Prefix prompt with "D:" to enter read-only discussion mode
10+
- In discussion mode: NO code updates, only read files and provide analysis/suggestions
11+
- Always start responses with "[Discussion Mode]" header when in discussion mode
12+
- Never exit discussion mode automatically - only when user uses "XD:" prefix
13+
- If user seems to want code changes, remind them to use "XD:" to exit discussion mode
14+
- **Exit Discussion**: Use "XD:" prefix to exit discussion mode and resume normal operations
15+
16+
## Project Structure
17+
18+
- Follow the existing module organization by language/tool (`node/`, `rust/`, `python/`, `common/`, `shell/`)
19+
- Place setup scripts as `setup_dev.sh` and validation scripts as `assert_setup_dev.sh`
20+
- Maintain separation between different tool ecosystems

common/update_brew.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
brew update
66
brew upgrade

node/assert_tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
echo "Node: $(which node)"
66
echo "NPM: $(which npm)"

node/load_nvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
export NVM_DIR="$HOME/.nvm"
66
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

node/setup_dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
chmod +x "$(dirname "$0")/setup_zshrc_nvm.sh"
66
"$(dirname "$0")/setup_zshrc_nvm.sh"

node/setup_zshrc_nvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
if ! grep -q "# >>> nvm initialize >>>" ~/.zshrc; then
66
if [ -s ~/.zshrc ] && [ "$(tail -c 1 ~/.zshrc | wc -l)" -eq 0 ]; then

node/update_node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

55
chmod +x "$(dirname "$0")/load_nvm.sh"
66
source "$(dirname "$0")/load_nvm.sh"

python/poetry/assert_setup_dev.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
echo "Asserting setup_dev..."
6+
7+
chmod +x "$(dirname "$0")/assert_python_poetry.sh"
8+
"$(dirname "$0")/assert_python_poetry.sh"
9+
10+
make lint test 2>/dev/null || just lint test 2>/dev/null || {
11+
echo "❌ Error: Neither Makefile nor justfile found with lint and test targets"
12+
exit 1
13+
}

python/poetry/setup_dev.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
set -exx
4+
5+
while [[ $# -gt 0 ]]; do
6+
case $1 in
7+
--colima-docker)
8+
COLIMA_DOCKER=true
9+
shift
10+
;;
11+
--python-version)
12+
PYTHON_VERSION="$2"
13+
shift
14+
shift
15+
;;
16+
--just)
17+
JUST=true
18+
shift
19+
;;
20+
*)
21+
echo "Unknown option $1"
22+
exit 1
23+
;;
24+
esac
25+
done
26+
27+
chmod +x "$(dirname "$0")/../clean.sh"
28+
"$(dirname "$0")/../clean.sh"
29+
30+
chmod +x "$(dirname "$0")/../clean_venv.sh"
31+
"$(dirname "$0")/../clean_venv.sh"
32+
33+
chmod +x "$(dirname "$0")/../../common/update_brew.sh"
34+
"$(dirname "$0")/../../common/update_brew.sh"
35+
36+
chmod +x "$(dirname "$0")/../setup_pyenv.sh"
37+
"$(dirname "$0")/../setup_pyenv.sh"
38+
39+
chmod +x "$(dirname "$0")/../setup_pipx.sh"
40+
"$(dirname "$0")/../setup_pipx.sh"
41+
42+
chmod +x "$(dirname "$0")/setup_poetry.sh"
43+
"$(dirname "$0")/setup_poetry.sh"
44+
45+
if [[ "$COLIMA_DOCKER" == "true" ]]; then
46+
echo "Ensure colima and docker are installed."
47+
brew install colima docker --quiet
48+
fi
49+
50+
if [[ "$JUST" == "true" ]]; then
51+
echo "Ensure just are installed."
52+
brew install just --quiet
53+
fi
54+
55+
echo "Setup local python to ${PYTHON_VERSION}"
56+
pyenv install "${PYTHON_VERSION}" --skip-existing
57+
58+
echo "Setup .venv"
59+
poetry env use "python${PYTHON_VERSION}"
60+
61+
chmod +x "$(dirname "$0")/../setup_venv_zshrc.sh"
62+
"$(dirname "$0")/../setup_venv_zshrc.sh"
63+
64+
poetry install
65+
poetry run pre-commit install

python/poetry/setup_poetry.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -exx
4+
5+
pipx install poetry
6+
pipx ensurepath
7+
poetry config virtualenvs.in-project true
8+
pipx inject poetry keyrings.google-artifactregistry-auth

0 commit comments

Comments
 (0)