Skip to main content

No project description provided

Project description

Stencila Schema for Python

Build Status Code coverage Code style PyPI Docs

This package provides Python bindings for the Stencila Schema. It is primarily aimed at Python developers wanting to programmatically generate, or modify, executable documents. For example, it is used in pyla, an interpreter for executable documents containing Python code.

Install

pip3 install stencila-schema

Use

This packages exports a constructor function for each type of document node in the Stencila Schema e.g. Article, Paragraph, CodeChunk. To support conversion of schema nodes to/from JSON json.py defines encode and decode functions. e.g.

from stencila.schema.types import Heading
from stencila.schema.json import encode, decode

heading = Heading(["Heading Text"], 2)

json = encode(heading)
#{\n  "type": "Heading",\n  "content": [\n    "Heading Text"\n  ],\n  "depth": 2\n}

decode(json)
# <stencila.schema.types.Heading object at 0x7fda7bbdd780>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stencila-schema-0.37.3.tar.gz (13.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page