Skip to content

Alpha version of the next Micro:bit Educational Foundation Python editor

License

Notifications You must be signed in to change notification settings

pdg137/python-editor-next

 
 

Repository files navigation

Alpha version of the micro:bit Python editor

This project is an alpha version of the next major version of the editor. The currently supported micro:bit Python editor is available at https://python.microbit.org/ and its source code can be found in GitHub at https://github.com/bbcmicrobit/PythonEditor.

For more background about how this editor relates to the original Python Editor project, see this explanation.

This project is a web-based code editor that targets the MicroPython version of the Python programming language.

Code written with this editor is expected to run on the BBC micro:bit device.

Screenshot of the Python editor showing the welcome message and code editing area

You can try out the micro:bit-branded deployment of the alpha at https://python.microbit.org/v/alpha

Developing the editor

The editor is written in TypeScript using React. We use the Chakra UI component library and CodeMirror 6 editor component.

To learn React, check out the React documentation.

To learn TypeScript, check out the TypeScript documentation.

To learn more about Chakra UI check out the component library documentation.

CodeMirror 6 has great documentation. The system guide is a particularly useful overview of the key concepts.

The project was bootstrapped with Create React App. You can learn more in the Create React App documentation.

If you use Visual Studio Code you might find the devcontainer included in this repository a useful option to get an automatically configured development environment. Find out more about containers and Visual Studio Code.

Deployments

The editor is deployed by CircleCI.

The main branch is deployed to https://stage-python-editor-next.microbit.org/ on each commit.

Other branches (e.g. for PRs) are deployed to https://review-python-editor-next.microbit.org/{branch}. Special characters in the branch name are replaced by hyphens.

Building and running the editor

  1. Ensure you have a working Node.js environment. We recommend using the LTS version of Node.
  2. Checkout this repository.
  3. Install the dependencies via npm install.
  4. Choose from the NPM scripts documented below.

If you're using the devcontainer with Visual Studio Code then the "Clone a repository from GitHub in a Container Volume" action will address steps 1 through 3.

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

If you have a connected micro:bit device, then setting the environment variable TEST_MODE_DEVICE=1 will enable additional tests that will connect to your micro:bit. The tests will overwrite programs and data on the micro:bit.

npm run test:e2e

Launches the test runner in the interactive watch mode running the end to end tests.

These are excluded from the normal test run.

The tests expect the app to already be running on http://localhost:3000, for example via npm start.

We use Puppeteer and the helpers provided by Testing Library.

The CI tests run these end-to-end tests against a production build.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

License

This software is under the MIT open source license.

SPDX-License-Identifier: MIT

Binaries for MicroPython are included for micro:bit V1 (license) and micro:bit V2 (license). Both are MIT licensed.

We use dependencies via the NPM registry as specified by the package.json file under common Open Source licenses.

Full details of each package can be found by running license-checker:

$ npx license-checker --direct --summary --production

Omit the flags as desired to obtain more detail.

Code of Conduct

Trust, partnership, simplicity and passion are our core values we live and breathe in our daily work life and within our projects. Our open-source projects are no exception. We have an active community which spans the globe and we welcome and encourage participation and contributions to our projects by everyone. We work to foster a positive, open, inclusive and supportive environment and trust that our community respects the micro:bit code of conduct. Please see our code of conduct which outlines our expectations for all those that participate in our community and details on how to report any concerns and what would happen should breaches occur.

About

Alpha version of the next Micro:bit Educational Foundation Python editor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.6%
  • Python 8.9%
  • JavaScript 0.6%
  • HTML 0.5%
  • CSS 0.4%
  • Dockerfile 0.0%