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/cli.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:
- Project Type Selection - Choose from 10+ extension types
- Project Name - Enter your project name
- Dependencies - Automatic NPM/pip package installation
- 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/healthand/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
-
Initialize Project
pet init # Interactive prompts guide you through setup
-
Develop Locally
pet run # HTTPS development server with hot reload
-
Validate & Test
pet validate # Check project structure and dependencies
-
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/cli.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.
- 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
๐ Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
๐ Acknowledgments
PET is inspired by modern extension development tools and follows industry best practices for security, performance, and developer experience.
Project details
Release history Release notifications | RSS feed
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 py_extension_toolkit-1.0.2.tar.gz.
File metadata
- Download URL: py_extension_toolkit-1.0.2.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a178a99905bc512175491ab3658053e996278972b0ad2eec1192d4a10ed75b
|
|
| MD5 |
70d257104363801b08f6d397d2ec467f
|
|
| BLAKE2b-256 |
339e623ac9a4f3018383e3b7f79155c193a5a5a0ded3b8d275e6f547d42c9427
|
File details
Details for the file py_extension_toolkit-1.0.2-py3-none-any.whl.
File metadata
- Download URL: py_extension_toolkit-1.0.2-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64db2ba433f1e495b3824d4630c19ce1b9c3fcde48d6882d3513aa82e27e4901
|
|
| MD5 |
f6b6b806e8886f8493224a402affbeb1
|
|
| BLAKE2b-256 |
6c7ab28935e8d7369ce917bbf7af6c2d33d5c1f4852883196ec76ac513ea4503
|