Skip to main content

Interactive Python environment setup CLI for VSCode

Project description

TyPySetup - Python Environment Setup CLI

Interactive Python environment setup CLI for VSCode. Automatically configure Python projects with proper virtual environments, dependencies, and VSCode settings.

Features

  • ๐ŸŽฏ Interactive Menu - Select from 6 project type templates (FastAPI, Django, Data Science, CLI Tools, Async/Real-time, ML/AI)
  • ๐Ÿ”ง Automatic Setup - Create virtual environment, install dependencies, generate VSCode configs
  • ๐Ÿ“ฆ Multiple Package Managers - Support for uv (fast), pip (universal), and poetry (lock files)
  • โš™๏ธ Smart Configuration - VSCode settings optimized per project type, non-destructive merging
  • ๐Ÿ’พ Preference Persistence - Remember your choices for faster future setups
  • ๐Ÿ”„ Graceful Cancellation - Cancel between phases with automatic rollback

Quick Start

Installation

# Install from PyPI (recommended)
pip install typysetup

# Or with uv
uv tool install typysetup

# Install from source (development)
git clone <repository>
cd typysetup
pip install -e .

Basic Usage

# Interactive setup wizard
typysetup setup /path/to/project

# List available setup types
typysetup list

# Manage preferences
typysetup preferences --show

Example: FastAPI Project

$ typysetup setup ~/my-api
? Choose a setup type: FastAPI
? Package manager (uv recommended): uv
? Proceed with setup? [Y/n]: y

Creating virtual environment...
Installing dependencies (14 packages)...
Generating VSCode configuration...

โœ“ Setup complete! Next steps:
  - Activate: source ~/my-api/venv/bin/activate
  - Open VSCode: code ~/my-api
  - Start coding: fastapi dev main.py

Project Structure

typysetup/
โ”œโ”€โ”€ src/typysetup/
โ”‚   โ”œโ”€โ”€ main.py                # Typer CLI application
โ”‚   โ”œโ”€โ”€ models/                # Pydantic data models
โ”‚   โ”œโ”€โ”€ commands/              # CLI command classes (OOP)
โ”‚   โ”‚   โ”œโ”€โ”€ config_cmd.py      # ConfigCommand
โ”‚   โ”‚   โ”œโ”€โ”€ help_cmd.py        # HelpCommand
โ”‚   โ”‚   โ”œโ”€โ”€ history_cmd.py     # HistoryCommand
โ”‚   โ”‚   โ”œโ”€โ”€ list_cmd.py        # ListCommand
โ”‚   โ”‚   โ”œโ”€โ”€ preferences_cmd.py # PreferencesCommand
โ”‚   โ”‚   โ””โ”€โ”€ setup_orchestrator.py # SetupOrchestrator (main wizard)
โ”‚   โ”œโ”€โ”€ core/                  # Business logic (config loading, venv, deps, vscode)
โ”‚   โ”œโ”€โ”€ utils/                 # Utilities (paths, prompts, rollback)
โ”‚   โ””โ”€โ”€ configs/               # Setup type YAML templates
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ unit/                  # Unit tests
โ”‚   โ”œโ”€โ”€ integration/           # Integration tests
โ”‚   โ””โ”€โ”€ conftest.py           # Pytest fixtures
โ””โ”€โ”€ pyproject.toml            # Project metadata and dependencies

Setup Types

FastAPI

Web API with FastAPI framework - async, modern, fast

  • Python: 3.10+
  • Core: fastapi, uvicorn, pydantic
  • Dev: pytest, black, ruff

Django

Full-stack web framework with batteries included

  • Python: 3.8+
  • Core: django, djangorestframework
  • Dev: pytest, black, ruff

Data Science

Jupyter-based data analysis and ML workflows

  • Python: 3.9+
  • Core: pandas, numpy, jupyter, scikit-learn
  • Dev: pytest, black, ruff

CLI Tool

Command-line applications using Typer/Click

  • Python: 3.8+
  • Core: typer, click, rich
  • Dev: pytest, black, ruff

Async/Real-time

High-performance async and real-time applications

  • Python: 3.10+
  • Core: asyncio, aiohttp, websockets, starlette
  • Dev: pytest, black, ruff

ML/AI

