Skip to content

Commit

Permalink
Merge pull request #4 from premAI-io/main
Browse files Browse the repository at this point in the history
merge from premai-main
  • Loading branch information
Anindyadeep authored Oct 21, 2023
2 parents 07a3341 + bf5cdc5 commit 474af99
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
name: site
on:
push:
workflow_dispatch:
push: {branches: [main], tags-ignore: ['**']}
pull_request:
schedule: [{cron: '0 10 * * 6'}] # M H d m w (Sat 10:00)
permissions:
# allow GITHUB_TOKEN to deploy to GitHub Pages
contents: read
Expand Down Expand Up @@ -53,6 +54,7 @@ jobs:
- run: pip install -r requirements.txt
- name: jupyter-book build
run: |
sudo apt update -qq
sudo apt install -qq ghostscript fonts-freefont-otf # https://stackoverflow.com/a/69012150
sed -ri 's#^(\s*baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}/'$SITE_PREFIX'#g' _config.yml
jupyter-book build --builder dirhtml --warningiserror --nitpick --keep-going .
Expand Down
1 change: 0 additions & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"contributors": [
{"name": "others", "type": "Other"}],
"keywords": ["open-source", "AI", "book", "ML", "MLOps", "Jupyter-Book"],
"license": "CC-BY-4.0 AND Apache-2.0",
"imprint_publisher": "Prem",
"access_right": "open",
"upload_type": "publication",
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ authors:
- {given-names: Het, family-names: Trivedi}
- {given-names: Filippo, family-names: Pedrazzini, affiliation: Prem}
- {name: others, website: 'https://github.com/premAI-io/state-of-open-source-ai/graphs/contributors'}
#identifiers: [{type: doi, value: 10.1234/zenodo.TODO}]
identifiers: [{type: doi, value: 10.5281/zenodo.10023181}]
repository-code: https://github.com/premAI-io/state-of-open-source-ai
keywords: [open-source, AI, book, ML, MLOps, Jupyter-Book]
license-url: https://github.com/premAI-io/state-of-open-source-ai/blob/main/LICENCE # CC-BY-4.0 AND Apache-2.0
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ html:
parse:
myst_substitutions:
baseurl: http://localhost:8000
doi: 10.5281/zenodo.10023181
wip_chapter: |
This chapter is still being written & reviewed. Please do post links & discussion in the {{
'[<i class="fas fa-pencil-alt"></i> comments]({}-comments)'.format(env.docname) }} below, or {{
Expand Down
26 changes: 17 additions & 9 deletions badges.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
MyST usage (HTML only):
```{badges}
```{badges} https://mybook.site https://github.com/org/mybook
:doi: 10.5281.zenodo.12345678
```
"""
from docutils import nodes
Expand All @@ -22,33 +23,40 @@ class badges_node(nodes.General, nodes.Element):

def visit_badges_html(self, node):
self.body.append(
f"""<a href="{node['baseurl']}">
f"""<a href="{node['baseurl']}" target="_blank">
<img alt="site"
src="https://img.shields.io/badge/site-{node['baseurl'].replace('-', '--')}-orange" />
</a>""")
slug = '/'.join(node['repository_url'].split('/')[-2:])
self.body.append(
f"""<a href="{node['repository_url']}/graphs/contributors">
f"""<a href="{node['repository_url']}/graphs/contributors" target="_blank">
<img alt="last updated"
src="https://img.shields.io/github/last-commit/{slug}/main" />
src="https://img.shields.io/github/last-commit/{slug}/main?label=updated" />
</a>""")
self.body.append(
f"""<a href="{node['repository_url']}/pulse">
f"""<a href="{node['repository_url']}/pulse" target="_blank">
<img alt="activity"
src="https://img.shields.io/github/commit-activity/m/{slug}/main" />
src="https://img.shields.io/github/commit-activity/m/{slug}/main?label=commits" />
</a>""")
if node['doi']:
self.body.append(
f"""<a href="https://doi.org/{node['doi']}" target="_blank">
<img alt="doi"
src="https://img.shields.io/badge/doi-{node['doi']}-black" />
</a>""")


class Badges(Directive):
has_content = True
required_arguments = 2
optional_arguments = 0
optional_arguments = 1
final_argument_whitespace = True
option_spec = {'class': directives.class_option, 'name': directives.unchanged}
option_spec = {'doi': directives.unchanged}
_node = None

def run(self):
return [badges_node(baseurl=self.arguments[0], repository_url=self.arguments[1])]
return [badges_node(
baseurl=self.arguments[0], repository_url=self.arguments[1], doi=self.options.get('doi', None))]


def setup(app: Sphinx):
Expand Down
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# State of Open Source AI Book - 2023 Edition

{{ '```{badges} %s %s\n```' % (baseurl, env.config.html_theme_options.repository_url) }}
{{ '```{badges} %s %s\n:doi: %s\n```' % (baseurl, env.config.html_theme_options.repository_url, doi) }}

*Clarity in the current fast-paced mess of Open Source innovation {cite}`prem_stateofosai`*

Expand Down
1 change: 1 addition & 0 deletions references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ @book{prem_stateofosai
edition={First},
editor={{da Costa-Luis}, Casper},
year=2023,
doi={10.5281/zenodo.10023181},
url={https://book.premai.io/state-of-open-source-ai}
}
@manual{python,
Expand Down

0 comments on commit 474af99

Please sign in to comment.