Set Up Your Python App Environment
Follow these simple steps to get started with your Python application.
-
Install Python (version 3.10 or later):
- Go to the official website: https://www.python.org/downloads/
- Click the **“Download Python”** button for your operating system (Windows, macOS, or Linux).
- Important: On Windows, during installation, make sure to check the box that says “Add Python to PATH” at the bottom of the setup window.
- Then click **Install Now** and complete the setup.
python
. -
Install Visual Studio Code (VS Code):
- Download from code.visualstudio.com
- Launch VS Code after installing.
- Go to the Extensions sidebar (or press
Ctrl+Shift+X
), search for Python, and install the extension by Microsoft. - Open your project folder in VS Code and select your Python interpreter (
.venv/bin/python
or.venv\Scripts\python.exe
) via the Command Palette (Ctrl+Shift+P
→ “Python: Select Interpreter”).
-
Create your project folder:
mkdir my-app cd my-app
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # macOS/Linux .venv\\Scripts\\activate # Windows
-
Install essential packages:
Optional (for web app):pip install openai langchain faiss-cpu tiktoken chromadb
pip install flask flask-cors
-
Create a
.env
file:OPENAI_API_KEY=your_openai_key_here
-
Install and configure a vector database (ChromaDB):
- ChromaDB is a lightweight and easy-to-use vector database for local or cloud storage.
- Already included if you installed
chromadb
in step 5. - Use persistent storage to retain data between runs:
import chromadb client = chromadb.PersistentClient(path="./chroma-store")
-
Write your app logic (e.g.
app.py
):
You don't need to write everything from scratch. You can ask an LLM like ChatGPT or Copilot to generate the code for you — all you need is the right prompt.
Try this:Write Python code that uses OpenAI API to embed a user query,
search a ChromaDB vector store for the top 3 relevant documents,
and then send those results back to GPT-3.5 to generate an answer.
This approach allows you to focus on what you want to build — not every syntax detail. -
Run your app:
python app.py
-
Organize your project structure:
Once you've tested your basicapp.py
and confirmed it works, it's time to think about organizing your project for long-term development. Before writing serious logic or sharing your work on GitHub, a clean folder structure will make your code easier to scale, maintain, and collaborate on.
This layout helps keep your logic modular and production-ready.my-app/ ├── app/ │ ├── api/ # API route controllers │ ├── config/ # config files, etc. │ ├── service/ # Core business logic, Emebddings, storage, LLMs │ ├── ui/ # UI-facing logic and assets │ │ ├── static/ # JS/CSS/images │ │ ├── templates/ # HTML templates │ │ └── app_controller.py # (UI controller) │ ├── util/ # Logger, file utils, etc. │ └── main.py # ✅ App entry point │ ├── deploy/ # AWS ECS, AppRunner, etc. ├── logs/ # Log files ├── test/ # Pytest test suite ├── .dockerignore ├── .env # Environment config ├── .gitignore ├── Dockerfile # For containerization ├── README.md └── requirements.txt