Skip to content

Commit

Permalink
Create documentation website and add Python documentation (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstairs authored Aug 31, 2023
1 parent 387eb4d commit b9465f5
Show file tree
Hide file tree
Showing 28 changed files with 4,446 additions and 1,520 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,51 @@ jobs:
exit 1
fi
publishDocs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'microsoft/yardl'
needs:
- validate
- smoketestWindows
- smoketestMac
- noticeCheck

runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build static page
run: |
cd docs
npm install
npm run docs:build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'docs/.vitepress/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

release:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs:
Expand Down
65 changes: 60 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,63 @@
Yardl is a simple schema language and command-line tool that generates domain
types and serialization code.

![A DSL on the left is translated to C++ code on the
right](docs/images/overview.png)
<details>
<summary>Simple example</summary>
Given a Yardl definition like this:

```yaml
# This is an example protocol, which is defined as a Header value
# followed by a stream of zero or more Sample values
MyProtocol: !protocol
sequence:
header: Header
samples: !stream
items: Sample

# Header is a record with a single string field
Header: !record
fields:
subject: string

# Sample is a record made up of a datetime and
# a vector of integers
Sample: !record
fields:
timestamp: datetime
data: int*
```
After running `yardl generate`, you can write code like the following to write
data to standard out in a compact binary format:

```python
import sys
from sandbox import BinaryMyProtocolWriter, Header, Sample, DateTime
def generate_samples():
yield Sample(timestamp=DateTime.now(), data=[1, 2, 3])
yield Sample(timestamp=DateTime.now(), data=[4, 5, 6])
with BinaryMyProtocolWriter(sys.stdout.buffer) as w:
w.write_header(Header(subject="Me"))
w.write_samples(generate_samples())
```

And then another script can read it in from standard in:

```python
import sys
from sandbox import BinaryMyProtocolReader
with BinaryMyProtocolReader(sys.stdin.buffer) as r:
print(r.read_header())
for sample in r.read_samples():
print(sample)
```

</details>

## Motivation

It is conceptually similar to, and inspired by, [Avro](https://avro.apache.org/),
[Protocol Buffers](https://developers.google.com/protocol-buffers),
Expand Down Expand Up @@ -33,18 +88,18 @@ code by hand:

## Getting Started

Please check out the project [documentation](docs/docs.md).
Please check out the project [documentation](https://aka.ms/yardl).

## Project Status

We are releasing this project order to get community feedback and contributions.
It is not complete and is **not ready for production use** at this time. We
expect to introduce breaking changes until the project reaches V1.

We currently support C++ codegen and work will begin on Python soon. Other
planned features include:
We currently support C++ and Python codegen. Other planned features include:

- Reading data with a different schema version
- MATLAB support
- References between packages
- Validating schema evolution is non-breaking
- Constraints
Expand Down
134 changes: 134 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Vitepress
.vitepress/cache/
.vitepress/dist/
Loading

0 comments on commit b9465f5

Please sign in to comment.