Skip to main content

Flutter development environment setup CLI tool for macOS and Linux

Project description

Flutter Setup CLI

A modern Python CLI tool for setting up complete Flutter development environments on macOS and Linux. This tool automates Flutter SDK setup, prerequisite checks, and project bootstrapping with practical defaults.

Features

  • ๐Ÿš€ Automated Setup: Complete Flutter development environment setup in minutes
  • ๐Ÿฆ‹ Flutter SDK Management: Install, update, and manage Flutter SDK with multiple channels
  • ๐Ÿ› ๏ธ Prerequisites Installation: Platform-aware prerequisite checks and installation flows for macOS and Linux
  • ๐Ÿ“ฑ Multi-Platform Support: Create projects for iOS, Android, macOS, Linux, Windows, and Web
  • ๐Ÿ”ง Development Environment: Pre-configured VS Code/Cursor settings, testing framework, and CI/CD
  • ๐ŸŽฏ Best Practices: Industry-standard project structure with linting, testing, and analysis tools
  • ๐Ÿงช Testing Ready: Built-in test structure for unit, widget, and integration tests
  • ๐Ÿ“ฆ Easy Deployment: Simple Python package that can be easily installed on any developer machine

Quick Start

Installation

# Clone the repository
git clone <your-repo-url>
cd flutter-setup

# Install the package
uv pip install -e .

# Or install directly from GitHub (when published)
uv pip install git+https://github.com/markcallen/flutter-setup.git

Linux Prerequisites (Ubuntu/Debian)

For Linux hosts, ensure APT is available and sudo is configured:

sudo apt-get update
sudo apt-get install -y git curl unzip xz-utils zip libglu1-mesa clang cmake ninja-build pkg-config libgtk-3-dev libayatana-appindicator3-dev liblzma-dev openjdk-17-jdk

Configuration Setup

Before your first use, initialize your configuration:

# Interactive configuration setup
flutter-setup init

This will:

  • Detect Flutter location from environment variables or PATH
  • Prompt for Flutter channel (stable/beta)
  • Prompt for organization ID
  • Create config file at ~/.config/flutter-setup/config.yaml

You can run flutter-setup init again anytime to update your configuration.

Basic Usage

# Create a new Flutter app with iOS, Android, and Web support
flutter-setup setup MyAwesomeApp ios android web

# Create a plugin with specific language preferences
flutter-setup setup MyPlugin --template plugin --ios-language objc --android-language java ios android

# Use beta channel and custom organization
flutter-setup setup MyApp --channel beta --org com.mycompany ios android macos

# Preview what would happen (dry run)
flutter-setup setup MyApp --dry-run ios android

Commands

init - Configuration Setup

Initialize or update your configuration file:

flutter-setup init              # Create or update config interactively
flutter-setup init --force      # Overwrite existing config

The config file is stored at ~/.config/flutter-setup/config.yaml (or $XDG_CONFIG_HOME/flutter-setup/config.yaml).

setup - Project Setup

Set up a new Flutter project:

flutter-setup setup MyApp ios android web

Command Line Options

Option Description Default Config File
--org Organization identifier com.example โœ…
--channel Flutter channel (stable/beta) stable โœ…
--dir Output directory Current directory โŒ
--template Project template (app/plugin) app โœ…
--architecture Application architecture scaffold (basic/clean) basic โœ…
--database Local persistence scaffold (none/sqlite) none โœ…
--testing Testing starter scaffold (standard/mocktail) standard โœ…
--auth-provider Auth integration scaffold (none/firebase) none โœ…
--cloud-database Cloud database scaffold (none/firestore) none โœ…
--notifications-provider Push notifications scaffold (none/firebase) none โœ…
--ios-language iOS language for plugins (swift/objc) swift โœ…
--android-language Android language for plugins (kotlin/java) kotlin โœ…
--flutter-update Flutter update mode (reset/reclone/skip) reset โœ…
--dry-run Preview actions without executing false โŒ
--verbose Enable verbose output false โŒ

Note: Options marked with โœ… can be set in the config file via flutter-setup init. Command-line arguments override config file values.

What Gets Set Up

1. System Prerequisites

  • โœ… macOS: Xcode Command Line Tools + Homebrew + CocoaPods
  • โœ… Linux (Ubuntu/Debian): APT-managed packages (git, curl, unzip, xz-utils, zip, libglu1-mesa, clang, cmake, ninja-build, pkg-config, libgtk-3-dev, libayatana-appindicator3-dev, liblzma-dev, openjdk-17-jdk)
  • โœ… Android development tools when Android platform is selected
  • โœ… iOS development tools only on macOS when iOS platform is selected

2. Flutter SDK

  • โœ… Flutter SDK installation/update
  • โœ… Channel management (stable/beta)
  • โœ… PATH configuration
  • โœ… Flutter doctor validation

3. Project Structure

  • โœ… Flutter project creation with specified platforms
  • โœ… Package name sanitization
  • โœ… Template-specific configuration
  • โœ… Optional Clean Architecture scaffold
  • โœ… Optional SQLite/Drift local persistence scaffold
  • โœ… Optional Firebase Auth, Firestore, and Firebase Messaging scaffolds
  • โœ… Optional Mocktail testing starter

4. Development Environment

  • โœ… VS Code/Cursor configuration
  • โœ… Makefile with common commands
  • โœ… Testing framework structure
  • โœ… Code analysis and linting setup
  • โœ… GitHub Actions CI pipeline
  • โœ… Environment variable support
  • โœ… Comprehensive README

Project Structure

