Skip to content

Add Python Development Environment Blueprint #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

DongilMin
Copy link

@DongilMin DongilMin commented Jun 28, 2025

Python Development Environment Blueprint

Overview

This blueprint automates the setup of a complete Python development environment, targeting individual developers who need a quick, reproducible development setup across different platforms and environments.

Key Features

  • Automated Python virtual environment creation - Isolated development environment with Python 3.8+
  • Essential development packages installation - pytest, black, flake8, ipython, requests
  • Scientific computing packages - NumPy, Pandas with smart binary wheel installation
  • Multiple environment configurations - local-dev, data-science, web-dev presets
  • Cross-platform compatibility - Ubuntu, CentOS, macOS support
  • Containerized environment support - Works without root privileges
  • Example project structure - Ready-to-use templates with tests and documentation
  • Development workspace organization - Structured directories for projects, scripts, data

Difference from Existing Blueprints

Unlike existing infrastructure-focused blueprints, this targets:

  • Individual developers vs Enterprise infrastructure teams
  • Local development environments vs Cloud/VM deployments
  • Language-specific tooling vs Generic infrastructure provisioning
  • Simplified configuration vs Complex multi-cloud orchestration
  • Development workflow optimization vs Infrastructure management

Technical Implementation

Package Installation Strategy

  • Binary wheel preference - Avoids compilation issues in containerized environments
  • Graceful fallback handling - Multiple installation strategies for each package
  • Dependency resolution - Proper handling of NumPy/Pandas dependencies
  • Cross-platform detection - Automatic OS detection and appropriate package manager usage

Environment Management

  • Virtual environment isolation - Prevents conflicts with system packages
  • Configuration automation - Useful aliases and Python startup scripts
  • Workspace standardization - Consistent directory structure across deployments

Tested Environments

  • CentOS 7+ Docker containers - Verified with source compilation fallback
  • Ubuntu 18.04+ systems - Package manager integration tested
  • macOS 10.14+ systems - Homebrew compatibility verified
  • Cloudify Manager deployment - Production environment tested with full package verification

Installation Verification Results

Successfully installed packages:

  • NumPy 2.2.6 - Scientific computing foundation
  • Pandas 2.3.0 - Data analysis and manipulation
  • pytest 8.4.1 - Professional testing framework
  • black 25.1.0 - Code formatting
  • flake8 7.3.0 - Code linting and style checking
  • ipython 9.3.0 - Enhanced interactive Python shell
  • requests 2.32.4 - HTTP library for API interactions

Usage Examples

Basic Local Development

cfy blueprints upload -b python-dev blueprint.yaml
cfy deployments create -b python-dev -i inputs/local-dev.yaml python-dev-deployment  
cfy executions start -d python-dev-deployment install

Data Science Environment

cfy deployments create -b python-dev -i inputs/data-science.yaml python-ds-deployment
cfy executions start -d python-ds-deployment install

Web Development Setup

cfy deployments create -b python-dev -i inputs/web-dev.yaml python-web-deployment
cfy executions start -d python-web-deployment install

Configuration Options

Input Parameters

  • python_version (string, default: "3.9") - Python version to install
  • workspace_path (string, default: "~/python-workspace") - Development workspace location
  • dev_packages (string) - Space-separated list of Python packages to install

Package Presets

  • local-dev: Core development tools and scientific computing
  • data-science: Additional matplotlib, seaborn, scikit-learn packages
  • web-dev: Flask, Django, FastAPI web frameworks

Generated Workspace Structure

~/python-workspace/
├── projects/              # User Python projects
├── scripts/               # Utility scripts
├── data/                  # Data files
├── tests/                 # Test files
├── example-project/       # Example project with tests
│   ├── src/calculator.py  # Sample module with NumPy integration
│   ├── tests/             # pytest-based test suite
│   └── README.md          # Project documentation
└── setup-environment.sh  # Environment verification script

Post-Installation Usage

Environment Activation

source ~/python-dev-env/bin/activate
# or use alias: activate-python

Development Commands

run-tests          # Execute pytest
format-code        # Apply black formatting
lint-code          # Run flake8 linting
python-workspace   # Navigate to workspace

Example Project Testing

