# PEM - Python Execution Manager 🚀
**A powerful, modern Python tool for managing, scheduling, and executing Python scripts and projects with ease.**
[](https://www.python.org/downloads/)
[](LICENSE)
[](https://github.com/astral-sh/uv)
## ✨ What is PEM?
PEM is your all-in-one solution for Python execution management. Whether you're running one-off scripts, managing complex projects, or scheduling automated tasks, PEM makes it simple and reliable.
### 🎯 Perfect for:
- **DevOps Engineers** managing deployment scripts and automation
- **Data Scientists** running scheduled data processing jobs
- **Python Developers** organizing and executing multiple projects
- **System Administrators** automating maintenance tasks
- **Anyone** who needs reliable Python script execution with logging
## 🌟 Key Features
### 📋 **Job Management**
- **Two Job Types**: Handle both standalone scripts and full Python projects
- **Dependency Management**: Automatically install and manage script dependencies using `uv`
- **Smart Execution**: Uses `uv run` for fast, isolated script execution
- **Project Support**: Full support for Python projects with virtual environments
### ⏰ **Flexible Scheduling**
- **Multiple Schedule Types**:
- `once` - Run at a specific date/time
- `interval` - Run every X seconds/minutes/hours/days
- `cron` - Use cron expressions for complex schedules
- `until_done` - Keep retrying until the job succeeds
- **Background Execution**: All scheduled jobs run in the background
- **Persistent Storage**: Schedules survive system restarts
### 📊 **Comprehensive Logging & Tracking**
- **Detailed Logs**: Every execution is logged with timestamps and output
- **Execution History**: Track all job runs with status, exit codes, and timing
- **SQLite Database**: Local storage for jobs, schedules, and execution history
- **Real-time Status**: See what's running, what succeeded, and what failed
### 🛠 **Developer-Friendly CLI**
- **Intuitive Commands**: Simple, memorable command structure
- **Rich Output**: Colored terminal output with emojis for better UX
- **Flexible Options**: Extensive command-line options for all use cases
- **Built with Typer**: Modern, type-safe CLI framework
## 🚀 Quick Start
### Installation
```bash
# Install PEM
pip install pem
# Or using uv (recommended)
uv add pem
```
### Basic Usage
```bash
# Run a Python script with dependencies
pem run my-data-script --script --path ./data_processor.py --with pandas --with requests
# Add a project job
pem run my-web-app --project --path ./my-flask-app --add-only
# Schedule a job to run every hour
pem schedule my-data-script --type interval --hours 1
# List all jobs
pem list
# View job execution history
pem history my-data-script
# Check scheduler status
pem status
```
## 📖 Detailed Usage
### Managing Jobs
#### Script Jobs
Perfect for standalone Python scripts with specific dependencies:
```bash
# Add and run a script with dependencies
pem run data-processor \
--script \
--path ./scripts/process_data.py \
--with pandas \
--with requests \
--with beautifulsoup4
# Just add the job without running
pem run backup-script --script --path ./backup.py --add-only
# Run an existing job
pem run backup-script --run-only
```
#### Project Jobs
For full Python projects with their own environments:
```bash
# Add a Python project
pem run my-api --project --path ./my-fastapi-project --add-only
# Run the project (will use project's own dependencies)
pem run my-api --run-only
```
### Scheduling Jobs
#### One-time Execution
```bash
# Run once at a specific time
pem schedule backup-job --type once --date "2025-12-31 23:59:59"
```
#### Interval-based Scheduling
```bash
# Every 30 minutes
pem schedule data-sync --type interval --minutes 30
# Every 2 hours
pem schedule hourly-report --type interval --hours 2
# Every day
pem schedule daily-backup --type interval --days 1
```
#### Cron-style Scheduling
```bash
# Every weekday at 9 AM
pem schedule morning-report --type cron --cron-hour 9 --cron-dow 1-5
# Every Monday at midnight
pem schedule weekly-cleanup --type cron --cron-hour 0 --cron-dow 1
```
#### Retry Until Success
```bash
# Keep trying every 5 minutes until it succeeds (max 20 attempts)
pem schedule critical-task --type until_done --retry-interval 300 --max-retries 20
```
### Monitoring & Management
```bash
# List all jobs
pem list
# Show job details
pem show my-job
# View execution history
pem history my-job
# Check what's scheduled and running
pem status
# Enable/disable jobs
pem enable my-job
pem disable my-job
# Remove jobs
pem remove my-job
```
## 🏗 Architecture
PEM is built with modern Python best practices:
- **SQLAlchemy**: Robust database ORM for job and execution tracking
- **APScheduler**: Reliable job scheduling with multiple backends
- **Typer**: Type-safe, intuitive CLI framework
- **uv**: Fast Python package management and script execution
- **AsyncIO**: Efficient asynchronous execution
## 📁 Project Structure
```
pem/
├── pem/
│ ├── cli.py # Command-line interface
│ ├── main.py # Application entry point
│ ├── settings.py # Configuration
│ ├── core/
│ │ ├── executor.py # Job execution engine
│ │ └── scheduler.py # Background scheduling
│ └── db/
│ ├── database.py # Database configuration
│ └── models.py # SQLAlchemy models
├── logs/ # Execution logs
├── pem.db # SQLite database
└── pyproject.toml # Project configuration
```
## 🔧 Configuration
PEM works out of the box with sensible defaults:
- **Database**: SQLite (`pem.db`) in the current directory
- **Logs**: Stored in `./logs/` directory
- **Virtual Environments**: Created in project directories as `.pem_venv`
## 🤝 Contributing
We welcome contributions! Here's how to get started:
1. Fork the repository
2. Create a feature branch: `git checkout -b my-new-feature`
3. Make your changes and add tests
4. Run the test suite: `pytest`
5. Submit a pull request
## 📝 License
MIT License - see [LICENSE](LICENSE) file for details.
## 🙋♀️ Support
- **Issues**: [GitHub Issues](https://github.com/arian24b/pem/issues)
- **Discussions**: [GitHub Discussions](https://github.com/arian24b/pem/discussions)
## 🚀 Why Choose PEM?
### vs. Cron
- ✅ Cross-platform (works on Windows, macOS, Linux)
- ✅ Dependency management built-in
- ✅ Detailed logging and execution history
- ✅ Easy job management with CLI
- ✅ Python-native (no shell scripting needed)
### vs. Other Task Runners
- ✅ Specifically designed for Python
- ✅ No complex configuration files
- ✅ Built-in dependency isolation
- ✅ Simple CLI interface
- ✅ Local database storage (no external dependencies)
### vs. Manual Script Running
- ✅ Automated scheduling
- ✅ Execution history and monitoring
- ✅ Dependency management
- ✅ Error handling and retries
- ✅ Centralized job management
---
**Made with ❤️ by [Arian Omrani](https://github.com/arian24b)**
*PEM - Making Python execution management simple, reliable, and powerful.*
Raw data
{
"_id": null,
"home_page": null,
"name": "pemexe",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13",
"maintainer_email": null,
"keywords": "python, scheduler, automation, devops, task-runner, cron, execution, management, scripts, projects, cli, background-jobs, logging, dependencies",
"author": "Arian Omrani",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/45/df/54e5cc3375f92fa1d3c7092ba2d17bb634ca5b2a3c6b6793d465d3c2c363/pemexe-0.1.0.tar.gz",
"platform": null,
"description": "# PEM - Python Execution Manager \ud83d\ude80\n\n**A powerful, modern Python tool for managing, scheduling, and executing Python scripts and projects with ease.**\n\n[](https://www.python.org/downloads/)\n[](LICENSE)\n[](https://github.com/astral-sh/uv)\n\n## \u2728 What is PEM?\n\nPEM is your all-in-one solution for Python execution management. Whether you're running one-off scripts, managing complex projects, or scheduling automated tasks, PEM makes it simple and reliable.\n\n### \ud83c\udfaf Perfect for:\n- **DevOps Engineers** managing deployment scripts and automation\n- **Data Scientists** running scheduled data processing jobs\n- **Python Developers** organizing and executing multiple projects\n- **System Administrators** automating maintenance tasks\n- **Anyone** who needs reliable Python script execution with logging\n\n## \ud83c\udf1f Key Features\n\n### \ud83d\udccb **Job Management**\n- **Two Job Types**: Handle both standalone scripts and full Python projects\n- **Dependency Management**: Automatically install and manage script dependencies using `uv`\n- **Smart Execution**: Uses `uv run` for fast, isolated script execution\n- **Project Support**: Full support for Python projects with virtual environments\n\n### \u23f0 **Flexible Scheduling**\n- **Multiple Schedule Types**:\n - `once` - Run at a specific date/time\n - `interval` - Run every X seconds/minutes/hours/days\n - `cron` - Use cron expressions for complex schedules\n - `until_done` - Keep retrying until the job succeeds\n- **Background Execution**: All scheduled jobs run in the background\n- **Persistent Storage**: Schedules survive system restarts\n\n### \ud83d\udcca **Comprehensive Logging & Tracking**\n- **Detailed Logs**: Every execution is logged with timestamps and output\n- **Execution History**: Track all job runs with status, exit codes, and timing\n- **SQLite Database**: Local storage for jobs, schedules, and execution history\n- **Real-time Status**: See what's running, what succeeded, and what failed\n\n### \ud83d\udee0 **Developer-Friendly CLI**\n- **Intuitive Commands**: Simple, memorable command structure\n- **Rich Output**: Colored terminal output with emojis for better UX\n- **Flexible Options**: Extensive command-line options for all use cases\n- **Built with Typer**: Modern, type-safe CLI framework\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\n# Install PEM\npip install pem\n\n# Or using uv (recommended)\nuv add pem\n```\n\n### Basic Usage\n\n```bash\n# Run a Python script with dependencies\npem run my-data-script --script --path ./data_processor.py --with pandas --with requests\n\n# Add a project job\npem run my-web-app --project --path ./my-flask-app --add-only\n\n# Schedule a job to run every hour\npem schedule my-data-script --type interval --hours 1\n\n# List all jobs\npem list\n\n# View job execution history\npem history my-data-script\n\n# Check scheduler status\npem status\n```\n\n## \ud83d\udcd6 Detailed Usage\n\n### Managing Jobs\n\n#### Script Jobs\nPerfect for standalone Python scripts with specific dependencies:\n\n```bash\n# Add and run a script with dependencies\npem run data-processor \\\n --script \\\n --path ./scripts/process_data.py \\\n --with pandas \\\n --with requests \\\n --with beautifulsoup4\n\n# Just add the job without running\npem run backup-script --script --path ./backup.py --add-only\n\n# Run an existing job\npem run backup-script --run-only\n```\n\n#### Project Jobs\nFor full Python projects with their own environments:\n\n```bash\n# Add a Python project\npem run my-api --project --path ./my-fastapi-project --add-only\n\n# Run the project (will use project's own dependencies)\npem run my-api --run-only\n```\n\n### Scheduling Jobs\n\n#### One-time Execution\n```bash\n# Run once at a specific time\npem schedule backup-job --type once --date \"2025-12-31 23:59:59\"\n```\n\n#### Interval-based Scheduling\n```bash\n# Every 30 minutes\npem schedule data-sync --type interval --minutes 30\n\n# Every 2 hours\npem schedule hourly-report --type interval --hours 2\n\n# Every day\npem schedule daily-backup --type interval --days 1\n```\n\n#### Cron-style Scheduling\n```bash\n# Every weekday at 9 AM\npem schedule morning-report --type cron --cron-hour 9 --cron-dow 1-5\n\n# Every Monday at midnight\npem schedule weekly-cleanup --type cron --cron-hour 0 --cron-dow 1\n```\n\n#### Retry Until Success\n```bash\n# Keep trying every 5 minutes until it succeeds (max 20 attempts)\npem schedule critical-task --type until_done --retry-interval 300 --max-retries 20\n```\n\n### Monitoring & Management\n\n```bash\n# List all jobs\npem list\n\n# Show job details\npem show my-job\n\n# View execution history\npem history my-job\n\n# Check what's scheduled and running\npem status\n\n# Enable/disable jobs\npem enable my-job\npem disable my-job\n\n# Remove jobs\npem remove my-job\n```\n\n## \ud83c\udfd7 Architecture\n\nPEM is built with modern Python best practices:\n\n- **SQLAlchemy**: Robust database ORM for job and execution tracking\n- **APScheduler**: Reliable job scheduling with multiple backends\n- **Typer**: Type-safe, intuitive CLI framework\n- **uv**: Fast Python package management and script execution\n- **AsyncIO**: Efficient asynchronous execution\n\n## \ud83d\udcc1 Project Structure\n\n```\npem/\n\u251c\u2500\u2500 pem/\n\u2502 \u251c\u2500\u2500 cli.py # Command-line interface\n\u2502 \u251c\u2500\u2500 main.py # Application entry point\n\u2502 \u251c\u2500\u2500 settings.py # Configuration\n\u2502 \u251c\u2500\u2500 core/\n\u2502 \u2502 \u251c\u2500\u2500 executor.py # Job execution engine\n\u2502 \u2502 \u2514\u2500\u2500 scheduler.py # Background scheduling\n\u2502 \u2514\u2500\u2500 db/\n\u2502 \u251c\u2500\u2500 database.py # Database configuration\n\u2502 \u2514\u2500\u2500 models.py # SQLAlchemy models\n\u251c\u2500\u2500 logs/ # Execution logs\n\u251c\u2500\u2500 pem.db # SQLite database\n\u2514\u2500\u2500 pyproject.toml # Project configuration\n```\n\n## \ud83d\udd27 Configuration\n\nPEM works out of the box with sensible defaults:\n\n- **Database**: SQLite (`pem.db`) in the current directory\n- **Logs**: Stored in `./logs/` directory\n- **Virtual Environments**: Created in project directories as `.pem_venv`\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Here's how to get started:\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b my-new-feature`\n3. Make your changes and add tests\n4. Run the test suite: `pytest`\n5. Submit a pull request\n\n## \ud83d\udcdd License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4b\u200d\u2640\ufe0f Support\n\n- **Issues**: [GitHub Issues](https://github.com/arian24b/pem/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/arian24b/pem/discussions)\n\n## \ud83d\ude80 Why Choose PEM?\n\n### vs. Cron\n- \u2705 Cross-platform (works on Windows, macOS, Linux)\n- \u2705 Dependency management built-in\n- \u2705 Detailed logging and execution history\n- \u2705 Easy job management with CLI\n- \u2705 Python-native (no shell scripting needed)\n\n### vs. Other Task Runners\n- \u2705 Specifically designed for Python\n- \u2705 No complex configuration files\n- \u2705 Built-in dependency isolation\n- \u2705 Simple CLI interface\n- \u2705 Local database storage (no external dependencies)\n\n### vs. Manual Script Running\n- \u2705 Automated scheduling\n- \u2705 Execution history and monitoring\n- \u2705 Dependency management\n- \u2705 Error handling and retries\n- \u2705 Centralized job management\n\n---\n\n**Made with \u2764\ufe0f by [Arian Omrani](https://github.com/arian24b)**\n\n*PEM - Making Python execution management simple, reliable, and powerful.*\n",
"bugtrack_url": null,
"license": null,
"summary": "\ud83d\ude80 Python Execution Manager - A powerful, modern tool for managing, scheduling, and executing Python scripts and projects with comprehensive logging, flexible scheduling, and dependency management. Perfect for DevOps, data science, and automation workflows.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/arian24b/pem",
"Issues": "https://github.com/arian24b/pem/issues"
},
"split_keywords": [
"python",
" scheduler",
" automation",
" devops",
" task-runner",
" cron",
" execution",
" management",
" scripts",
" projects",
" cli",
" background-jobs",
" logging",
" dependencies"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "61da666f6786b8753a4c2e4fd2a1ec16316d37d657bb4f812f202db98e8aa6c7",
"md5": "5fb77fb8bcbebb9535ab8fc33250d3bc",
"sha256": "85054f4bde7bd12ba0d641ddd887af1cac3b9fa1067a81f2d32b20702537d653"
},
"downloads": -1,
"filename": "pemexe-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5fb77fb8bcbebb9535ab8fc33250d3bc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13",
"size": 14243,
"upload_time": "2025-08-09T14:16:18",
"upload_time_iso_8601": "2025-08-09T14:16:18.625904Z",
"url": "https://files.pythonhosted.org/packages/61/da/666f6786b8753a4c2e4fd2a1ec16316d37d657bb4f812f202db98e8aa6c7/pemexe-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "45df54e5cc3375f92fa1d3c7092ba2d17bb634ca5b2a3c6b6793d465d3c2c363",
"md5": "c8c0a41be9296311bb1de5d72b6844a8",
"sha256": "727a30d92d139cae39f31de5a2dd9a80d3eeed0fbaead1db9bebd8dcc4159c6f"
},
"downloads": -1,
"filename": "pemexe-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "c8c0a41be9296311bb1de5d72b6844a8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13",
"size": 15489,
"upload_time": "2025-08-09T14:16:20",
"upload_time_iso_8601": "2025-08-09T14:16:20.105559Z",
"url": "https://files.pythonhosted.org/packages/45/df/54e5cc3375f92fa1d3c7092ba2d17bb634ca5b2a3c6b6793d465d3c2c363/pemexe-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-09 14:16:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arian24b",
"github_project": "pem",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pemexe"
}