Skip to main content

A Python CLI tool for creating web extensions, microservices, and integrations with ease

Project description

Python Extension Toolkit (PET)

A powerful CLI tool for creating web extensions, microservices, and integrations with ease. PET provides a modern development workflow with support for both Node.js/Express and Python/Flask projects.

๐Ÿš€ Installation

From PyPI (Recommended)

pip install py-extension-toolkit

From GitHub

pip install git+https://github.com/Aqary-Org/py-extension-toolkit.git

โšก Quick Start

# Create a new extension project
pet init

# Start the development server
pet run

๐Ÿ“‹ Available Project Types

When you run pet init, you can choose from various project types:

  • Web Extension - Modern web extensions with Express.js
  • Python Extension (Flask) - Traditional Python extensions with Flask
  • API Integration - RESTful API integrations and connectors
  • Microservice - Containerized microservices
  • Dashboard Extension - Interactive dashboards and widgets
  • Data Connector - Database and external service connectors
  • Webhook Handler - Event-driven webhook processors
  • Custom Widget - Embeddable UI components
  • Background Service - Long-running background processes
  • CLI Tool - Command-line utilities and scripts

๐Ÿ› ๏ธ Usage

Interactive Project Creation

pet init

This will guide you through:

  1. Project Type Selection - Choose from 10+ extension types
  2. Project Name - Enter your project name
  3. Dependencies - Automatic NPM/pip package installation
  4. Project Structure - Complete scaffolding with best practices

Development Server

cd your-project
pet run

Features:

  • Interactive Prompts - Configure port, host, and browser settings
  • HTTPS Development - Secure development environment
  • Auto-reload - File watching and automatic restarts
  • Express/Flask Support - Supports both Node.js and Python projects

Other Commands

# Validate project structure
pet validate

# Package for distribution
pet pack

# Login to extension platform (coming soon)
pet login

# List workspaces (coming soon)
pet list-workspace

๐Ÿ—๏ธ Generated Project Structure

Web Extension

my-extension/
โ”œโ”€โ”€ package.json           # NPM configuration
โ”œโ”€โ”€ server.js             # Express server with security middleware
โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ””โ”€โ”€ assets/
โ”œโ”€โ”€ README.md             # Project documentation
โ””โ”€โ”€ .gitignore           # Git ignore rules

Python/Flask Project

my-extension/
โ”œโ”€โ”€ plugin-manifest.json         # Extension manifest
โ”œโ”€โ”€ app.py               # Flask application
โ”œโ”€โ”€ static/              # Static assets
โ”œโ”€โ”€ templates/           # Jinja2 templates
โ”œโ”€โ”€ requirements.txt     # Python dependencies
โ””โ”€โ”€ README.md           # Project documentation

๐Ÿ”ง Features

  • ๐Ÿš€ Multiple Project Types - 10+ extension templates for different use cases
  • โšก Modern Tooling - Express.js with security middleware, Flask with best practices
  • ๏ฟฝ Security First - CORS, rate limiting, helmet security headers included
  • ๐Ÿ“ฆ Auto Dependencies - Automatic NPM/pip package installation
  • ๐ŸŒ HTTPS Development - Secure development server out of the box
  • ๐Ÿ”„ Hot Reload - File watching and automatic server restarts
  • ๐Ÿ“ฑ Cross Platform - Works on Windows, macOS, and Linux
  • ๐ŸŽฏ Production Ready - Generated code follows industry best practices

๐Ÿ“– Example Walkthrough

# 1. Install PET
pip install py-extension-toolkit

# 2. Create a new API integration project
pet init
# Select: API Integration
# Enter name: my-api-connector

# 3. Navigate to project
cd my-api-connector

# 4. Start development server
pet run
# Choose port: 3000
# Choose host: 127.0.0.1 (default)
# Auto-open browser: Y

# 5. Your extension is now running at https://127.0.0.1:3000

This creates a complete Express.js server with:

  • CORS middleware for cross-origin requests
  • Rate limiting for API protection
  • Helmet security headers
  • Error handling middleware
  • Health check endpoints
  • Extension info API

๐Ÿ”ง Configuration

PET supports both interactive and configuration-based project setup:

Environment Variables

# Set default project type
export PET_DEFAULT_TYPE="Web Extension"

# Set default port for development server
export PET_DEFAULT_PORT=5000

# Set default host
export PET_DEFAULT_HOST="127.0.0.1"

Project Configuration

Each generated project includes configuration files:

  • package.json - NPM scripts and dependencies for Node.js projects
  • requirements.txt - Python dependencies for Flask projects
  • plugin-manifest.json - Extension metadata and configuration

๐Ÿš€ API Reference

Express.js Projects Include:

  • CORS - Cross-Origin Resource Sharing support
  • Rate Limiting - Protection against abuse
  • Helmet - Security headers middleware
  • Error Handling - Comprehensive error management
  • Health Endpoints - /api/health and /api/extension-info

Flask Projects Include:

  • Flask-CORS - Cross-origin request handling
  • Error Handling - Custom error pages and API responses
  • Template Engine - Jinja2 templating system
  • Static Files - Optimized static file serving

๐ŸŒ Development Workflow

  1. Initialize Project

    pet init
    # Interactive prompts guide you through setup
    
  2. Develop Locally

    pet run
    # HTTPS development server with hot reload
    
  3. Validate & Test

    pet validate
    # Check project structure and dependencies
    
  4. Package & Deploy

    pet pack
    # Create distributable package
    

๐Ÿ“ฆ Dependencies

Core Requirements

  • Python 3.8 or higher
  • Node.js 14+ (for Node.js projects)
  • npm (automatically installs with Node.js)

Python Dependencies

  • click>=8.0.0 - Command-line interface framework
  • flask>=2.0.1 - Web framework for Python projects
  • flask-cors>=4.0.0 - CORS support for Flask
  • requests>=2.25.0 - HTTP library

Node.js Dependencies (Auto-installed)

  • express - Fast web framework for Node.js
  • cors - CORS middleware
  • helmet - Security middleware
  • express-rate-limit - Rate limiting middleware

๐Ÿ› ๏ธ Development

For contributing to PET development:

git clone https://github.com/Aqary-Org/py-extension-toolkit.git
cd cli/python-extension-toolkit
pip install -e .

Running Tests

# Install test dependencies
pip install pytest pytest-cov

# Run tests
pytest tests/

# Run with coverage
pytest --cov=pet tests/

Publishing to PyPI

# Build package
python -m build

# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*

# Upload to PyPI
python -m twine upload dist/*

๐Ÿ“‹ Version History

v2.0.1 (Latest)

  • โœ… Generic extension toolkit (removed platform-specific references)
  • โœ… 10+ project types for various use cases
  • โœ… Node.js/Express workflow with NPM support
  • โœ… Improved security with helmet and rate limiting
  • โœ… Fixed syntax issues in generated templates
  • โœ… Enhanced error handling and logging

v1.0.0

  • Initial release with basic extension scaffolding
  • Flask-based Python extensions
  • Basic project templates

๐Ÿ“„ License

MIT License - see LICENSE for details.

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ž Support

๐Ÿ† Acknowledgments

PET is inspired by modern extension development tools and follows industry best practices for security, performance, and developer experience.

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

py_extension_toolkit-2.0.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

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

py_extension_toolkit-2.0.1-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file py_extension_toolkit-2.0.1.tar.gz.

File metadata

  • Download URL: py_extension_toolkit-2.0.1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for py_extension_toolkit-2.0.1.tar.gz
Algorithm Hash digest
SHA256 25f50cef6b3037bc8c13a5a1def2170de7f26c98b6800e5b3944bbe09cc95946
MD5 dbc914414425024d0b601eba0fe1fee7
BLAKE2b-256 33c6fa32b4e0c0fbb4edb8e33b7e94ccada51e453de45a76dadeb292a2cd51fa

See more details on using hashes here.

File details

Details for the file py_extension_toolkit-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_extension_toolkit-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0d4325c9dbedf2a79a4d32ed6ee8ed1e2a1db9de6a3ccd2851b257268c8399ef
MD5 688252e8906484feffd6be21808981f3
BLAKE2b-256 7143d62697da14101cf714096779af966800280e4dddf1bada4cfbee658d25ac

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