Skip to content

Commit 847e7cc

Browse files
committed
Removing unnecessary dependencies
1 parent 0465209 commit 847e7cc

3 files changed

Lines changed: 224 additions & 31 deletions

File tree

install.sh

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Brand Colors (True Color / 24-bit)
6+
YELLOW='\033[38;2;224;255;110m' # #E0FF6E
7+
GREEN='\033[38;2;121;252;150m' # #79FC96
8+
GREEN_LIGHT='\033[38;2;197;220;217m' # #C5DCD9
9+
GREEN_DARK='\033[38;2;34;57;54m' # #223936
10+
BLUE='\033[38;2;10;31;212m' # #0A1FD4
11+
BLACK='\033[38;2;26;26;26m' # #1A1A1A
12+
WHITE='\033[38;2;255;255;255m' # #FFFFFF
13+
RED='\033[38;2;239;68;68m' # #EF4444
14+
GRAY='\033[38;2;128;128;128m' # #808080
15+
GRAY_LIGHT='\033[38;2;211;211;211m' # #D3D3D3
16+
BOLD='\033[1m'
17+
NC='\033[0m' # No Color / Reset
18+
19+
# Required Python version
20+
REQUIRED_MAJOR=3
21+
REQUIRED_MINOR=11
22+
23+
# Detect OS
24+
detect_os() {
25+
if [[ "$OSTYPE" == "darwin"* ]]; then
26+
echo "macos"
27+
elif [[ -f /etc/debian_version ]]; then
28+
echo "debian"
29+
elif [[ -f /etc/redhat-release ]]; then
30+
echo "redhat"
31+
else
32+
echo "unknown"
33+
fi
34+
}
35+
36+
echo -e "started ${YELLOW}${BOLD}*codeplain CLI${NC} installation..."
37+
38+
# Install Python based on OS
39+
install_python() {
40+
local os=$(detect_os)
41+
42+
case $os in
43+
macos)
44+
if command -v brew &> /dev/null; then
45+
echo -e "installing Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR} via Homebrew..."
46+
brew install python@${REQUIRED_MAJOR}.${REQUIRED_MINOR}
47+
else
48+
echo -e "${RED}Error: Homebrew is not installed.${NC}"
49+
echo "please install Homebrew first: https://brew.sh"
50+
echo "or install Python manually from: https://www.python.org/downloads/"
51+
exit 1
52+
fi
53+
;;
54+
debian)
55+
echo -e "installing Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR} via apt..."
56+
sudo apt update
57+
sudo apt install -y python${REQUIRED_MAJOR}.${REQUIRED_MINOR} python${REQUIRED_MAJOR}.${REQUIRED_MINOR}-venv python3-pip
58+
;;
59+
redhat)
60+
echo -e "installing Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR} via dnf..."
61+
sudo dnf install -y python${REQUIRED_MAJOR}.${REQUIRED_MINOR}
62+
;;
63+
*)
64+
echo -e "${RED}Error: Automatic installation not supported for your OS.${NC}"
65+
echo "please install Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR} manually from:"
66+
echo " https://www.python.org/downloads/"
67+
exit 1
68+
;;
69+
esac
70+
}
71+
72+
# Prompt user to install Python
73+
prompt_install_python() {
74+
echo ""
75+
read -p "$(echo -e ${YELLOW}would you like to install Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR}? \(Y/n\): ${NC})" response
76+
case "$response" in
77+
[yY][eE][sS]|[yY]|"")
78+
install_python
79+
echo ""
80+
echo -e "${GREEN}✓ python installed.${NC} please restart your terminal and run this script again."
81+
exit 0
82+
;;
83+
*)
84+
echo -e "${YELLOW}installation cancelled.${NC}"
85+
exit 1
86+
;;
87+
esac
88+
}
89+
90+
# Check if python3 or python is installed
91+
if command -v python3.11 &> /dev/null; then
92+
PYTHON_CMD="python3.11"
93+
elif command -v python3 &> /dev/null; then
94+
PYTHON_CMD="python3"
95+
elif command -v python &> /dev/null; then
96+
PYTHON_CMD="python"
97+
else
98+
echo -e "${RED}error: Python 3 is not installed.${NC}"
99+
prompt_install_python
100+
fi
101+
102+
# Get Python version
103+
PYTHON_VERSION=$($PYTHON_CMD -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
104+
PYTHON_MAJOR=$(echo "$PYTHON_VERSION" | cut -d. -f1)
105+
PYTHON_MINOR=$(echo "$PYTHON_VERSION" | cut -d. -f2)
106+
107+
# Check version
108+
if [ "$PYTHON_MAJOR" -lt "$REQUIRED_MAJOR" ] || \
109+
([ "$PYTHON_MAJOR" -eq "$REQUIRED_MAJOR" ] && [ "$PYTHON_MINOR" -lt "$REQUIRED_MINOR" ]); then
110+
echo -e "${RED}error: Python ${REQUIRED_MAJOR}.${REQUIRED_MINOR} or greater is required.${NC}"
111+
echo -e "found: python ${YELLOW}${PYTHON_VERSION}${NC}"
112+
prompt_install_python
113+
fi
114+
115+
echo -e ""
116+
echo -e "${GREEN}${NC} python ${BOLD}${PYTHON_VERSION}${NC} detected"
117+
echo -e ""
118+
# Use python -m pip for reliability
119+
PIP_CMD="$PYTHON_CMD -m pip"
120+
121+
# Install or upgrade codeplain
122+
if $PIP_CMD show codeplain &> /dev/null; then
123+
CURRENT_VERSION=$($PIP_CMD show codeplain | grep "^Version:" | cut -d' ' -f2)
124+
echo -e "${GRAY}codeplain ${CURRENT_VERSION} is already installed.${NC}"
125+
echo -e "upgrading to latest version..."
126+
echo -e ""
127+
$PIP_CMD install --upgrade codeplain &> /dev/null
128+
NEW_VERSION=$($PIP_CMD show codeplain | grep "^Version:" | cut -d' ' -f2)
129+
if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then
130+
echo -e "${GREEN}${NC} codeplain is already up to date (${NEW_VERSION})"
131+
else
132+
echo -e "${GREEN}${NC} codeplain upgraded from ${CURRENT_VERSION} to ${NEW_VERSION}!"
133+
fi
134+
else
135+
echo -e "installing codeplain...${NC}"
136+
echo -e ""
137+
$PIP_CMD install codeplain &> /dev/null
138+
echo -e "${GREEN}✓ codeplain installed successfully!${NC}"
139+
fi
140+
141+
echo -e "${GREEN}${NC} the latest version of *codeplain CLI is now installed."
142+
echo ""
143+
echo -e "go to ${YELLOW}https://platform.codeplain.ai${NC} and sign up to get your API key."
144+
echo ""
145+
read -p "paste your API key here: " API_KEY
146+
echo ""
147+
148+
if [ -z "$API_KEY" ]; then
149+
echo -e "${GRAY}no API key provided. you can set it later with:${NC}"
150+
echo -e " export CODEPLAIN_API_KEY=\"your_api_key\""
151+
else
152+
# Export for current session
153+
export CODEPLAIN_API_KEY="$API_KEY"
154+
155+
# Detect user's default shell from $SHELL (works even when script runs in different shell)
156+
case "$SHELL" in
157+
*/zsh)
158+
SHELL_RC="$HOME/.zprofile"
159+
;;
160+
*/bash)
161+
if [[ "$OSTYPE" == "darwin"* ]]; then
162+
# macOS uses .bash_profile for login shells
163+
SHELL_RC="$HOME/.bash_profile"
164+
else
165+
SHELL_RC="$HOME/.bashrc"
166+
fi
167+
;;
168+
*)
169+
SHELL_RC="$HOME/.profile"
170+
;;
171+
esac
172+
173+
# Create the file if it doesn't exist
174+
touch "$SHELL_RC"
175+
176+
# Add to shell config if not already present
177+
if ! grep -q "CODEPLAIN_API_KEY" "$SHELL_RC" 2>/dev/null; then
178+
echo "" >> "$SHELL_RC"
179+
echo "# codeplain API Key" >> "$SHELL_RC"
180+
echo "export CODEPLAIN_API_KEY=\"$API_KEY\"" >> "$SHELL_RC"
181+
echo -e "${GREEN}✓ API key saved to ${SHELL_RC}${NC}"
182+
else
183+
# Update existing key (different sed syntax for macOS vs Linux)
184+
if [[ "$OSTYPE" == "darwin"* ]]; then
185+
sed -i '' "s|export CODEPLAIN_API_KEY=.*|export CODEPLAIN_API_KEY=\"$API_KEY\"|" "$SHELL_RC"
186+
else
187+
sed -i "s|export CODEPLAIN_API_KEY=.*|export CODEPLAIN_API_KEY=\"$API_KEY\"|" "$SHELL_RC"
188+
fi
189+
echo -e "${GREEN}${NC} API key added to ${SHELL_RC}"
190+
fi
191+
192+
fi
193+
194+
# ASCII Art Welcome
195+
echo ""
196+
echo -e "${NC}"
197+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
198+
echo -e ""
199+
cat << 'EOF'
200+
_ _ _
201+
___ ___ __| | ___ _ __ | | __ _(_)_ __
202+
/ __/ _ \ / _` |/ _ \ '_ \| |/ _` | | '_ \
203+
| (_| (_) | (_| | __/ |_) | | (_| | | | | |
204+
\___\___/ \__,_|\___| .__/|_|\__,_|_|_| |_|
205+
|_|
206+
EOF
207+
echo ""
208+
echo -e " ${YELLOW}welcome to *codeplain!${NC}"
209+
echo ""
210+
echo -e " spec-driven, production-ready code generation"
211+
echo ""
212+
echo ""
213+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
214+
echo ""
215+
echo -e " thank you for using *codeplain!"
216+
echo ""
217+
echo -e " run '${YELLOW}${BOLD}codeplain <path_to_plain_file>${NC}' to get started."

plain2code.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
get_log_file_path,
2828
)
2929
from plain2code_state import RunState
30-
from plain2code_utils import print_dry_run_output
3130
from system_config import system_config
3231
from tui.plain2code_tui import Plain2CodeTUI
3332

@@ -107,6 +106,8 @@ def setup_logging(
107106
logging.getLogger("services.langsmith.langsmith_service").setLevel(logging.WARNING)
108107
logging.getLogger("transitions").setLevel(logging.WARNING)
109108
logging.getLogger("repositories").setLevel(logging.WARNING)
109+
logging.getLogger("google_genai").setLevel(logging.WARNING)
110+
logging.getLogger("openai").setLevel(logging.WARNING)
110111

111112
log_file_path = get_log_file_path(plain_file_path, log_file_name)
112113

@@ -120,17 +121,6 @@ def setup_logging(
120121
except Exception as e:
121122
console.warning(f"Failed to load logging configuration from {args.logging_config_path}: {str(e)}")
122123

123-
# Silence noisy third-party libraries
124-
logging.getLogger("urllib3").setLevel(logging.WARNING)
125-
logging.getLogger("httpx").setLevel(logging.WARNING)
126-
logging.getLogger("httpcore").setLevel(logging.WARNING)
127-
logging.getLogger("anthropic").setLevel(logging.WARNING)
128-
logging.getLogger("langsmith").setLevel(logging.WARNING)
129-
logging.getLogger("git").setLevel(logging.WARNING)
130-
logging.getLogger("openai").setLevel(logging.WARNING)
131-
logging.getLogger("transitions").setLevel(logging.WARNING)
132-
logging.getLogger("google_genai").setLevel(logging.WARNING)
133-
134124
# Allow detailed retry logs for anthropic if needed
135125
logging.getLogger("anthropic._base_client").setLevel(logging.DEBUG)
136126
if logging.getLogger("anthropic._base_client").level == logging.DEBUG:

pyproject.toml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "codeplain"
7-
version = "0.1.3"
7+
version = "0.1.6"
88
description = "Transform plain language specifications into working code"
99
readme = "README.md"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.11"
1111
classifiers = [
1212
"Environment :: Console",
1313
"Intended Audience :: Developers",
@@ -17,27 +17,13 @@ classifiers = [
1717
dependencies = [
1818
"python-liquid2==0.3.0",
1919
"mistletoe==1.3.0",
20-
"langchain==1.0.8",
21-
"langchain-core==1.2.3",
22-
"langchain-openai==1.0.3",
23-
"langchain-anthropic==1.1.0",
24-
"langchain-aws==1.0.0",
25-
"langchain-cerebras==0.8.0",
26-
"langchain-google-genai==4.1.2",
27-
"langchain-ollama==1.0.0",
28-
"requests==2.32.3",
29-
"langsmith==0.4.4",
30-
"rich==14.2.0",
20+
"requests==2.32.3",
3121
"tiktoken==0.12.0",
3222
"PyYAML==6.0.2",
3323
"gitpython==3.1.42",
34-
"lizard==1.18.0",
35-
"textual==1.0.0",
36-
"SQLAlchemy==2.0.36",
37-
"psycopg2==2.9.10",
38-
"python-dotenv==1.1.0",
3924
"transitions==0.9.3",
40-
"cryptography==46.0.1",
25+
"textual==1.0.0",
26+
"rich==14.2.0",
4127
"python-frontmatter==1.1.0",
4228
"networkx==3.6.1"
4329
]

0 commit comments

Comments
 (0)