Git Product home page Git Product logo

cocalc-assistant's Introduction

CoCalc Assistant

A collection of code snippet examples to assist working on CoCalc โ†’ read more.

Development

The source files are in /src and are processed via the examples.py Python file.

Usually, just running make in the main directory is enough to see if the changes did work.

The output is a unified examples.json file, which can be used by other tools -- right now that's CoCalc.

Contributions

All examples are collected in .yaml files. The structure of a file is to specify

  1. meta-information of a sequence of example yaml docs. A file starts with them, and there can be additional meta-information documents (which replace the previous one):
  • language: likely python, sage, r, gap, โ€ฆ
  • category and sub-category, either as an array of strings or a string with / delimiter,
  • common setup code (optionally)
  • variables: a map to initialize variables
  • a sortweight to override lexicographic sorting. (e.g. to place "Introduction" categories at the top)
  1. After a category specification, the entries for the examples are made of
  • title, description and code,
  • Optionally, a field test, which could either be a doc-test (in case it is a string) or false. In the latter case, it signals any testing framework to skip this test.

Example:

---
language: sage
category: Mathematics / Introduction
sortweight: -1
---
title: Introduction
descr: |
    SageMath is an advanced Python-based environment for mathematics.
    With that foundation, it is also suited for scientific computing,
    statistics, and data analysis.

    Run `version()` to see which version of Sage you're currently working with.
code: |
    version()
---
title: Pitfalls
descr: |
    There is a blurry line between using SageMath and programming.
    Function calls are always `function_name(...)` with round brackets, too.
code: |
    # TODO: fix this expression
    var('x')
    sqrt [ (4 + x) (2 - x) ]
test: false

Development

Tests

to test the src/sage subdirectory:

make LANG=sage test

To speed things up and skip restarting the kernel (could give false positives, but syntax is always wrong)

make LANG=sage MODE=fast test

Testing testing

The target make testtest runs the test/ subdirectory. It's purpose is to confirm that breaking tests show up properly and the examples are read correctly.

Submodule

When used as a submodule, one suitable magic git commands to update all submodules is

git submodule foreach "git fetch origin; git checkout master; git reset --hard origin/master"

Acknowledgments

Copyright

SageMath, Inc.

License

Code: Apache 2.0

Data: Creative Commons: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (more detailed information is in the header of the files in /src)

cocalc-assistant's People

Contributors

drxyzzy avatar haraldschilly avatar jkdenny avatar tscholl2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.