# FrameworkAPI, a Modular Framework Runner
<picture>
<source media="(prefers-color-scheme: dark)" srcset="logo_dark.png">
<source media="(prefers-color-scheme: light)" srcset="logo.png">
<img alt="Shows an illustrated sun in light mode and a moon with stars in dark mode." src="https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png" height="200px">
</picture>
A Python module for creating fully modular and extensible workflows by combining scripts in different languages, managing YAML-based configurations, and offering an API for seamless integration.
---
## Features
### 🚀 **Script Runner**
Easily run scripts written in Python, R, or Julia with dynamic argument support.
- **Automatic Language Detection**: Identify script type and invoke the appropriate runtime (e.g., `python`, `Rscript`, `julia`).
- **Flexible Argument Passing**: Pass command-line arguments directly to scripts for parameterized execution.
- **Robust Error Handling**: Logs and handles errors during script execution.
### 📜 **YAML Configuration Handler**
Effortlessly parse, validate, and manage YAML files with cross-references.
- **Dynamic Parsing**: Load YAML configurations into Python objects.
- **Cross-Reference Resolution**: Automatically resolve dependencies between keys within a single file or across multiple files.
- **Flexible Configuration Management**: Merge or extend YAML files to build modular workflows.
### 🛠 **High-Level API for Script Execution**
A simple API to link scripts and configurations for easy execution.
- **Script Discovery**: Fetch script paths and parameters from the YAML configuration.
- **Workflow Automation**: Execute scripts dynamically based on configuration settings.
- **Extensibility**: Add hooks for pre- and post-processing or extend functionality as needed.
---
## Installation
```bash
pip install FrameworkAPI
```
---
## Quickstart
### 1️⃣ Define Your Configuration (`config.yaml`)
```yaml
scripts:
preprocess:
path: "scripts/preprocess.py"
args:
input_file: "data/raw.csv"
output_file: "data/processed.csv"
analyze:
path: "scripts/analyze.R"
args:
input_file: "data/processed.csv"
report_file: "results/report.html"
workflow:
- preprocess
- analyze
```
---
### 2️⃣ Run Scripts Using the API
```python
from FrameworkAPI import FrameworkAPI
# Load configuration
framework = FrameworkAPI("config.yaml")
# Execute the entire workflow
framework.run_workflow()
# Or execute a single script by name
framework.run_script("preprocess")
```
---
### 3️⃣ Seamlessly Handle Multiple Languages
The module automatically detects the script type and runs the appropriate interpreter:
- `.py` → `python`
- `.R` → `Rscript`
- `.jl` → `julia`
---
## Directory Structure
```plaintext
project/
├── config.yaml # Your YAML configuration file
├── scripts/ # Directory for scripts
│ ├── preprocess.py # Python script
│ ├── analyze.R # R script
├── results/ # Output directory
└── main.py # Main Python script
```
---
## Advanced Features
- **Cross-References in YAML**: Use references to reuse values across the configuration.
```yaml
data_dir: "data/"
scripts:
preprocess:
input_file: "${data_dir}raw.csv"
output_file: "${data_dir}processed.csv"
```
- **Custom Hooks**: Add pre- or post-processing logic in Python for additional control.
---
## Contributing
We welcome contributions! Please submit a pull request or open an issue for bug reports, feature requests, or questions.
---
## License
This project is licensed under the MIT License.
---
## Contact
Feel free to reach out for support or collaboration:
- **Email**: pedro-henrique.herig-coimbra@inrae.com
- **GitHub**: [GitHub Repository](https://github.com/pedrohenriquecoimbra/FrameworkAPI)
---
Happy scripting! ✨
Raw data
{
"_id": null,
"home_page": "https://github.com/pedrohenriquecoimbra/FrameworkAPI",
"name": "FrameworkAPI",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "modular, lazy, callable",
"author": "Pedro Henrique Coimbra",
"author_email": "pedro-henrique.herig-coimbra@inrae.fr",
"download_url": "https://files.pythonhosted.org/packages/20/78/cd7c620dd7ff3ae4e36ab4fc793bb0cb7cc22048730892ea8b1b314c5b54/frameworkapi-0.0.3.tar.gz",
"platform": "any",
"description": "# FrameworkAPI, a Modular Framework Runner\r\n\r\n<picture>\r\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"logo_dark.png\">\r\n <source media=\"(prefers-color-scheme: light)\" srcset=\"logo.png\">\r\n <img alt=\"Shows an illustrated sun in light mode and a moon with stars in dark mode.\" src=\"https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png\" height=\"200px\">\r\n</picture>\r\n\r\nA Python module for creating fully modular and extensible workflows by combining scripts in different languages, managing YAML-based configurations, and offering an API for seamless integration.\r\n\r\n---\r\n\r\n## Features\r\n\r\n### \ud83d\ude80 **Script Runner**\r\nEasily run scripts written in Python, R, or Julia with dynamic argument support.\r\n- **Automatic Language Detection**: Identify script type and invoke the appropriate runtime (e.g., `python`, `Rscript`, `julia`).\r\n- **Flexible Argument Passing**: Pass command-line arguments directly to scripts for parameterized execution.\r\n- **Robust Error Handling**: Logs and handles errors during script execution.\r\n\r\n### \ud83d\udcdc **YAML Configuration Handler**\r\nEffortlessly parse, validate, and manage YAML files with cross-references.\r\n- **Dynamic Parsing**: Load YAML configurations into Python objects.\r\n- **Cross-Reference Resolution**: Automatically resolve dependencies between keys within a single file or across multiple files.\r\n- **Flexible Configuration Management**: Merge or extend YAML files to build modular workflows.\r\n\r\n### \ud83d\udee0 **High-Level API for Script Execution**\r\nA simple API to link scripts and configurations for easy execution.\r\n- **Script Discovery**: Fetch script paths and parameters from the YAML configuration.\r\n- **Workflow Automation**: Execute scripts dynamically based on configuration settings.\r\n- **Extensibility**: Add hooks for pre- and post-processing or extend functionality as needed.\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```bash\r\npip install FrameworkAPI\r\n```\r\n\r\n---\r\n\r\n## Quickstart\r\n\r\n### 1\ufe0f\u20e3 Define Your Configuration (`config.yaml`)\r\n\r\n```yaml\r\nscripts:\r\n preprocess:\r\n path: \"scripts/preprocess.py\"\r\n args:\r\n input_file: \"data/raw.csv\"\r\n output_file: \"data/processed.csv\"\r\n analyze:\r\n path: \"scripts/analyze.R\"\r\n args:\r\n input_file: \"data/processed.csv\"\r\n report_file: \"results/report.html\"\r\n\r\nworkflow:\r\n - preprocess\r\n - analyze\r\n```\r\n\r\n---\r\n\r\n### 2\ufe0f\u20e3 Run Scripts Using the API\r\n\r\n```python\r\nfrom FrameworkAPI import FrameworkAPI\r\n\r\n# Load configuration\r\nframework = FrameworkAPI(\"config.yaml\")\r\n\r\n# Execute the entire workflow\r\nframework.run_workflow()\r\n\r\n# Or execute a single script by name\r\nframework.run_script(\"preprocess\")\r\n```\r\n\r\n---\r\n\r\n### 3\ufe0f\u20e3 Seamlessly Handle Multiple Languages\r\n\r\nThe module automatically detects the script type and runs the appropriate interpreter:\r\n- `.py` \u2192 `python`\r\n- `.R` \u2192 `Rscript`\r\n- `.jl` \u2192 `julia`\r\n\r\n---\r\n\r\n## Directory Structure\r\n\r\n```plaintext\r\nproject/\r\n\u251c\u2500\u2500 config.yaml # Your YAML configuration file\r\n\u251c\u2500\u2500 scripts/ # Directory for scripts\r\n\u2502 \u251c\u2500\u2500 preprocess.py # Python script\r\n\u2502 \u251c\u2500\u2500 analyze.R # R script\r\n\u251c\u2500\u2500 results/ # Output directory\r\n\u2514\u2500\u2500 main.py # Main Python script\r\n```\r\n\r\n---\r\n\r\n## Advanced Features\r\n\r\n- **Cross-References in YAML**: Use references to reuse values across the configuration.\r\n ```yaml\r\n data_dir: \"data/\"\r\n scripts:\r\n preprocess:\r\n input_file: \"${data_dir}raw.csv\"\r\n output_file: \"${data_dir}processed.csv\"\r\n ```\r\n \r\n- **Custom Hooks**: Add pre- or post-processing logic in Python for additional control.\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! Please submit a pull request or open an issue for bug reports, feature requests, or questions.\r\n\r\n---\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n\r\n---\r\n\r\n## Contact\r\n\r\nFeel free to reach out for support or collaboration:\r\n- **Email**: pedro-henrique.herig-coimbra@inrae.com\r\n- **GitHub**: [GitHub Repository](https://github.com/pedrohenriquecoimbra/FrameworkAPI)\r\n\r\n--- \r\n\r\nHappy scripting! \u2728\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python module to easily run scripts in modular frameworks Written by pedrohenriquecoimbra",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/pedrohenriquecoimbra/FrameworkAPI"
},
"split_keywords": [
"modular",
" lazy",
" callable"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bad48f5e4e7e76748d5daac41733fafd8bd39b3acfe6a2c367a4f3f0c9a6f651",
"md5": "911af452aeb93cbd87b1f5a3cb711e50",
"sha256": "33e9d0d0f9f8d9a243b13e148b94de727f5e398b24d2f6e2f8553e0813b632f6"
},
"downloads": -1,
"filename": "FrameworkAPI-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "911af452aeb93cbd87b1f5a3cb711e50",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12592,
"upload_time": "2024-12-16T15:43:14",
"upload_time_iso_8601": "2024-12-16T15:43:14.887894Z",
"url": "https://files.pythonhosted.org/packages/ba/d4/8f5e4e7e76748d5daac41733fafd8bd39b3acfe6a2c367a4f3f0c9a6f651/FrameworkAPI-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2078cd7c620dd7ff3ae4e36ab4fc793bb0cb7cc22048730892ea8b1b314c5b54",
"md5": "50ac8e2b126a8e67092cd8a9c72df66b",
"sha256": "edb0c63310d2fdda34912b97648f342d555402d0285a83363515ca0c7460eb9f"
},
"downloads": -1,
"filename": "frameworkapi-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "50ac8e2b126a8e67092cd8a9c72df66b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6574,
"upload_time": "2024-12-16T15:43:18",
"upload_time_iso_8601": "2024-12-16T15:43:18.008302Z",
"url": "https://files.pythonhosted.org/packages/20/78/cd7c620dd7ff3ae4e36ab4fc793bb0cb7cc22048730892ea8b1b314c5b54/frameworkapi-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 15:43:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pedrohenriquecoimbra",
"github_project": "FrameworkAPI",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "frameworkapi"
}