Let's build a Python Hello World Project with uv Using Cursor IDE's AI Agent
Introduction
This tutorial demonstrates how to build a Python project using uv dependency manager while leveraging Cursor IDE's AI agent to do most of the work automatically. Instead of typing code manually, you'll learn to use Cursor's AI capabilities to generate, modify, and manage your entire project.
Why Use Cursor's AI Agent?
Cursor's AI agent can:
- Generate entire project structures
- Write complete code files from descriptions
- Execute terminal commands for you
- Fix errors automatically
- Refactor and improve code
- Add tests and documentation
- Manage dependencies
Prerequisites
You only need:
- Cursor IDE installed (download from cursor)
- Internet connection for AI features
That's it! Cursor will help with everything else.
Setting up Cursor IDE
Step 1: Install and Launch Cursor
- Download Cursor from https://cursor.com/download
- Install it like any regular application
- Open Cursor IDE
Step 2: Enable AI Features
- When Cursor opens, sign in for full AI capabilities (recommended)
- You'll get access to ChatGPT, Claude, and other models
- The AI features will be available immediately
Step 3: Configure Cursor for Maximum Automation
- Press
Cmd+,(Mac) orCtrl+,(Windows/Linux) to open settings - Search for "AI" in settings
- Enable:
- "Auto-generate commit messages"
- "Apply suggestions automatically"
Installing uv Through Cursor
Instead of installing uv manually, let Cursor do it for you!
Method 1: Using Cursor's Terminal with AI
- Open Cursor's integrated terminal: `Ctrl+`` (backtick) or View → Terminal
- Click the AI Terminal button (sparkle icon) or press
Cmd+Kin the terminal - Type this request:
install uv package manager on my system - Cursor will:
- Detect your operating system
- Generate the correct installation command
- Ask for confirmation to run it
- Press Enter to execute
Method 2: Using Cursor Chat
- Press
Cmd+L(Mac) orCtrl+L(Windows/Linux) to open Cursor Chat - Type:
Please install uv Python package manager on my system and verify it's working - Cursor will provide the commands
- Click "Run" button next to each command
Creating Project with Cursor AI
Now let's create the entire project structure using Cursor's AI:
Step 1: Create Project Folder with AI
- Open Cursor Chat (
Cmd+L/Ctrl+L) - Type this prompt:
Create a new Python project folder called "hello-world-uv" on my desktop, open it in Cursor, and initialize it with uv - Cursor will generate and run the necessary commands
Step 2: Generate Complete Project Structure
In Cursor Chat, use this comprehensive prompt:
Please create a complete Python Hello World project with the following:
1. Initialize with uv init
2. Create a main.py file with:
- A colorful hello world function
- Input to get user's name
- Display personalized greeting
- Use rich and colorama for formatting
3. Add dependencies: rich, colorama, click
4. Create a tests folder with pytest tests
5. Add a README.md with project description
6. Create a .gitignore file for Python projects
7. Set up pre-commit hooks with black and flake8
Execute all necessary commands and create all files.
Cursor will:
- Run all uv commands
- Create all files with content
- Install dependencies
- Set up the complete project structure
Using Cursor Composer
Cursor Composer is the most powerful way to work with multiple files simultaneously:
Activating Composer
- Press
Cmd+I(Mac) orCtrl+I(Windows/Linux) - Or click the "Composer" button in the sidebar
Creating an Entire Application with Composer
In Composer, type this single prompt:
Create a complete Python Hello World application with these features:
Project structure:
- src/hello_world/ directory with __init__.py, main.py, greetings.py, utils.py
- tests/ directory with comprehensive pytest tests
- Modern pyproject.toml with uv configuration
- GitHub Actions workflow for CI/CD
- Dockerfile for containerization
- Makefile with common commands
Features:
- Interactive CLI using Click
- Multiple greeting styles (formal, casual, excited)
- Support for multiple languages (English, Spanish, French, Japanese)
- ASCII art banner
- Configuration file support (YAML)
- Logging with colored output
- Progress bars for batch processing
- Export greetings to JSON/CSV
Make it production-ready with:
- Type hints everywhere
- Comprehensive error handling
- 100% test coverage
- Documentation strings
- Performance optimizations
Use these libraries: click, rich, pyyaml, tqdm, colorlog, pandas
Create all files and run all necessary uv commands to set this up.
Composer will:
- Create the entire directory structure
- Write all Python files with full implementation
- Generate test files with test cases
- Create configuration files
- Set up CI/CD pipeline
- Install all dependencies
- Create documentation
Reviewing Composer's Work
After Composer finishes:
- It shows all created/modified files in the sidebar
- You can review each file by clicking on it
- Accept all changes with "Accept All" or review individually
- Composer automatically runs necessary terminal commands