Skip to content

microbit-foundation/sanity-plugin-python-editor-v3

Repository files navigation

Python Editor V3 Sanity schemas

This plugin contains the Sanity schemas used to manage content for the Micro:bit Educational Foundation Python Editor V3 (deployment, GitHub).

These are provided for developers who want to build alternative versions of the Python Editor so they can provide custom Reference and Ideas content.

Please note that the Reference and Ideas content used in the Python Editor V3 is not itself Open Source.

This project is provided in the hope it may be useful. The Micro:bit Educational Foundation are unable to provide significant support for its use.

Installation

npm install @microbit/sanity-plugin-python-editor-v3

Usage

This is a Sanity Studio v3 plugin.

Add it as a plugin in sanity.config.ts (or .js):

import {defineConfig} from 'sanity'
import {pythonEditor, structure} from '@microbit/sanity-plugin-python-editor-v3'

export default defineConfig({
  // ...
  plugins: [structureTool({structure}), pythonEditor()],
  schema: {
    // All necessary types are provided by the plugin.
    types: [],
  },
})

Using the exported structure is optional.

If you need to augment the types defined in this plugin then you can transform them in your app by providing a function as the types field.

The Python Editor expects some minimum content:

  • A document of type pythonIdeasConfig with the ID pythonIdeasConfig and language "en". If you use the suggested desk structure you can just publish the document under Ideas > Config.
  • A document of type toolkit with the name "Reference" and language "en".

You'll want to add additional content otherwise the tabs will be blank but this is the minimum needed to avoid errors.

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

License

This software is under the MIT open source license.

SPDX-License-Identifier: MIT

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.