cd ~/python-workspace/example-project
python src/calculator.py              # Run example
python -m pytest tests/               # Execute tests
python -m black src/ tests/           # Format code

System Requirements

  • Operating System: Ubuntu 18.04+, CentOS 7+, macOS 10.14+
  • Memory: 2GB RAM minimum (4GB recommended for data science packages)
  • Disk Space: 2GB free space for full installation
  • Network: Internet connection for package downloads
  • Python: System Python 3.8+ (automatically installed if missing)

Blueprint Architecture

Lifecycle Operations

  1. Create Phase: Python installation and build tools setup
  2. Configure Phase: Virtual environment creation and package installation
  3. Verification: Package import testing and workspace setup

Error Handling

  • Graceful compiler installation failure handling
  • Multiple package installation fallback strategies
  • Comprehensive status reporting and verification
  • Non-blocking failures for optional components

Use Cases

  • Individual Developer Setup - Quick local environment initialization
  • Team Standardization - Consistent development environments across team members
  • CI/CD Pipeline Preparation - Standardized testing environment setup
  • Educational Environments - Classroom or workshop Python environment provisioning
  • Containerized Development - Development environment setup in Docker containers

Future Extension Possibilities

This blueprint provides a foundation that can be extended for:

  • Node.js development environments
  • Go programming environments
  • R statistical computing setups
  • Multi-language polyglot environments
  • IDE and editor integration
  • Git workflow automation

Contributor Information

Testing and Support

  • Comprehensive Testing: All components verified on Cloudify Manager
  • Production Ready: Tested in containerized environments
  • Community Support: Available for questions and ongoing maintenance
  • Documentation: Complete README with troubleshooting guidance

This blueprint demonstrates modern DevOps practices for language-specific development environment automation, providing a reusable pattern that can be adapted for various programming languages and development workflows.

- Automated Python virtual environment setup
- Support for local development environments
- Multiple configuration options (local-dev, data-science, web-dev)
- No sudo requirements for containerized environments
- Developer-friendly single command deployment
Major improvements:
- Add sudo/root environment auto-detection
- Fix CentOS 7 repository issues with vault.centos.org fallback
- Add Python 3.9 source compilation when packages unavailable
- Implement SSL compatibility fixes (urllib3<2.0, requests<2.32)
- Fix workspace directory creation with proper path expansion
- Add SQLite error handling for Jupyter Lab
- Remove emoji characters for professional documentation
- Improve error handling and logging throughout

Tested successfully on CentOS 7 Docker with:
✓ Python 3.9.18 installation
✓ Virtual environment creation
✓ NumPy 2.0.2, Pandas 2.3.0, Requests 2.31.0
✓ Development tools installation
Major Features Added:
✅ CentOS 7 preparation script (prepare-centos7.sh)
✅ SQLite development packages for full Jupyter Lab support
✅ Comprehensive README with troubleshooting guide
✅ Complete documentation with system requirements
✅ Cross-platform compatibility improvements

Technical Improvements:
- Add sqlite-devel, readline-devel, tk-devel for Python compilation
- Fix repository issues before git installation on CentOS 7
- Add detailed troubleshooting section with common solutions
- Document all supported OS versions and requirements
- Add performance metrics and advanced configuration options

User Experience:
- Step-by-step installation guide for all platforms
- Pre-installation requirements clearly documented
- Useful aliases and shortcuts documented
- Docker usage examples included
- Contributing guidelines added

This version should work seamlessly for new users on all supported platforms.
- Change from '2>/dev/null || { }' syntax to 'if ! yum install' for proper error handling
- Add fallback to source compilation when package installation fails
- Include all SQLite dependencies for full Jupyter Lab support
- Improve error handling in Development Tools installation
Issue: yum install command was returning success even when python39
packages were unavailable, preventing fallback to source compilation.

Solution:
- Replace 'if ! yum install' with 'yum list available' check
- Add explicit package availability verification before installation
- Improve error handling and debugging output during installation
- Add detailed progress messages for source compilation steps
- Fix source compilation fallback that was never triggered

Tested: CentOS 7 Docker container now successfully compiles Python 3.9.18
from source when packages are unavailable.
…e handling

