A development container setup for building PINT (Pulsar Timing) GUI applications using PyQt6.
This project provides a complete development environment for PINT GUI development, including:
- Python 3.11 with PyQt6
- PINT pulsar timing library
- X11 forwarding for GUI applications on macOS
- All necessary dependencies pre-installed
- AI-assisted development workflow
- docs/ - Project documentation and notes
- docs/logging.md - Comprehensive logging system documentation
- ai_assistant/ - AI assistant system documentation
- CHANGELOG.md - Project changelog
- macOS 10.15 (Catalina) or later
- Apple Silicon (M1/M2/M3) or Intel Mac
- Docker Desktop for Mac
- Visual Studio Code with Dev Containers extension
- XQuartz (for GUI display)
- Download Docker Desktop from docker.com
- Install and start Docker Desktop
- Ensure Docker is running before proceeding
- Download VS Code from code.visualstudio.com
- Install the "Dev Containers" extension by Microsoft
- Restart VS Code after installation
- Download XQuartz from xquartz.org
- Install XQuartz (requires admin password)
- IMPORTANT: After installation, you MUST reboot your Mac for XQuartz to work properly
- After reboot, open XQuartz from Applications > Utilities
- Go to XQuartz > Preferences > Security
- Check "Allow connections from network clients"
- CRITICAL: You must reboot again after enabling this setting
After the second reboot, verify XQuartz is properly configured:
ps aux | grep XquartzYou should see --listen tcp in the output. If you see --nolisten tcp, XQuartz is not properly configured and you need to reboot again.
- Clone this repository:
git clone <repository-url> cd pylk
- Open in VS Code:
code .
- VS Code should detect the
.devcontainerfolder - Click "Reopen in Container" when prompted
- Or use Command Palette (Cmd+Shift+P) > "Dev Containers: Reopen in Container"
After every reboot, you need to allow X11 connections from Docker:
xhost +localhostThis is required for GUI applications to work in the Docker container.
The application now includes automatic X11 forwarding detection and user-friendly error handling:
- Automatic Detection: The app checks if X11 forwarding is working before starting
- Interactive Fix: If X11 issues are detected, you'll be prompted to fix them automatically
- Helpful Messages: Clear error messages with specific instructions
- Graceful Fallback: The app exits cleanly if X11 cannot be fixed
When you run pylk, you may see:
🔧 Detecting X11 forwarding issues...
⚠️ X11 Forwarding Issue Detected
The GUI cannot be displayed because X11 forwarding is not properly configured.
This is common in Docker containers after a reboot.
Would you like to attempt to fix this automatically? [y/N]
Simply type y and press Enter to let the app try to fix the issue automatically.
Once the container is running, you can start the PINT GUI:
# Activate the virtual environment
source .venv/bin/activate
# Run the main application
pylk# Run the PINT GUI tool
pintkIf you get "couldn't connect to display" errors:
-
First, try the X11 forwarding command (most common fix):
xhost +localhost
-
Check XQuartz is running:
ps aux | grep XquartzShould show
--listen tcp -
Verify DISPLAY variable:
echo $DISPLAY
Should show
host.docker.internal:0 -
If still not working:
- Reboot your Mac
- Ensure XQuartz is set to "Allow connections from network clients"
- Check that Docker Desktop is running
If the container fails to build:
-
Check Docker is running:
docker --version
-
Clean Docker cache:
docker system prune -a
-
Rebuild container:
- Command Palette > "Dev Containers: Rebuild Container"
If Python packages are not found:
-
Check virtual environment:
which python source .venv/bin/activate -
Verify system packages:
python -c "import PyQt6; print('PyQt6 OK')" python -c "import pint; print('PINT OK')"
This project uses AI-assisted development workflows for efficient feature implementation:
- Human Workflow: See
development-workflow.mdfor the complete workflow - AI Roles: See
prompts/roles/for AI role definitions - Templates: See
prompts/templates/for reusable prompt templates - Rules: See
prompts/shared/rules.mdfor shared behavioral rules
- The human crafts a prompt using
prompt_engineer.md - The human makes the AI execute using
feature_implementer.md - The AI implements milestones with PAUSE checkpoints
- The human verifies each milestone with
make fast - The human uses AI roles for review, fixes, and commits
📋 For complete workflow details, see
development-workflow.md
pylk/
├── .devcontainer/ # Dev container configuration
│ ├── Dockerfile # Container image definition
│ └── devcontainer.json # VS Code dev container settings
├── pylk/ # Main application code
│ └── app.py # Main application entry point
├── CHANGELOG.md # Project changelog
└── README.md # This file
To add new Python packages:
- Edit
.devcontainer/devcontainer.json - Add packages to
postCreateCommand - Rebuild the container
Modify .devcontainer/Dockerfile to:
- Add system packages
- Change Python version
- Install additional tools
- PyQt6: Modern Qt6 bindings for Python
- System Packages: PyQt6 installed via apt for better compatibility
- Virtual Environment: Isolated Python environment with system package access
- X11 Forwarding: Enables GUI applications to run in containers on macOS
The container uses X11 forwarding to display GUI applications:
DISPLAY=host.docker.internal:0routes display to macOS- XQuartz acts as the X11 server on macOS
.Xauthorityis mounted for authentication
- Fork the repository
- Create a feature branch
- Make your changes
- Test in the dev container
- Submit a pull request
[Add your license information here]
For issues with:
- Dev Container: Check VS Code Dev Containers documentation
- XQuartz: Check XQuartz documentation and ensure proper reboot
- Docker: Check Docker Desktop documentation
- PINT: Check PINT documentation
- macOS Apple Silicon: Requires XQuartz and proper reboot sequence
- Memory Usage: PyQt6 compilation can be memory-intensive
- Display Latency: X11 forwarding may have slight display lag
Note: This development environment is specifically optimized for macOS with Apple Silicon. For other platforms, you may need to adjust the X11 forwarding configuration.