diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 260df28..cc03e82 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -17,34 +17,24 @@ concurrency: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: submodules: recursive - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.7" + - name: Install uv + uses: astral-sh/setup-uv@v6 - name: Install dependencies run: | - pip install -r requirements.txt # tidy-html5 needs to be installed separately via system package manager sudo apt-get update && sudo apt-get install -y tidy - - name: Patch nbconvert to fix filename conflicts - run: | - # Find nbconvert's extractoutput.py and apply the fix - NBCONVERT_PATH=$(python -c "import nbconvert.preprocessors.extractoutput as e; print(e.__file__)") - sed -i 's/if filename in resources\['\''outputs'\''\]:/if filename in resources['\''outputs'\''] and False:/' "$NBCONVERT_PATH" - echo "Applied nbconvert patch to disable duplicate filename check" - - name: Build site run: | - python make.py publish + uv run --with-requirements ./requirements.txt --python 3.13 python make.py publish - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/.gitmodules b/.gitmodules index d46862e..592fa8b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "content/notebooks/working_with_colors_in_mpl"] path = content/notebooks/working_with_colors_in_mpl url = https://gist.github.com/5636372.git -[submodule "extras/pelican-plugins"] - path = extras/pelican-plugins - url = https://github.com/pelson/pelican-plugins.git [submodule "content/notebooks/massive_virtual_arrays_with_biggus"] path = content/notebooks/massive_virtual_arrays_with_biggus url = https://gist.github.com/6139282.git @@ -25,3 +22,6 @@ [submodule "content/field_notes/coast_path_pt1"] path = content/field_notes/coast_path_pt1 url = https://gist.github.com/21fbdc5a944f478bdd896faa95ab3cc7.git +[submodule "extras/liquid-tags"] + path = extras/liquid-tags + url = https://github.com/pelson/liquid-tags.git diff --git a/README.md b/README.md index 72ac2ae..0d96942 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,16 @@ OR Next, create an environment: - conda create -p ./build_env ... + uv venv ./venv + source ./venv/bin/activate + uv pip install -r requirements.txt ./extras/liquid-tags -Finally, for a local server that watches all changed files: +To run a local server that watches all changed files: python make.py reload +To update the requirements.txt: + + uv pip compile requirements.in | grep -v pelican-liquid-tags > requirements.txt + -Note on branches ----------------- -The source branch is the master/trunk for the actual source to generate the site, and the master branch is where -the rendered html lives (this is a result of the way github pages are done). diff --git a/extras/liquid-tags b/extras/liquid-tags new file mode 160000 index 0000000..6842f9e --- /dev/null +++ b/extras/liquid-tags @@ -0,0 +1 @@ +Subproject commit 6842f9ee8a83485c536cfafa5f27b2bf2b3ea82c diff --git a/extras/pelican-plugins b/extras/pelican-plugins deleted file mode 160000 index 1958d21..0000000 --- a/extras/pelican-plugins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1958d21ba0563edb00e7571fc28ecd987047ad76 diff --git a/extras/theme/templates/base.html b/extras/theme/templates/base.html index cab1338..5c0535b 100644 --- a/extras/theme/templates/base.html +++ b/extras/theme/templates/base.html @@ -32,6 +32,9 @@ + {% if EXTRA_HEADER %} + {{ EXTRA_HEADER }} + {% endif %} {% block header %} {% endblock %} diff --git a/make.py b/make.py index ddcdda0..546bcee 100755 --- a/make.py +++ b/make.py @@ -61,7 +61,6 @@ def publish(): old = os.path.join(root, fname) new = os.path.join(new_root, fname) if fname.endswith('.html'): - print('\nConverting {}:'.format(old)) cmd = ['tidy', '-config', 'tidy_config.txt', old] with open(new, 'w') as fh: try: diff --git a/pelicanconf.py b/pelicanconf.py index 37332de..dcde0ae 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -40,11 +40,9 @@ TAG_URL = 'tag/{slug}/' TAG_SAVE_AS = 'tag/{slug}/index.html' -PLUGIN_PATHS = ['extras/pelican-plugins'] +PLUGIN_PATHS = ['extras/liquid-tags/pelican/plugins'] PLUGINS = ['liquid_tags.img', 'liquid_tags.video', - 'liquid_tags.include_code', 'liquid_tags.notebook', 'summary', - 'feed_summary'] -FEED_USE_SUMMARY = True + 'liquid_tags.include_code', 'liquid_tags.notebook'] THEME = "extras/theme" DIRECT_TEMPLATES = ('index', 'archives', 'sitemap', 'announce', 'articles', 'field_notes', 'hints') @@ -67,3 +65,10 @@ #MARKDOWN = ['codehilite(noclasses=True, pygments_style=native)', 'extra'] # enable MD options IGNORE_FILES = ['README.md'] + +# Include notebook CSS header +try: + with open('_nb_header.html', 'r', encoding='utf-8') as f: + EXTRA_HEADER = f.read() +except FileNotFoundError: + EXTRA_HEADER = '' diff --git a/requirements.in b/requirements.in index e51d57b..906be07 100644 --- a/requirements.in +++ b/requirements.in @@ -1,8 +1,3 @@ -pelican==3.7 -markdown<3.0 -ipython==3.* -notebook -nbconvert==5.* -pygments -jinja2<3.0 -markupsafe<2.0 +pelican +markdown +./extras/liquid-tags/ diff --git a/requirements.txt b/requirements.txt index 0cd28aa..42379c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,57 +1,153 @@ -anyio==3.7.1 -argon2-cffi==23.1.0 -argon2-cffi-bindings==21.2.0 -attrs==24.2.0 -bleach==6.0.0 -blinker==1.6.3 -cffi==1.15.1 +# This file was autogenerated by uv via the following command: +# uv pip compile requirements.in +anyio==4.10.0 + # via watchfiles +asttokens==3.0.0 + # via stack-data +attrs==25.3.0 + # via + # jsonschema + # referencing +beautifulsoup4==4.13.4 + # via nbconvert +bleach==6.2.0 + # via nbconvert +blinker==1.9.0 + # via pelican +decorator==5.2.1 + # via ipython defusedxml==0.7.1 -docutils==0.20.1 -entrypoints==0.4 -exceptiongroup==1.3.0 + # via nbconvert +docutils==0.22 + # via pelican +executing==2.2.0 + # via stack-data fastjsonschema==2.21.1 -feedgenerator==2.1.0 + # via nbformat +feedgenerator==2.2.0 + # via pelican idna==3.10 -importlib-metadata==6.7.0 -importlib-resources==5.12.0 -ipykernel==4.0.1 -ipython==3.2.3 -ipython-genutils==0.2.0 -Jinja2==2.11.3 -jsonschema==4.17.3 -jupyter-server==1.15.6 -jupyter_client==7.4.9 -jupyter_core==4.12.0 -Markdown==2.6.11 -MarkupSafe==1.1.1 -mistune==0.8.4 -nbclassic==1.2.0 -nbconvert==5.6.1 -nbformat==5.8.0 -nest-asyncio==1.6.0 -notebook==6.5.7 -notebook_shim==0.2.4 -packaging==24.0 + # via anyio +ipython==9.4.0 +ipython-pygments-lexers==1.1.1 + # via ipython +jedi==0.19.2 + # via ipython +jinja2==3.1.6 + # via + # nbconvert + # pelican +jsonschema==4.25.0 + # via nbformat +jsonschema-specifications==2025.4.1 + # via jsonschema +jupyter-client==8.6.3 + # via nbclient +jupyter-core==5.8.1 + # via + # jupyter-client + # nbclient + # nbconvert + # nbformat +jupyterlab-pygments==0.3.0 + # via nbconvert +markdown==3.8.2 + # via -r requirements.in +markdown-it-py==3.0.0 + # via rich +markupsafe==3.0.2 + # via + # jinja2 + # nbconvert +matplotlib-inline==0.1.7 + # via ipython +mdurl==0.1.2 + # via markdown-it-py +mistune==3.1.3 + # via nbconvert +nbclient==0.10.2 + # via nbconvert +nbconvert==7.16.6 +nbformat==5.10.4 + # via + # nbclient + # nbconvert +ordered-set==4.1.0 + # via pelican +packaging==25.0 + # via nbconvert pandocfilters==1.5.1 -pelican==3.7.0 -pkgutil_resolve_name==1.3.10 -prometheus-client==0.17.1 + # via nbconvert +parso==0.8.4 + # via jedi +pelican==4.11.0 + # via + # -r requirements.in +./extras/liquid-tags/ + # via -r requirements.in +pexpect==4.9.0 + # via ipython +platformdirs==4.3.8 + # via jupyter-core +prompt-toolkit==3.0.51 + # via ipython ptyprocess==0.7.0 -pycparser==2.21 -Pygments==2.17.2 -pyrsistent==0.19.3 + # via pexpect +pure-eval==0.2.3 + # via stack-data +pygments==2.18.0 + # via + # ipython + # ipython-pygments-lexers + # nbconvert + # pelican + # rich python-dateutil==2.9.0.post0 -pytz==2025.2 -pyzmq==26.2.1 -Send2Trash==1.8.3 + # via + # jupyter-client + # pelican +pyzmq==27.0.1 + # via jupyter-client +referencing==0.36.2 + # via + # jsonschema + # jsonschema-specifications +rich==14.1.0 + # via pelican +rpds-py==0.26.0 + # via + # jsonschema + # referencing six==1.17.0 + # via python-dateutil sniffio==1.3.1 -terminado==0.17.1 -testpath==0.6.0 -tornado==6.2 -traitlets==5.9.0 -typing_extensions==4.7.1 -Unidecode==1.4.0 + # via anyio +soupsieve==2.7 + # via beautifulsoup4 +stack-data==0.6.3 + # via ipython +tinycss2==1.4.0 + # via bleach +tornado==6.5.1 + # via jupyter-client +traitlets==5.14.3 + # via + # ipython + # jupyter-client + # jupyter-core + # matplotlib-inline + # nbclient + # nbconvert + # nbformat +typing-extensions==4.14.1 + # via beautifulsoup4 +unidecode==1.4.0 + # via pelican +watchfiles==1.1.0 + # via pelican +wcwidth==0.2.13 + # via prompt-toolkit webencodings==0.5.1 -websocket-client==1.6.1 -zipp==3.15.0 + # via + # bleach + # tinycss2