shaikhmohammedmujammil commited on
Commit
855cb7a
·
verified ·
1 Parent(s): d1b238b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +167 -0
README.md CHANGED
@@ -12,3 +12,170 @@ short_description: SDLC v2 improvement in UI and UX
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
15
+
16
+ # AI-Powered SDLC Orchestrator (Streamlit App)
17
+
18
+ [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/shaikhmohammedmujammil/SDLCv2)
19
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
20
+ `sdk: streamlit` `sdk_version: 1.44.0` `app_file: app.py`
21
+
22
+ ## Description
23
+
24
+ This application orchestrates a simplified Software Development Lifecycle (SDLC) workflow using Large Language Models (LLMs) via LangChain, all within an interactive Streamlit interface. It guides users through key SDLC stages, from initial requirements gathering to deployment planning. AI generates artifacts at each stage, and the workflow incorporates both AI and human feedback loops for iterative refinement.
25
+
26
+ The core AI logic, state definitions, Pydantic models, and artifact saving/conversion are handled by `SDLC.py`, while `app.py` manages the Streamlit frontend, user interactions, state transitions, and display logic.
27
+
28
+ ## Key Features & UI/UX Improvements
29
+
30
+ * **Multi-Stage SDLC Simulation:** Covers requirements, user stories, product review, design, UML, code generation, review & security, testing, quality analysis, and deployment planning.
31
+ * **Cycle-Based Chat History:**
32
+ * **Problem Solved:** Traditional single chat histories become cluttered and confusing across multiple feedback loops.
33
+ * **Solution:** Each SDLC cycle (e.g., User Story Refinement, Design Refinement) now maintains its **own distinct chat history**.
34
+ * **Benefits:** Users can easily track the input-output exchanges *within* a specific cycle, see the latest refined artifact clearly, provide targeted feedback, and make informed decisions (Refine/Approve) without overwhelming history. The history resets when moving to the next major cycle.
35
+ * **Interactive Feedback Loops:** Integrates AI-generated feedback with dedicated human input areas at multiple decision points.
36
+ * **Flexible LLM Configuration:** Select LLM providers (OpenAI, Groq, Google, Anthropic, xAI) and models directly in the UI. API keys are entered securely via password fields.
37
+ * **Tavily Web Search:** Optional integration with Tavily API for web searches during code refinement based on user-reported errors.
38
+ * **Artifact Generation & Saving:**
39
+ * Creates `.md` files for text artifacts (User Stories, Design Doc, etc.).
40
+ * Attempts to generate `.pdf` versions of Markdown artifacts using `WeasyPrint` for improved readability and sharing.
41
+ * Generates `.puml` files for UML diagrams.
42
+ * Attempts `.png` image generation for UML via `PlantUML` library (requires local Java/PlantUML setup).
43
+ * Saves code files and instructions, organized into stage-specific folders.
44
+ * **Downloadable Artifacts:** Provides download buttons in the sidebar for:
45
+ * Key documents (Refined Prompt, User Story, PO Review, Design Doc, QA Report, Deployment Plan) in both **MD and PDF** formats (where PDF generation succeeds).
46
+ * UML diagrams as `.png` images (if generated successfully).
47
+ * Code snapshots as `.zip` archives from critical stages (Review, Testing, Final).
48
+ * A full project `.zip` archive at the end of the workflow.
49
+ * **Workflow Visualization:** Includes a static graph diagram (`SDLC_Workflow_Graph_Diagram.png`) illustrating the general application flow.
50
+ * **Robust State Management:** Uses Streamlit's session state effectively.
51
+ * **Error Handling & Retry:** Uses Tenacity for automatic retries on LLM calls and validation steps, with UI feedback on persistent errors.
52
+
53
+ ## Workflow Diagram
54
+
55
+ ![SDLC Workflow Diagram](SDLC_Workflow_Graph_Diagram.png)
56
+ *(This diagram illustrates the general flow of stages and decision points within the application)*
57
+
58
+ ## Technology Stack
59
+
60
+ * **Frontend:** Python, Streamlit
61
+ * **Backend Logic:** Python
62
+ * **AI Orchestration:** LangChain (`langchain`, `langchain-core`, `langchain-openai`, `langchain-groq`, `langchain-google-genai`, `langchain-anthropic`)
63
+ * **LLM APIs:** OpenAI, Groq, Google Generative AI, Anthropic, xAI (via OpenAI compatibility)
64
+ * **Web Search:** Tavily API
65
+ * **Markdown -> PDF:** `markdown-it-py`, `WeasyPrint`
66
+ * **UML Generation:** `plantuml` library (requires Java/PlantUML setup for PNGs)
67
+ * **Data Validation:** Pydantic V2
68
+ * **Retry Logic:** Tenacity
69
+ * **Environment Mgmt:** `python-dotenv`
70
+ * **Async Handling:** `nest_asyncio`
71
+
72
+ ## Setup & Local Run
73
+
74
+ ### Prerequisites
75
+
76
+ * Python 3.9+
77
+ * Git
78
+ * **For PDF Generation:** System dependencies for `WeasyPrint` (Pango, Cairo, GDK-PixBuf). Installation varies by OS.
79
+ * **Windows:** Install GTK3 runtime via [MSYS2](https://www.msys2.org/) (install `mingw-w64-x86_64-gtk3` package) and ensure the `msys64/mingw64/bin` directory is added to your system PATH. Restart required.
80
+ * **macOS:** `brew install pango gdk-pixbuf cairo`
81
+ * **Linux (Debian/Ubuntu):** `sudo apt-get update && sudo apt-get install -y libpango-1.0-0 libcairo2 libgdk-pixbuf-2.0-0`
82
+ * **For UML PNG Generation (Optional):** Java Runtime Environment (JRE/JDK) installed and added to your system's PATH. Test with `java -version`. You might also need Graphviz (`dot`) for some diagram types.
83
+
84
+ ### Steps
85
+
86
+ 1. **Clone the Repository:**
87
+ ```bash
88
+ git clone https://huggingface.co/spaces/shaikhmohammedmujammil/SDLCv2
89
+ cd SDLCv2
90
+ ```
91
+
92
+ 2. **Create Virtual Environment (Recommended):**
93
+ ```bash
94
+ python -m venv venv
95
+ # Activate it:
96
+ # Windows:
97
+ .\venv\Scripts\activate
98
+ # macOS/Linux:
99
+ source venv/bin/activate
100
+ ```
101
+
102
+ 3. **Install Dependencies:**
103
+ ```bash
104
+ pip install -r requirements.txt
105
+ ```
106
+ *(If you encounter errors here related to WeasyPrint or its dependencies, ensure you've installed the system prerequisites listed above.)*
107
+
108
+ 4. **Environment Variables (`.env` file - Optional for local convenience):**
109
+ * Create `.env` in the root directory.
110
+ * You can add API keys here for local testing *if you modify `app.py` to read them*, but the primary method is via the UI.
111
+ ```dotenv
112
+ # Example (Keys entered in UI are preferred)
113
+ # OPENAI_API_KEY="sk-..."
114
+ # GROQ_API_KEY="gsk_..."
115
+ # GOOGLE_API_KEY="..."
116
+ # ANTHROPIC_API_KEY="..."
117
+ # TAVILY_API_KEY="tvly-..."
118
+ ```
119
+ * **Important:** Add `.env` to your `.gitignore` file.
120
+
121
+ 5. **Run the Streamlit App:**
122
+ ```bash
123
+ streamlit run app.py
124
+ ```
125
+
126
+ 6. **Configure in UI:**
127
+ * Open the app in your browser (usually `http://localhost:8501`).
128
+ * Expand "Configuration" in the sidebar.
129
+ * Select your LLM Provider and Model.
130
+ * Enter the corresponding LLM API Key.
131
+ * Enter your Tavily API Key (optional for web search).
132
+ * Click "Apply Configuration".
133
+
134
+ 7. **Start Workflow:** After successful configuration, fill out the "Project Configuration" form in the main area and click "Start Workflow". Follow the prompts through each SDLC cycle.
135
+
136
+ ## Configuration (API Keys & Models)
137
+
138
+ * Configuration is handled entirely through the **Streamlit UI Sidebar** after launching the app.
139
+ * Select the LLM provider and model.
140
+ * Enter the API keys securely using the password input fields.
141
+ * Click "Apply Configuration" to initialize the backend clients.
142
+ * **Security Note:** Keys entered in the UI are stored only in the active session's memory and are not saved persistently by the application. For deployments, use platform secrets (see Hugging Face guide).
143
+
144
+ ## Hugging Face Spaces Deployment Guide
145
+
146
+ Deploying to Hugging Face Spaces requires handling secrets and understanding dependency limitations.
147
+
148
+ ### Steps
149
+
150
+ 1. **Create Space:** Follow the standard procedure on Hugging Face, selecting the "Streamlit" SDK.
151
+ 2. **Upload Files:** Use Git (recommended) or the UI uploader to add `app.py`, `SDLC.py`, `requirements.txt`, and optionally `SDLC_Workflow_Graph_Diagram.png` to your Space repo.
152
+ 3. **Configure Secrets (CRITICAL):**
153
+ * Go to your Space **Settings -> Secrets**.
154
+ * Add secrets for any API keys you want users to *not* have to enter manually every time. Use names like `LLM_API_KEY`, `TAVILY_API_KEY`, `GOOGLE_API_KEY`, etc.
155
+ * **(Optional but Recommended):** Modify the `st.text_input` calls for API keys in `app.py` to use `os.environ.get("SECRET_NAME", "")` as the default `value`. This pre-fills the fields if the secret exists, but still allows users to override them.
156
+ ```python
157
+ # Example in app.py sidebar
158
+ # llm_key_secret = os.environ.get("YOUR_LLM_SECRET_NAME", "") # Get secret
159
+ # llm_api_key_input = st.text_input(..., value=st.session_state.get("llm_api_key", llm_key_secret))
160
+ ```
161
+ 4. **System Dependencies (WeasyPrint/PlantUML):**
162
+ * **WeasyPrint:** The standard Streamlit environment **lacks the necessary C libraries** (Pango, Cairo, etc.). PDF generation **will fail** unless you deploy using a custom **Dockerfile** that installs these system dependencies. Create a `Dockerfile` in your repo (see WeasyPrint/HF Docker guides) and point your Space settings to use it instead of the default SDK.
163
+ * **PlantUML:** PNG generation requires **Java**, which is also **not included** by default. This will fail unless using a custom Dockerfile that includes a JRE/JDK.
164
+ * **Simplest Approach:** Accept that PDF and UML PNG generation may not work on the default HF Space environment. The app will still function, saving `.md` and `.puml` files. You can modify `SDLC.py` to gracefully skip these conversions or update UI captions.
165
+ 5. **Check Build & Runtime Logs:** Monitor logs in your Space for installation or startup errors.
166
+
167
+ ## Limitations & Future Work
168
+
169
+ * **System Dependencies:** PDF/UML PNG generation requires specific system libraries not present in default cloud environments like HF Spaces unless using custom Docker images.
170
+ * **Error Handling:** While retries are implemented, complex LLM or state errors might necessitate a manual restart via the sidebar button.
171
+ * **State Persistence:** Workflow progress is lost when the session ends.
172
+ * **Context Limits:** Long documents or codebases might exceed LLM context windows, potentially impacting the quality of later-stage artifacts.
173
+ * **UML Feedback UI:** Human feedback for UML is currently collected globally, not per-diagram.
174
+
175
+ ## Contributing
176
+
177
+ (Optional: Add contribution guidelines)
178
+
179
+ ## License
180
+
181
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details (or link to standard license text).