Boosting Operational Productivity with Python and Textual: Modern Terminal Dashboards for Developers
A modern terminal-based application built with Python 3.12+ and the Textual framework to view and manage MongoDB Atlas projects.
- 🎯 Modern TUI: Beautiful terminal user interface powered by Textual
- 🔐 Secure Authentication: Uses MongoDB Atlas Administration API v2.0
- 📊 Project Overview: View all your Atlas projects in a clean table format
- 🔍 Cluster Details: Click on any project to view its clusters with detailed information
- 🌍 Environment Support: Load credentials from environment variables
- ⚡ Async Performance: Fast, non-blocking HTTP requests with httpx
- 🖱️ Interactive Navigation: Use mouse clicks or keyboard to navigate between views
- Python 3.8 or higher (recommended: Python 3.12+)
- MongoDB Atlas account with API access
- Atlas API Key (Public + Private Key pair)
-
Fork and setup:
cd pyconth25 -
Configure your Atlas API credentials:
# Edit the .env file with your credentials nano .envAdd your Atlas API credentials:
ATLAS_PUBLIC_KEY=your_atlas_public_key_here ATLAS_PRIVATE_KEY=your_atlas_private_key_here ATLAS_ORG_ID=your_organization_id_here
-
Run the application:
python atlas_projects_manager.py
- Log in to MongoDB Atlas
- Go to Access Manager → API Keys
- Click Create API Key
- Add a description and select appropriate permissions:
- Organization Member (minimum)
- Project Read Only or higher for project access
- Copy the Public Key and Private Key
- Add your current IP to the API Access List
- Projects View: Main screen showing all Atlas projects
- Project Name
- Project ID
- Creation Date
- Cluster View: Detailed view of clusters in a selected project
- Cluster Name
- Status (Active, Paused, etc.)
- Cloud Provider (AWS, Azure, GCP)
- Region
- Instance Size
- MongoDB Version
- Status Display: Real-time feedback on operations
- Mouse: Click on any project row to view its clusters
- Keyboard: Use arrow keys to select, then press Enter
- Back Navigation: Press Escape or 'b' to return to projects view
a: Authenticate and load projectsv: View clusters for selected projectEscapeBack to projects view (from cluster view)d: Delete selected projectq: Quit the application
The application is built with:
- Textual Framework: Modern TUI framework for Python
- httpx: Modern async HTTP client
- MongoDB Atlas API v2.0: Official REST API for Atlas management
- Python 3.12+: Latest Python features and performance
pyconth25/
├── atlas_projects_manager.py # Main application
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .env # Your credentials (create this)
└── README.md # This file
This application uses the MongoDB Atlas Administration API v2.0:
- Base URL:
https://cloud.mongodb.com/api/atlas/v2 - Authentication: HTTP Digest Authentication
- Endpoint:
/groups(lists all projects) - API Version:
application/vnd.atlas.2023-01-01+json
All dependencies are listed in requirements.txt:
httpx: Async HTTP clienttextual[dev]: TUI framework with development toolsrich: Terminal formattingpython-dotenv: Environment variable management
# Install development dependencies
pip install -r requirements.txt
# Run with development features
python atlas_projects_manager.py-
Import errors: Make sure all dependencies are installed
pip install -r requirements.txt
-
Authentication errors: Verify your API credentials
- Check Public Key and Private Key are correct
- Ensure your IP is in the API Access List
- Verify API key has necessary permissions
-
Connection errors: Check your internet connection and Atlas status
API request failed: Check credentials and network connectionInvalid JSON response: Atlas API may be unavailablePlease enter both keys: Both Public and Private keys are required
This is a PyCon Thailand 2025 demonstration project showcasing modern Python development with Textual framework.
MIT License - feel free to use and modify for your projects.
- Atlas Administration API Documentation
- API Authentication Guide
- Atlas API Reference
- Postman Collection
- copy .env.template to .env
- run
python atlas_projects_manager.py