Skip to content

Commit b8ae48b

Browse files
Merge pull request #39 from ClojureCivitas/external-requirements-skip
updated to new clay feature
2 parents 9332d82 + b2b7172 commit b8ae48b

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

clay.edn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@
1717
:hide-info-line false
1818
:quarto []
1919
:flatten-targets false
20-
:keep-sync-root false}
21-
:ci
22-
{:keep-existing true}}
20+
:keep-sync-root false}}

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
clj-thamil/clj-thamil {:mvn/version "0.2.0"}
1414
org.scicloj/clay {#_#_:mvn/version "2-beta46"
1515
:git/url "https://github.com/scicloj/clay.git"
16-
:git/sha "d5b6661050470fc6587ccd7c2af0449e81977504"}
16+
:git/sha "58010a02e85fa897886f0277b806d4956926ab13"}
1717
org.eclipse.elk/org.eclipse.elk.core {:mvn/version "0.10.0"}
1818
org.eclipse.elk/org.eclipse.elk.graph {:mvn/version "0.10.0"}
1919
org.eclipse.elk/org.eclipse.elk.graph.json {:mvn/version "0.10.0"}

src/scicloj/clay/skip_if_unchanged_example.clj

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
^{:kindly/hide-code true
2-
:clay
3-
{:title "Some Civitas notebooks should only be run locally"
4-
:quarto {:author :daslu
5-
:description "A demonstration of our practice with some Civitas notebooks that cannot be run in GitHub Pages."
6-
:image "skip-if-unchanged.jpg"
7-
:type :post
8-
:date "2025-07-25"
9-
:category :clay
10-
:tags [:clay :workflow]
11-
:draft true}}}
1+
^{:clay {:title "Some Clay notebooks should only be run locally"
2+
:external-requirements ["my-secret.txt"]
3+
:quarto {:author :daslu
4+
:description "How to create notebooks with secrets, large files, and slow processes."
5+
:image "skip-if-unchanged.jpg"
6+
:type :post
7+
:date "2025-07-25"
8+
:category :clay
9+
:tags [:clay :workflow]
10+
:draft true}}}
1211
(ns scicloj.clay.skip-if-unchanged-example)
1312

14-
;; (Work-In-Progress Draft)
15-
1613
;; Usually, when we wish to create Clojure Civitas posts, we enjoy the fact
1714
;; that Civitas runs our notebooks in the GitHub Actions as it renders the website.
1815

@@ -23,10 +20,10 @@
2320
;; This notebook, for example, assumes that you have a local secrets file,
2421
;; and it will not work without it!
2522

26-
(slurp "/home/daslu/my-secret.txt")
23+
(slurp "temp/my-secret.txt")
2724

2825
;; If you are the author of such a notebook, the recommended practice is to
29-
;; render the notebook locally usinc Clay in Quarto `.qmd` format, and include
26+
;; render the notebook locally using Clay in Quarto `.qmd` format, and include
3027
;; that file in your Pull Request.
3128

3229
;; The `.qmd` file is all that Civitas needs to include your notebook in the
@@ -50,9 +47,25 @@
5047
(clay/make! {:source-path "scicloj/clay/skip_if_unchanged_example.clj"
5148
:aliases [:markdown]}))
5249

50+
;; Now, need to `git add` the generated `qmd` file.
5351

52+
;; ```sh
53+
;; git add -f site/scicloj/clay/skip_if_unchanged_example.clj
54+
;; ```
5455

55-
;; Now, need to `git add` the generated `qmd` file.
56-
;; Here is how.
56+
;; Also we need to add some metadata to this namespace.
57+
;; Notice in the above namespace form there is:
58+
59+
;; ```
60+
;; ^{:clay {:external-requirements ["my-secret.txt"] ...}...}
61+
;; ```
62+
63+
;; That tells Clay that it should use the `.qmd` file instead of executing the notebook.
64+
;; When we commit and push, the site will be built from our `.qmd` file instead of `.clj` file.
65+
66+
;; This approach works for credentials, large files,
67+
;; and slow processes which would otherwise cause the build process to be slow or fail.
5768

58-
;; (WIP)
69+
;; We hope this enables interesting use cases where providing reproducible code is important,
70+
;; while capturing just one specific execution of the code is valuable...
71+
;; such as an interactive session calling an LLM API which is saved as a static document.

0 commit comments

Comments
 (0)