- Add automatic GCC/build-tools installation in install-python-nosudo.sh
- Implement safer numpy/pandas installation with fallback strategies
- Add binary-only package installation to avoid compilation issues
- Include comprehensive error handling for package failures
- Fix virtual environment path for Cloudify Manager compatibility

Resolves NumPy compilation errors in Cloudify Manager containers.
- Move GCC/build-tools installation to setup-dev-tools-nosudo.sh
- Add comprehensive compiler detection and installation
- Implement multi-strategy numpy installation with fallbacks:
  1. Binary wheel installation (fastest)
  2. Older stable version fallback
  3. Source compilation as last resort
- Add detailed status reporting and error handling
- Include installation verification and summary

This fixes the Cloudify blueprint where create phase was being skipped.
- Force pyzmq binary installation to avoid CMake compilation
- Install dependencies in correct order (python-dateutil, pytz, tzdata)
- Add multiple fallback strategies for each package
- Create Jupyter startup script for immediate usage
- Comprehensive installation verification and reporting

This should resolve the remaining JupyterLab installation issues in Cloudify.
@DongilMin DongilMin force-pushed the add-python-development-environment branch from a14f17d to d8d193e Compare June 29, 2025 08:58
This blueprint automates cross-platform Python development environment setup
for individual developers and teams requiring reproducible development environments.

Features:
- Automated Python virtual environment creation with essential packages
- Cross-platform compatibility (Ubuntu, CentOS, macOS, containerized environments)
- Scientific computing packages (NumPy 2.2.6, Pandas 2.3.0) with binary wheel preference
- Professional development tools (pytest, black, flake8, ipython, requests)
- Multiple environment configurations (local-dev, data-science, web-dev)
- Organized workspace with example projects and comprehensive documentation
- Production-ready configuration with aliases and startup scripts

Technical Implementation:
- Smart package installation strategy avoiding compilation issues
- Graceful fallback handling for package installation failures
- Binary wheel preference to ensure compatibility in containerized environments
- Comprehensive error handling and status reporting
- Virtual environment isolation preventing system package conflicts
- Cross-platform OS detection and package manager integration

Tested Environments:
- CentOS 7+ Docker containers with source compilation fallback
- Ubuntu 18.04+ systems with native package manager integration
- macOS 10.14+ systems with Homebrew compatibility
- Cloudify Manager deployment with full production verification

Package Verification:
All core packages successfully installed and verified:
- NumPy 2.2.6 for scientific computing
- Pandas 2.3.0 for data analysis with resolved dependencies
- pytest 8.4.1 for professional testing framework
- black 25.1.0 for code formatting
- flake8 7.3.0 for code quality checking
- ipython 9.3.0 for enhanced development experience
- requests 2.32.4 for HTTP interactions

Use Cases:
- Individual developer environment standardization
- Team development workflow consistency
- CI/CD pipeline preparation
- Educational environment provisioning
- Containerized development setup

Difference from Existing Blueprints:
Unlike infrastructure-focused blueprints, this targets individual developers
with language-specific tooling rather than enterprise infrastructure management.
Provides simplified configuration for development workflows rather than
complex multi-cloud orchestration.

This blueprint demonstrates modern DevOps practices for development environment
automation and provides a foundation that can be extended to other programming
languages and development workflows.
@DongilMin DongilMin force-pushed the add-python-development-environment branch from d8d193e to 5fd2f7a Compare June 29, 2025 09:04
- Clean up README.md to use professional language
- Remove emoji icons for better corporate compatibility
- Maintain all technical content and structure
- Improve readability and formal documentation style
- Add Apache 2.0 LICENSE file for proper open source licensing
- Include comprehensive blueprint metadata with version and tags
- Add input constraints and enhanced output descriptions
- Improve blueprint documentation and usage instructions
@DongilMin
Copy link
Author

@EarthmanT
I hope you're doing well. I submitted this Python Development Environment Blueprint contribution a few days ago and wanted to kindly follow up to see if there might be an opportunity for review when your schedule allows.

The blueprint has been thoroughly tested on Cloudify Manager and includes comprehensive documentation. I'm happy to address any feedback or questions you might have.

Thank you for maintaining such a valuable community resource!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant