Skip to content

Repository files navigation

Simple online Python 3.11 Code Editor

This is a take home assignment for a job position at a cool company.

CleanShot.2024-06-02.at.15.39.09.mp4

The website is an online code editor for Python 3.11, with a test code button thats runs the code, and a submit button to persist the code into a database.

Prerequisites

  • Python3
  • Poetry
  • npm
  • Docker
  • just (optional)

You should first build a Docker container with the image containing Python 3.11, numpy, pandas and scipy with one of the following commands.

The backend Python's package management is done using Poetry, and the frontend's package management is done using npm.

You can find an overview of the codebase's key elements in /docs.

just build-container
docker build -t python-numpy-pandas .

This is the container image for where user submitted codes will be ran.

You should also provide environment variables as per any instances of .env.example. In this project, you need to provide an environment variable indicating the server's url in the /client codes, otherwise, a default one will be used.

Running the project

I use just as a script runner, with available scripts located in the justfile, for functionalities such as formatting, testing, etc.

From the root directory of the project, to launch the frontend, use one of the following commands below

just ui
npm run dev

And one of the following commands for the backend:

just serve
poetry run fastapi dev src/server.py

Running tests

There are a couple simple test cases for the backend of the project, testing for correct functioning of some components, including their security against malicious user submissions. To run tests, use one of the following commands

just test
poetry run pytest src/tests

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages