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 (Node.js/Express) - 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

Node.js/Express Project

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/
โ”œโ”€โ”€ 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 (Node.js/Express)"

# 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
  • 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.0 - 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

v1.1.0 (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-1.0.3.tar.gz (30.9 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-1.0.3-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_extension_toolkit-1.0.3.tar.gz
  • Upload date:
  • Size: 30.9 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-1.0.3.tar.gz
Algorithm Hash digest
SHA256 3b4ad9e8df1547b6982b45a48b96a5a39653fd22473805589a0c376399a2a3d2
MD5 2b6bb944c62905fffd2133b0852c3a21
BLAKE2b-256 cb0a16ec094e4b10be70034c86fa25db5810d3b54c18dbb4b0931744a97d9e59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for py_extension_toolkit-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 78a9e16f71a574f42a39774c2c2f242117778e47e03293cb71f8e67d83d8a37f
MD5 10ee92ebb0e1b06be752ba1e91e5e52e
BLAKE2b-256 631c5a2b48ce2ec5e4884a0e41e69f22157c20b53ab7e45b9604b06c5c293813

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