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.
- 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-containerdocker 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.
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 uinpm run devAnd one of the following commands for the backend:
just servepoetry run fastapi dev src/server.pyThere 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 testpoetry run pytest src/tests