A modern, production-ready tkinter application template with uv, Docker, and CI/CD.
- π uv package manager - Fast and efficient dependency management
- π³ Docker development - Containerized environment with docker-compose
- π― Ruff integration - Modern linter and formatter for code quality
- π GitHub Actions - CI/CD, version management, and multi-platform releases
- ποΈ MVC architecture - Clean separation of concerns
- π Conventional commits - Automatic version bumping based on commit patterns
-
Use this template:
gh repo create my-tkinter-app --template username/tkinter-foundry --public
-
Clone your new repository:
git clone https://github.com/username/my-tkinter-app.git cd my-tkinter-app
-
Start development environment:
docker-compose up -d app
-
Get shell in container:
docker-compose run --rm shell
-
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install dependencies:
uv sync --all-extras
-
Run the application:
uv run python -m app.main
-
Run tests:
uv run pytest
-
Run linting:
uv run ruff check src/ tests/ uv run ruff format src/ tests/
tkinter-app/
βββ .github/
β βββ workflows/
β βββ ci.yml # CI pipeline
β βββ release.yml # Multi-platform releases
β βββ version.yml # Automatic version bumping
βββ src/
β βββ app/
β βββ __init__.py
β βββ main.py # Application entry point
β βββ models.py # Data models
β βββ views/ # UI components
β β βββ __init__.py
β β βββ main_window.py
β βββ controllers/ # Business logic
β βββ __init__.py
β βββ main_controller.py
βββ tests/
βββ scripts/
β βββ build.py # Build script for distribution
βββ pyproject.toml # Project configuration
βββ uv.lock # Dependency lock file
βββ Dockerfile # Container configuration
βββ docker-compose.yml # Docker services
βββ .dockerignore # Docker ignore file
βββ .gitignore # Git ignore file
βββ ruff.toml # Ruff configuration
βββ README.md # This file
This template follows the MVC (Model-View-Controller) pattern:
- Models (
src/app/models.py): Data structures and business logic - Views (
src/app/views/): UI components and user interface - Controllers (
src/app/controllers/): Handle user input and coordinate models and views
The template uses conventional commits for automatic version management:
feat: add new feature
fix: fix a bug
docs: update documentation
style: format code
refactor: refactor code
test: add tests
chore: maintenance tasks
Examples:
feat: add user authenticationβ Bumps minor versionfix: resolve login button not workingβ Bumps patch versionfeat(ui): add dark mode supportβ Bumps minor version with scope
Conventional commits cheatsheet
When you create a release on GitHub, the workflow automatically builds and packages your application for:
- Windows - Executable with installer
- macOS - App bundle
- Linux - Binary package
The CI pipeline runs on every push and pull request:
- Test across Python 3.9, 3.10, 3.11, and 3.12
- Run security scans with Bandit
- Lint code with Ruff
- Check for potential issues
- app: Main application container
- shell: Development shell for running commands
DISPLAY: X11 display for GUI applicationsXAUTHORITY: X11 authority file
./src:/app/src- Live code reloading./scripts:/app/scripts- Build scripts
Main project configuration including:
- Dependencies and optional dev dependencies
- Project metadata
- Entry points
- Tool configurations (Ruff, pytest)
Ruff is configured with:
- Line length: 88 characters
- Target Python version: 3.9+
- Selected rules: E, W, F, I, B, C4, UP
- Ignored rules: E501 (line too long), B008 (function calls in defaults)
uv run python scripts/build.pyThis creates a standalone executable in the dist/ directory.
- Make sure you have conventional commits
- Create a new release on GitHub
- Tag your release with a version number
- The workflow will automatically build for all platforms
uv run pytestTests include coverage reporting:
- Terminal output with missing lines
- HTML report in
htmlcov/directory
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Follow conventional commits
- Run tests and linting (
uv run pytest && uv run ruff check) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use existing code structure and patterns
- Write tests for new features
- Update documentation as needed
- Follow Ruff linting rules
- Use conventional commit messages
- If GUI doesn't display, ensure
DISPLAYandXAUTHORITYare set - Try running
xhost +local:dockerto allow container access to X11 - Check that your system has X11 forwarding enabled
- Use
uv sync --all-extrasto install all dependencies - Run
uv sync --upgradeto update dependencies - Check Python version compatibility (3.9+ required)
- Ensure tkinter is installed (
apt-get install tkon Linux) - Check system dependencies for GUI applications
- Verify display server is running
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- uv - Fast Python package management
- Docker - Containerization platform
- Ruff - Extremely fast Python linter
- GitHub Actions - CI/CD automation
Start building your tkinter applications with modern tooling and best practices! π