https://github.com/rage/python-editor
In-browser Python editor for TestMyCode Python courses.
https://github.com/rage/python-editor
Last synced: 5 months ago
JSON representation
In-browser Python editor for TestMyCode Python courses.
- Host: GitHub
- URL: https://github.com/rage/python-editor
- Owner: rage
- License: apache-2.0
- Created: 2019-12-16T09:44:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T17:00:20.000Z (over 3 years ago)
- Last Synced: 2025-11-22T16:54:51.710Z (7 months ago)
- Language: TypeScript
- Homepage: https://python-3-editor.now.sh
- Size: 4.54 MB
- Stars: 10
- Watchers: 4
- Forks: 7
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moocfi Python Editor
[](https://www.npmjs.com/package/moocfi-python-editor)

Moocfi Python Editor is a React component that provides an in-browser editing,
running and testing environment for [TestMyCode](https://tmc.mooc.fi/) python
courses. The editor is based on
[Pyodide python runtime environment](https://github.com/iodide-project/pyodide)
that is run using webworkers.
## Usage
Install with `npm install moocfi-python-editor`.
The editor component can be used in a following way:
```jsx
import { ProgrammingExercise } from "moocfi-python-editor"
const App = () => {
// ...
return (
)
}
```
Required properties:
- `organization`, `course` and `exercise` Define which TMC exercise will be loaded.
- `userId` and `token` are used to identify the current user.
Optional properties:
- `debug` Show and log debug information if set to `true`.
- `language` Editor's localization. Currently supports `en` (default) and `fi`.
- `height` Height of the editor. Defaults to `400px`.
- `outputHeight` Maximum height of the output content in pixels.
- `onExerciseDetailsChange` Callback function that provides details about the exercise. These details vary by user.
## Setting up the project
1. Clone the project on GitHub
2. Go to the project root directory and run `npm ci` & `npm run encode:worker`
3. Go to the `example` directory and run `npm ci`
## Running the project
To run the project in example environment, go to the `example` directory and
run `npm start`.
If you make any changes to the worker, you will always need to run the `encode:worker` command again.
## License
This project is licensed under either of
- Apache License, Version 2.0, ([LICENSE](LICENSE) or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license, ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.