GET _posts/2019-01-02-get-library.md Packages

While it’s recommended to use one of the clients to parse the output for you, you are free to interact with the endpoints without them.

API Base

The API base provides a summary of links to all endpoints.

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://penrose-lib.github.io/api.json

Library

The library includes a listing of all packages, including dsl, sty, and sub.


curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://penrose-lib.github.io/library.json

Packages

Alternately, you can filter to just a specific package type.

dsl


curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://penrose-lib.github.io/dsl.json

sub

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://penrose-lib.github.io/sub.json

sty

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET https://penrose-lib.github.io/sty.json

We will add additional endpoints (and filters) as needed.

Contribute

If you are looking to contribute to the Penrose Library, you’ve come to the right place!

1. What do you want to contribute?

The Penrose Library has style, dsl (domain specific language), and substance files. Each of these types is considered a package, and each package is maintained in modular Github repositories. You can look at examples provided in the Penrose Library Organization on Github.

  • DSL packages start with prefix “dsl”
  • Style packages start with prefix “sub”
  • Substance packages start with prefix “sub”

You can use these repositories as examples to design your own modular package repository. We will be providing cookie cutter templates to make this easier for you.

2. Add to the library

When you use one of the package templates, you should turn on Github pages so that the template renders the package metadata on Github pages. The repository here will use that metadata to test your package.

TODO: how do we test a contribution? Ask for examples?

See this issue.

What does it mean to add your package to the library?

Package Type

Under the _library folder, find your package type, one of dsl, sty, or sub.

Package Folder

In that folder create a folder that corresponds to your Github organization (if it doesn’t exist) and using any of the existing markdown files as a template, create a new markdown file in that folder that corresponds to the repository name that serves the package. For example, a “dsl” package served from https://github.com/penrose-lib/dsl-linear-algebra would have the following structure:

_library/
├── dsl
│   └── penrose-lib
│       └── linear-algebra.md

This structure ensures that the package files have an organized and consistent namespace. If another individual also creates a “linear-algebra” dsl package, it will belong to a different folder and the two can exist in harmony.

Package Metadata

The purpose of this markdown file is to serve the minimal metadata to point to your package, and help users to find it easily in the table. This primarily means that you need to provide the Github repository, and relevant tags. Here is an example:

layout: package
name:  "linear-algebra"
type: "dsl"
maintainer: "@vsoch"
github: "https://www.github.com/penrose-lib/dsl-linear-algebra"
endpoint: "https://penrose-lib.github.io/dsl-linear-algebra/api.json"
tags:
- dsl
  • name: should correspond to your repository name
  • type: is one of dsl, sub, or sty.
  • maintainer: refers to your Github username
  • layout: is a package, you don’t need to change this
  • github: is the full Github URL
  • endpoint: is the API metadata endpoint, which should be the Github pages api.json of the repository, given that you’ve used a template.
  • tags: can be any relevant tags to help the user with search. They will appear in the main table.

3. Open a Pull Request

Once you’ve created your metadata file, assuming you are working on your forked version of https://github.com/penrose-lib/penrose-lib.github.io, you can open a pull request to the master branch. The pull request will test your contribution, and on approval and merge, your package will be deployed as part of the API and Penrose Library.

About

Penrose

Penrose is a framework for making beautiful, interactive equations. For more information, see [penrose.github.io])(https://penrose.github.io)

The Penrose Library

The Penrose Library is a static API to serve Penrose Packages, including Github repositories for style, domain specific language (DSL), and substance files. Each contribution (a package) is maintained in its separate repository, and has been tested and validated by the maintainers. The API is static, and so we support only GET.

Support

If you have questions or want to make a contribution, please open an issue, and we’d be glad to help.