{"id":15014469,"url":"https://github.com/marwan37/pennant-flask-server","last_synced_at":"2026-03-17T23:02:12.394Z","repository":{"id":232630351,"uuid":"697580625","full_name":"marwan37/pennant-flask-server","owner":"marwan37","description":"This repository contains the Python remote code execution engine for the pennant-notebook project.","archived":false,"fork":false,"pushed_at":"2023-10-04T03:06:23.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-31T14:44:40.139Z","etag":null,"topics":["celery","flask","ipython","python","rabbitmq","redis","remote-code-execution-engine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marwan37.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-28T03:19:39.000Z","updated_at":"2023-10-04T03:06:05.000Z","dependencies_parsed_at":"2024-04-10T19:29:26.204Z","dependency_job_id":null,"html_url":"https://github.com/marwan37/pennant-flask-server","commit_stats":null,"previous_names":["marwan37/pennant-flask-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marwan37/pennant-flask-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan37%2Fpennant-flask-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan37%2Fpennant-flask-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan37%2Fpennant-flask-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan37%2Fpennant-flask-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marwan37","download_url":"https://codeload.github.com/marwan37/pennant-flask-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan37%2Fpennant-flask-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30635029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T22:38:22.569Z","status":"ssl_error","status_checked_at":"2026-03-17T22:38:11.804Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celery","flask","ipython","python","rabbitmq","redis","remote-code-execution-engine"],"created_at":"2024-09-24T19:45:40.253Z","updated_at":"2026-03-17T23:02:12.374Z","avatar_url":"https://github.com/marwan37.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pennant Flask Server\n\n## Overview\n\nThis repository serves as the remote Python code execution backend for the Pennant notebook application. It uses Flask, Celery, RabbitMQ and Redis to handle code execution requests and manage notebook states.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [API Endpoints](#api-endpoints)\n- [Contributing](#contributing)\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/marwan37/pennant-flask-server.git\n```\n\n2. Install the required packages:\n\n```bash\npip install -r requirements.txt\n```\n\n## Configuration\n\n- Celery Configuration: Modify the settings in the [config/celery.py](https://github.com/marwan37/pennant-flask-server/blob/main/config/celery.py) file.\n- Celery Worker Service: A systemd service file is provided in [config/celery-worker.service](https://github.com/marwan37/pennant-flask-server/blob/main/config/celery-worker.service).\n\n## Usage\n\nRun the Flask application:\n\n```bash\npython app.py\n```\n\n## Running Celery Worker\n\n### From Terminal, or Linux (e.g., DigitalOcean Droplet)\n\n1. Navigate to the project directory.\n2. Run the following command to start the Celery worker:\n\n```bash\ncelery -A app.celery worker\n```\n\n\n## Endpoints\n\n### Submit Code\nSubmits code for execution.\n\nURL: `/api/submit`\n\nMethod: `POST`\n\nParameter | Type | Required | Description\n--- | --- | --- | ---\n`notebookId` | `string` | Yes | The ID of the notebook.\n`cells` | `array` | Yes | An array of cells to be executed.\n\nResponse:\n\nProperty | Type | Description\n--- | --- | ---\n`submissionId` | `string` | Token to track the status of the submission.\n\n### Get Submission Status\nRetrieves the status of a submitted notebook.\n\nURL: `/api/status/:submissionId`\n\nMethod: `GET`\n\nParameter | Type | Required | Description\n--- | --- | --- | ---\n`submissionId` | `string` | Yes | Token received by the submission endpoint.\n\n### Reset Notebook\nResets the context for a notebook.\n\nURL: `/api/reset/:notebookId`\n\nMethod: `POST`\n\nParameter | Type | Required | Description\n--- | --- | --- | ---\n`notebookId` | `string` | Yes | The ID of the notebook to reset.\n\n### Notebook Status\nChecks if a notebook is active.\n\nURL: `/notebookstatus/:notebookId`\n\nMethod: `GET`\n\n### Format Python Code\nFormats Python code.\n\nURL: `/format-python`\n\nMethod: `POST`\n\n## API Status Codes\n\nStatus code | Description\n--- | ---\n200 | OK\n202 | Accepted\n400 | Bad request\n404 | Not found\n500 | Internal server error\n\n## Examples\n\n### POST /api/submit\n**Returns**: 202 Accepted and `submissionId` (token)\n\nInitiates submission. Starts code execution process.\n\n```json\n{\n\t\"notebookId\": \"111\",\n\t\"cells\": [\n      {\n        \t\"cellId\": \"3\",\n        \t\"code\": \"print('Hello, world!')\"\n      }\n  ]  \n}\n```\n\n### GET /api/status/:submissionId\n**Returns**: 200 OK and payload of results.\n\n```json\n{\n   \"submissionId\": \"0c5796d7-c8fb-4b4c-a13d-9ebedc914551\",\n   \"status\": \"success\",\n   \"results\": [\n         {\n           \"cellId\": \"3\",\n           \"type\": \"output\",\n           \"output\": \"Hello, world!\"\n       }\n   ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan37%2Fpennant-flask-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarwan37%2Fpennant-flask-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan37%2Fpennant-flask-server/lists"}