Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: workflows including MyST NB and precommit added #9

Merged
merged 22 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 22 additions & 34 deletions .github/workflows/deploy.yml
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
# This file was created automatically with `myst init --gh-pages` 🪄 💚

name: MyST GitHub Pages Deploy
on:
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [main]
push:
# Runs on pushes targeting the default branch
branches: [main]
env:
# `BASE_URL` determines the website is served from, including CSS & JS assets
# You may need to change this to `BASE_URL: ''`
BASE_URL: /${{ github.event.repository.name }}

# 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
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
- uses: actions/setup-node@v4
uses: actions/configure-pages@v5
with:
node-version: 18.x
- name: Install MyST Markdown
run: npm install -g mystmd
- name: Build HTML Assets
run: myst build --html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
enablement: "true"
- uses: prefix-dev/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not needed. Never used it for any other ComPWA project and those work just fine.

For sure it's not needed in the build step 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But seems like this is working fine too. I think I'll keep it for https://pages.github.com/

with:
path: "./_build/html"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
path: ./_build/html

deploy:
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building the pages with pixi run doc is still missing here. That's also what the with.path was originally for (not setup-pixi, that requires no arguments).

Copy link
Member

@redeboer redeboer May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok this is now added

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Done

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: >-
github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
needs: build
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- id: deployment
uses: actions/deploy-pages@v4
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# pixi environments
.pixi
*.egg-info
.ipynb_checkpoints/

.pixi
node_modules/
19 changes: 16 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
Expand All @@ -16,3 +16,16 @@ repos:
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/redeboer/taplo-pre-commit
rev: v0.9.1rc1
hooks:
- id: taplo

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
12 changes: 12 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[formatting]
align_comments = false
align_entries = false
allowed_blank_lines = 1
array_auto_collapse = false
array_auto_expand = true
array_trailing_comma = true
column_width = 88
compact_inline_tables = true
indent_string = " "
reorder_arrays = true
reorder_keys = true
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.ipynb_checkpoints
_build
11 changes: 11 additions & 0 deletions docs/conf.py
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exclude_patterns = [
"**.ipynb_checkpoints",
".DS_Store",
".pixi",
"Thumbs.db",
"_build",
]
extensions = ["myst_nb"]
master_doc = "index"
nitpicky = True
project = "GlueX N-Star"
24 changes: 12 additions & 12 deletions Hello.ipynb → docs/hello.ipynb
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"# Starting document"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "086f6c1d-4e2d-4a97-85fb-c61cd55634d7",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello World!\n"
]
}
],
"outputs": [],
"source": [
"print(\"Hello World!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f32a577e-5098-4070-b58b-274d4314cb07",
"id": "2",
"metadata": {},
"outputs": [],
"source": []
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# MyST-NB Quickstart

```{toctree}
hello
```
1,585 changes: 1,585 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

36 changes: 27 additions & 9 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
[project]
name = "gluex-nstar"
version = "0.1.0"
description = "Add a short description here"
authors = ["Vitor Shen <[email protected]>"]
channels = ["conda-forge"]
name = "gluex-nstar"
platforms = ["linux-64"]

[tasks]
docnb = """
sphinx-build \
-nW --keep-going \
-b html \
docs _build/html
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
"""
docnblive = """
sphinx-autobuild \
--watch docs \
-nW --keep-going \
-b html \
docs _build/html
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
"""

[dependencies]
jaxlib = ">=0.4.23,<0.5"
sympy = ">=1.12,<2"
python = ">=3.12.3,<3.13"
jupyterlab = ">=4.2.0,<4.3"
jax = ">=0.4.26,<0.5"
numpy = ">=1.26.4,<1.27"
black = ">=24.4.2,<24.5"
isort = ">=5.13.2,<5.14"
jax = ">=0.4.26,<0.5"
jaxlib = ">=0.4.23,<0.5"
jupyterlab = ">=4.2.0,<4.3"
jupyterlab-git = ">=0.50.0,<0.51"
jupyterlab-lsp = ">=5.1.0,<5.2"
jupyterlab-myst = ">=2.4.2,<2.5"
myst-nb = ">=1.1.0,<1.2"
shenvitor marked this conversation as resolved.
Show resolved Hide resolved
numpy = ">=1.26.4,<1.27"
pre-commit = ">=3.7.1,<3.8"
python = ">=3.12.3,<3.13"
python-graphviz = ">=0.20.3,<0.21"
scipy = ">=1.13.0,<1.14"
sphinx-autobuild = ">=2024.4.16,<2024.5"
sympy = ">=1.12,<2"
Loading