MyAwesomeApp/
โ”œโ”€โ”€ .vscode/                 # VS Code/Cursor configuration
โ”œโ”€โ”€ .github/workflows/       # CI/CD pipeline
โ”œโ”€โ”€ lib/                     # Flutter source code
โ”œโ”€โ”€ test/                    # Test files
โ”‚   โ”œโ”€โ”€ unit/               # Unit tests
โ”‚   โ””โ”€โ”€ widget/             # Widget tests
โ”œโ”€โ”€ integration_test/        # Integration tests
โ”œโ”€โ”€ Makefile                 # Common development commands
โ”œโ”€โ”€ analysis_options.yaml    # Linting and analysis rules
โ”œโ”€โ”€ .env                     # Environment variables
โ””โ”€โ”€ README.md               # Project documentation

Development Commands

After setup, use these commands in your project:

# Run the app
make run              # Chrome (default)
make run_ios          # iOS simulator
make run_android      # Android emulator

# Testing
make test             # Unit + widget tests
make integration      # Integration tests

# Code quality
make analyze          # Flutter analyze

Configuration

The tool uses a YAML-based configuration file that stores your preferences:

Location: ~/.config/flutter-setup/config.yaml (or $XDG_CONFIG_HOME/flutter-setup/config.yaml)

Example config:

flutter:
  location: ~/development/flutter
  channel: stable
  update_mode: reset

project:
  org: com.mycompany
  template: app
  architecture: basic
  database: none
  testing: standard
  auth_provider: none
  cloud_database: none
  notifications_provider: none
  ios_language: swift
  android_language: kotlin

Configuration Features:

  • โœ… XDG Base Directory Specification compliant
  • โœ… Automatic Flutter location detection from environment
  • โœ… Interactive setup via flutter-setup init
  • โœ… Command-line arguments override config values
  • โœ… Persistent settings across sessions

Architecture

The package is built with modern Python best practices:

  • Modular Design: Separate modules for different concerns
  • Type Safety: Full type hints with mypy support
  • Error Handling: Comprehensive exception handling
  • Rich CLI: Beautiful terminal output with progress indicators
  • Configuration: Flexible configuration system with XDG support
  • Testing: Built-in test structure and CI/CD

Development

Prerequisites

  • Python 3.12+
  • uv package manager

Supported Hosts

  • macOS (Darwin)
  • Linux (Ubuntu/Debian via APT)

Known Limitations

  • Fedora/DNF support is planned but not yet implemented.
  • iOS setup is not available on Linux hosts.

Setup Development Environment

# Clone and install
git clone <repo-url>
cd flutter-setup
uv pip install -e ".[dev]"

# Run tests
uv run pytest

# Format code
uv run black .

# Lint code
uv run ruff check .

# Type checking
uv run mypy .

Project Structure

flutter-setup/
โ”œโ”€โ”€ flutter_setup/           # Main package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py              # CLI entry point
โ”‚   โ”œโ”€โ”€ config.py            # Configuration management
โ”‚   โ”œโ”€โ”€ core.py              # Main orchestration
โ”‚   โ”œโ”€โ”€ exceptions.py        # Custom exceptions
โ”‚   โ”œโ”€โ”€ prerequisites.py     # System prerequisites
โ”‚   โ”œโ”€โ”€ flutter_manager.py   # Flutter SDK management
โ”‚   โ”œโ”€โ”€ project_creator.py   # Project creation
โ”‚   โ””โ”€โ”€ bootstrap.py         # Development environment setup
โ”œโ”€โ”€ pyproject.toml           # Package configuration
โ”œโ”€โ”€ README.md                # This file
โ””โ”€โ”€ test_cli.py             # Simple test script

Comparison with Bash Script

This Python CLI package provides several advantages over the original bash script:

Feature Bash Script Python CLI
Installation Manual download pip install
Dependencies Manual management Automatic with uv
Error Handling Basic Comprehensive
Testing None Full test suite
Type Safety None Full mypy support
Packaging Manual Standard Python package
Distribution Manual PyPI ready
Maintenance Harder Easier with Python tools

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the PRD.md for detailed requirements

Built with โค๏ธ for the Flutter community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flutter_setup-2.1.1.tar.gz (56.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flutter_setup-2.1.1-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file flutter_setup-2.1.1.tar.gz.

File metadata

  • Download URL: flutter_setup-2.1.1.tar.gz
  • Upload date:
  • Size: 56.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flutter_setup-2.1.1.tar.gz
Algorithm Hash digest
SHA256 24262ad998160d167d3678e6a1fd031ba8aa8ca64461c18ba68892c982514ca8
MD5 cb88361b566cb1e2767c6726c397f50c
BLAKE2b-256 dd4fa94982c1c832612e7133735403b92622375caf6cd93c5c665e9cfd536ef1

See more details on using hashes here.

Provenance

The following attestation bundles were made for flutter_setup-2.1.1.tar.gz:

Publisher: publish.yml on markcallen/flutter-setup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flutter_setup-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: flutter_setup-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flutter_setup-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6af2d2c9011693f7edd99beec1c57ea9fac1e9feb7c88d95c560ea4c670fb3c
MD5 8fc57d59057d8ac35a97ea262bc46e9a
BLAKE2b-256 fe6be1829e93bca168adaaa4acce6c3db7739c4a38bdaa5a5b8b69388411236b

See more details on using hashes here.

Provenance

The following attestation bundles were made for flutter_setup-2.1.1-py3-none-any.whl:

Publisher: publish.yml on markcallen/flutter-setup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page