Skip to content

Commit c34078f

Browse files
authored
Merge pull request #86 from premAI-io/release-updates
build: use local_extensions
2 parents 6c73671 + a2084e5 commit c34078f

File tree

7 files changed

+42
-9
lines changed

7 files changed

+42
-9
lines changed

.github/workflows/pages.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
- name: linkcheck
4242
# https://jupyterbook.org/en/stable/reference/cli.html
4343
run: jupyter-book build --builder linkcheck --warningiserror --nitpick --keep-going .
44-
env: {PYTHONPATH: .}
4544
build:
4645
runs-on: ubuntu-latest
4746
steps:
@@ -74,7 +73,6 @@ jobs:
7473
book.tex
7574
# insert PDF cover
7675
curl -fsSLO https://static.premai.io/book/cover.pdf
77-
env: {PYTHONPATH: .}
7876
- uses: xu-cheng/latex-action@v3
7977
with:
8078
working_directory: _build/latex

_config.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ sphinx:
9494
extra_extensions:
9595
- sphinx_last_updated_by_git
9696
- sphinx_subfigure
97-
# custom (local *.py files)
98-
- badges
99-
- committers
100-
- bibliography
97+
local_extensions:
98+
badges: .
99+
committers: .
100+
bibliography: .
101+
prem_theme: .
101102
config:
103+
html_theme: prem_theme
102104
myst_heading_anchors: 4
103105
html_js_files:
104106
- [https://analytics.prem.ninja/js/script.js, {defer: defer, data-domain: book.premai.io}]

_static/download_pdf.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
document.addEventListener('DOMContentLoaded', function(){
2+
/// download whole book PDF
3+
document.querySelectorAll('.btn-download-pdf-button').forEach(a => {
4+
a.onclick = () => window.open("/state-of-open-source-ai.pdf");
5+
});
6+
});

index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ Spot something outdated or missing? Want to start a discussion? We welcome any o
6868
- Or instead, manually set up your own Python environment:
6969

7070
```sh
71-
pip install -r requirements.txt # setup
72-
PYTHONPATH=. jupyter-book build --builder dirhtml --all . # build
73-
python -m http.server -d _build/dirhtml # serve
71+
pip install -r requirements.txt # setup
72+
jupyter-book build --builder dirhtml --all . # build
73+
python -m http.server -d _build/dirhtml # serve
7474
```
7575

7676
````{admonition} alternative: live rebuilding & serving (experimental)

prem_theme/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from os import path
2+
3+
def setup(app):
4+
app.add_html_theme('prem_theme', path.abspath(path.dirname(__file__)))

prem_theme/layout.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{% extends "sphinx_book_theme/layout.html" %}
2+
{% block extrahead %}
3+
<meta property="og:site_name" content="The State of Open Source AI" />
4+
<meta property="og:title" content="{{ title }}" />
5+
<meta property="og:type" content="book" />
6+
<meta property="og:image" content="https://static.premai.io/book/book-cover.jpg" />
7+
<meta property="og:url" content="https://book.premai.io/state-of-open-source-ai/{{ '' if pagename == 'index' else pagename }}" />
8+
<meta property="og:description" content="Clarity in the current fast-paced mess of Open Source innovation" />
9+
<meta property="og:locale" content="en_GB" />
10+
<meta property="og:book:author" content="Prem" />
11+
{%- if last_updated %}
12+
<meta property="og:book:release_date" content="{{ last_updated }}" />
13+
{%- endif %}
14+
<meta property="og:book:tag" content="open-source" />
15+
<meta property="og:book:tag" content="AI" />
16+
<meta property="og:book:tag" content="book" />
17+
<meta property="og:book:tag" content="ML" />
18+
<meta property="og:book:tag" content="MLOps" />
19+
<meta property="og:book:tag" content="Jupyter-Book" />
20+
{{ super() }}
21+
{% endblock extrahead %}

prem_theme/theme.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[theme]
2+
inherit = sphinx_book_theme

0 commit comments

Comments
 (0)