A flexible framework for development tasks including project creation, testing, building, and deployment
Project description
🚀 CICD Tools
A flexible framework for development tasks including project creation, testing, building, and deployment.
🚀 Quick Start
# Install the package
pip install cicd_tools
# Create a new project (using long option)
cicd_tools --create
# or with short option
cicd_tools -c
# Work with an existing project (using long option)
cicd_tools --app
# or with short option
cicd_tools -a
# Initialize configuration (using long option)
cicd_tools --init
# or with short option
cicd_tools -i
# Display version information
cicd_tools -v
# or
cicd_tools --version
# Display help information
cicd_tools -h
# or
cicd_tools --help
# Enable development tasks (using long option)
cicd_tools --enable
# or with short option
cicd_tools -e
Table of Contents
- Features
- Installation
- Detailed Usage Guide
- Project Types
- Template System
- Architecture
- Troubleshooting
- Contributing
- License
✨ Features
- 🔄 Dynamic Menus - Adapt based on project type with enhanced visual styling and icons
- 📋 Template-based - Project creation and updates using Copier
- 🧩 Multiple Project Types - Different capabilities for different needs
- 🔗 GitHub Integration - Workflows for CI/CD
- 🛠️ Environment Management - Comprehensive virtual environment handling
- 📊 Progress Tracking - Visual feedback for long-running operations (enabled by default)
- 📝 Example Modules - Ready-to-use sample modules with logging capabilities
- ⚙️ Centralized Configuration - Flexible configuration via .app_cache/config.yaml
📦 Installation
Standard Installation
pip install cicd_tools
Development Installation
# Clone the repository
git clone https://github.com/yourusername/cicd_tools.git
cd cicd_tools
# Install in development mode with development dependencies
pip install -e ".[dev]"
📚 Detailed Usage Guide
🆕 Creating a New Project
The --create option allows you to create new projects from templates.
cicd_tools --create
# or using the short form
cicd_tools -c
Step-by-Step Example
-
Run the create command:
cicd_tools --create # or cicd_tools -c
-
Select "Create Project" from the menu.
-
Choose a template type:
? Select a template: (Use arrow keys) > simple_project development_project github_project -
Enter project details when prompted:
? Enter project name: my-project ? Short description of the project: A Python utility for awesome things ? Author name: Your Name ? Author email: your.email@example.com ? Python version: 3.8 ? License: MIT -
The project will be created with the selected template:
Project created successfully at /path/to/my-project -
The created project includes:
- Basic project structure
- Example module with logging capabilities
- Configuration file in .app_cache/config.yaml
🔧 Working with an Existing Project
The --app option allows you to work with existing projects.
cicd_tools --app
# or using the short form
cicd_tools -a
Step-by-Step Example
-
Navigate to your project directory:
cd my-project
-
Run the app command:
cicd_tools --app # or cicd_tools -a
-
The tool will detect your project type and display appropriate options with enhanced styling:
App Menu - my-project ? Select an action: (Use arrow keys) > 🔧 Manage Environment - Manage the project environment 📥 Install - Install the project 🧪 Test - Run tests 🏗️ Build - Build the project 🧹 Clean - Clean build artifacts ℹ️ Help - Show help for project operations ↩️ Back/Exit -
Select an action to perform.
🌐 Environment Management
CICD Tools provides comprehensive environment management capabilities.
Step-by-Step Example
-
From the app menu, select "Manage Environment":
? Select an action: 🔧 Manage Environment - Manage the project environment -
Choose an environment management action:
Environment Management ? Select an action: (Use arrow keys) > 🔄 Recreate Environment - Recreate the virtual environment 🗑️ Delete Environment - Delete the virtual environment ➕ Create New Environment - Create a new virtual environment ↩️ Back/Exit -
If creating a new environment, enter a name:
? Enter environment name: my-env -
The environment will be created and the project will be installed with visual progress tracking:
Creating environment... [========================================] 100% Installing dependencies... [====================================] 100% Environment created successfully
⚙️ Configuration System
CICD Tools uses a centralized configuration system located in .app_cache/config.yaml.
Configuration Options
-
Environment Settings
console: stack_trace: False # Disable progress bars for cmd trace log (default: false)
-
Logging Configuration
logging: default: level: INFO handlers: - type: console format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" - type: file filename: "app.log" format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" max_bytes: 10485760 # 10MB backup_count: 3
-
Menu Styling
styling: colors: primary: "#007BFF" secondary: "#6C757D" success: "#28A745" warning: "#FFC107" error: "#DC3545"
You can customize these settings to match your preferences and requirements.
📝 Example Module
Each project template includes a ready-to-use sample module with logging capabilities.
Using the Example Module
The example module is located in your project structure and includes:
__init__.py- Module initialization with logger setupmain.py- Example functionality with proper logging
Example usage:
from my_project.sample_module import main
# Call a function from the example module
result = main.process_data([1, 2, 3])
print(result)
The example module automatically sets up logging based on your configuration in .app_cache/config.yaml.
📋 Project Types
🔹 Simple Project
Basic project with minimal functionality:
Available Operations
-
📥 Install: Install the project
# From the app menu, select "Install" # The project will be installed in the current environment
-
🧪 Test: Run tests
# From the app menu, select "Test" # Tests will be run using unittest discover
-
🏗️ Build: Build the project
# From the app menu, select "Build" # The project will be built using setup.py build
-
🧹 Clean: Clean build artifacts
# From the app menu, select "Clean" # Build artifacts will be removed
🔹 Development Project
Advanced project with development capabilities:
Available Operations
-
📥 Install: Install the project with development dependencies
# From the app menu, select "Install" # The project will be installed with development dependencies
-
🧪 Test: Run tests with options
# From the app menu, select "Test" # Choose a test option: # - All tests # - Failed tests only # - With coverage
-
🔄 Prehook: Configure pre-commit hooks
# From the app menu, select "Prehook" # Choose an action: # - on: Enable pre-commit hooks # - off: Disable pre-commit hooks
-
📦 Release: Create a release
# From the app menu, select "Release" # Choose a release type: # - beta: Create a beta release # - prod: Create a production release
-
🚀 Deploy: Deploy the project
# From the app menu, select "Deploy" # Choose a deployment target: # - test: Deploy to TestPyPI # - prod: Deploy to PyPI
🔹 GitHub Project
Project with GitHub integration:
Available Operations
-
📥 Clone Repository: Clone a GitHub repository
# From the app menu, select "Clone Repository" # Enter the repository URL # Choose a template to apply (optional)
-
⬇️ Pull Changes: Pull changes from the remote repository
# From the app menu, select "Pull Changes" # Changes will be pulled from the remote repository
-
⬆️ Push Changes: Push changes to the remote repository
# From the app menu, select "Push Changes" # Enter a commit message # Changes will be committed and pushed to the remote repository
📝 Template System
CICD Tools uses Copier for template-based project creation and updates.
Available Templates
🔹 Simple Project
- Features:
- Basic project structure
- setup.py
- Tests
- Sample module with logging
- Configuration in .app_cache/config.yaml
- Use case: Simple utility libraries, scripts
🔹 Development Project
- Features:
- pyproject.toml
- Pre-commit hooks
- GitHub Actions workflows
- Sample module with logging
- Configuration in .app_cache/config.yaml
- Use case: Libraries with CI/CD requirements, packages for distribution
🔹 GitHub Project
- Features:
- GitHub-specific files (issue templates, PR templates)
- GitHub Actions
- Sample module with logging
- Configuration in .app_cache/config.yaml
- Use case: Open source projects hosted on GitHub
Creating Custom Templates
Step-by-Step Guide
- Create a directory for your template in the
project_templatesdirectory. - Create a
copier.yamlfile with template configuration. - Add template files with
.jinjaextension for templating. - Include a sample module with logging capabilities.
- Add a default configuration file template.
Example copier.yaml:
# Custom Template Configuration
_version: "0.1.0"
_description: "My custom template"
# Project Information
project_name:
type: str
help: "Name of the project"
default: "custom-project"
🏗️ Architecture
The CICD Tools package follows a modular design pattern for extensibility and maintainability:
graph TD
CLI[CLI Module] --> CreateMenu[Create Menu]
CLI --> AppMenu[App Menu]
CreateMenu --> TemplateManager[Template Manager]
AppMenu --> ProjectDetector[Project Type Detector]
ProjectDetector --> BaseProject[Base Project]
ProjectDetector --> DevProject[Development Project]
ProjectDetector --> SimpleProject[Simple Project]
BaseProject --> ConfigManager[Config Manager]
DevProject --> GitMixin[Git Mixin]
DevProject --> VersionMixin[Version Manager Mixin]
TemplateManager --> Templates[Project Templates]
Key Components
- CLI Module: Entry point handling command-line arguments and routing to appropriate menus
- Create Menu: Handles the project creation workflow
- App Menu: Provides operations for existing projects
- Template Manager: Manages template rendering using Copier
- Project Type Detector: Identifies project type based on configuration and structure
- Base Project & Mixins: Provides functionality using a composable design pattern
- Config Manager: Centralized configuration handling
⚠️ Troubleshooting
Common issues and their solutions:
Environment Detection Failures
Problem: Environment is not detected properly or virtual environment operations fail.
Solutions:
- Ensure Python (3.8+) is correctly installed and in your PATH
- Check for permissions to create directories in the project folder
- Try running with administrator/elevated privileges
- For virtual environment issues, ensure you have the venv module installed
Template Rendering Problems
Problem: Project creation fails during template rendering.
Solutions:
- Verify you have the latest version of CICD Tools
- Check that all input values match the expected format
- For custom templates, validate your copier.yaml file syntax
- Try with a simpler template first to isolate the issue
Pre-commit Hook Failures
Problem: Pre-commit hooks fail or don't run as expected.
Solutions:
- Run
cicd_tools app, select Prehook → run to see specific failures - Ensure you have the dev dependencies installed with
pip install -e ".[dev]" - Check that your files are properly formatted according to the hooks
- For custom hooks, verify your .pre-commit-config.yaml file
Release and Deployment Issues
Problem: Release creation or deployment to PyPI fails.
Solutions:
- Ensure you have a properly configured .pypirc file
- Verify you have permissions to publish to the specified PyPI repository
- Check that your version is incremented and follows semantic versioning
- Validate package structure with
twine check dist/*before deploying
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cicd_tools-1.0.2.tar.gz.
File metadata
- Download URL: cicd_tools-1.0.2.tar.gz
- Upload date:
- Size: 46.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4b6a7116717c9838e6ec6c94899cb3b96962e2ad9e0c3dc77c6d236703d8145
|
|
| MD5 |
9014d9715958c200fcf5604eb0cc4919
|
|
| BLAKE2b-256 |
b9ee1a406e8c16383313d8ad542c675701e979b4ff946aa5783972ea63e03fed
|
File details
Details for the file cicd_tools-1.0.2-py3-none-any.whl.
File metadata
- Download URL: cicd_tools-1.0.2-py3-none-any.whl
- Upload date:
- Size: 40.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d254047bd7d0ba952b014ff74849db6f02d938bedbe4c308a80ed9c453529afd
|
|
| MD5 |
cf11bfed383f1044fcad3eb4022811c7
|
|
| BLAKE2b-256 |
fd8c471f8e8eec02ce6906097953234edb3c40ef061e4d5549990aa809e47bff
|