Machine learning and AI model development

  • Python: 3.9+
  • Core: tensorflow, torch, transformers, scikit-learn
  • Dev: pytest, black, ruff

Technology Stack

  • Language: Python 3.8+
  • CLI Framework: Typer (type-safe, beautiful)
  • Data Validation: Pydantic (runtime validation)
  • Configuration: YAML + PyYAML (human-friendly)
  • Terminal UI: Rich + Questionary (interactive prompts)
  • Virtual Environment: Built-in venv module
  • Package Managers: uv (primary), pip, poetry
  • Testing: pytest + pytest-cov
  • Code Quality: black, ruff, mypy

Development

Setup Development Environment

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=src/typysetup

Code Quality

# Format code
black src/ tests/

# Lint code
ruff check src/ tests/

# Type checking
mypy src/typysetup

Testing

# Run all tests
pytest

# Run unit tests only
pytest tests/unit/

# Run integration tests
pytest tests/integration/

# Run with coverage report
pytest --cov=src/typysetup --cov-report=html

Architecture

See ARCHITECTURE.md for detailed architecture documentation.

Configuration

User preferences are stored in ~/.typysetup/preferences.json:

{
  "preferred_manager": "uv",
  "preferred_python_version": "3.11",
  "preferred_setup_types": ["fastapi"],
  "setup_history": []
}

Commands

typysetup setup

Interactive setup wizard - guides you through project configuration.

typysetup setup /path/to/project [--verbose]

Options:

  • --verbose, -v: Enable detailed logging output

Example:

typysetup setup ~/my-fastapi-app --verbose

typysetup list

List all available setup type templates.

typysetup list

typysetup preferences

Manage user preferences and view setup history.

typysetup preferences --show   # View current preferences
typysetup preferences --reset  # Reset to defaults

typysetup config

Display project configuration.

typysetup config /path/to/project

typysetup history

View recent setup history.

typysetup history [--limit 10] [--verbose]

typysetup help

Show detailed help and usage examples.

typysetup help [topic]  # Topics: setup, workflows, preferences

Common Workflows

Creating a New FastAPI Project

mkdir my-api
cd my-api
typysetup setup .
# Select "FastAPI" from menu
# Choose "uv" as package manager
source venv/bin/activate
code .

Data Science Project with Jupyter

typysetup setup ml-analysis
# Select "Data Science"
cd ml-analysis
source venv/bin/activate
jupyter notebook

Converting Existing Project

cd existing-project
typysetup setup .
# TyPySetup will detect and preserve existing files
# Select appropriate setup type

Troubleshooting

For detailed troubleshooting guide, see TROUBLESHOOTING.md.

Quick Fixes

Python not found:

python --version  # Ensure 3.8+

Command not found:

pip install typysetup
# or
pip install --user typysetup

Permission denied:

chmod u+w /path/to/project

VSCode not recognizing venv:

  • Reload window: Ctrl+Shift+P โ†’ "Developer: Reload Window"
  • Select interpreter: Ctrl+Shift+P โ†’ "Python: Select Interpreter"

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE file for details

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

typysetup-1.1.0.tar.gz (65.6 kB view details)

Uploaded Source

Built Distribution

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

typysetup-1.1.0-py3-none-any.whl (80.2 kB view details)

Uploaded Python 3

File details

Details for the file typysetup-1.1.0.tar.gz.

File metadata

  • Download URL: typysetup-1.1.0.tar.gz
  • Upload date:
  • Size: 65.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for typysetup-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6e5fb7927250f1d17b3a24ec61d290b3433138362c09ed44fa36682d564370ee
MD5 76ab26ac6fa403db2bc952cda2d43fa2
BLAKE2b-256 687cf321e719a168c6c86b2f49c35448458fffd4e29c82b0c2e572cbbfd52c99

See more details on using hashes here.

File details

Details for the file typysetup-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: typysetup-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 80.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for typysetup-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e7c4fe01f4728113f66640c4d1f582068c2cf046cb77844461b982eee44bd8d
MD5 2bcf2b9bcd82fe68aefd2b50ae2d1a7c
BLAKE2b-256 8803c5f372e8f45c8d55eec0b0cd125e897f3ced459f46548104a8d587e652cd

See more details on using hashes here.

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