Skip to content

Add python as a language #8

Merged
ranuru merged 12 commits into
mainfrom
development
May 8, 2026
Merged

Add python as a language #8
ranuru merged 12 commits into
mainfrom
development

Conversation

@ranuru

@ranuru ranuru commented May 8, 2026

Copy link
Copy Markdown
Owner

This pull request introduces multi-language support for coding challenges, specifically adding Python as an alternative to JavaScript. It does so by extending the backend data model to support challenge variants per language, seeding Python variants for all challenges, and implementing a secure Python code runner service using Docker and Flask. The frontend is updated to allow users to select a language, edit code in that language, and run tests accordingly. The main changes are grouped below:

Backend: Multi-language Challenge Support

  • Added a new ChallengeVariant entity and repository to represent and store language-specific variants (starter code and harness templates) for each challenge. The Challenge model now has a variants field for these. [1] [2] [3]
  • Updated the data seeder (DataSeeder.java) to add Python variants for all seeded challenges, including harness templates and starter code for Python. [1] [2] [3] [4] [5] [6] [7] [8]

Runner Service: Secure Python Execution

  • Introduced a new runner service (Dockerized Flask app) that safely executes user-submitted Python code using a harness template, reading input from stdin and returning structured JSON results. Includes error and timeout handling. [1] [2] [3]
  • Updated docker-compose.yml and frontend nginx.conf to include and route requests to the new runner service. [1] [2]

Frontend: Language Selection and Execution

  • Enhanced the challenge page to allow users to select between JavaScript and Python (if available), updating the code editor and test execution logic accordingly. When Python is selected, code is sent to the new runner service. [1] [2] [3]
  • Ensured deep equality checks for test results are order-insensitive by sorting object keys before comparison, improving reliability of test result validation.

These changes collectively enable users to solve challenges in multiple languages, with secure and isolated execution for Python code.

@ranuru ranuru self-assigned this May 8, 2026
@ranuru ranuru added the enhancement New feature or request label May 8, 2026
@ranuru ranuru merged commit 3181350 into main May 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant