Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ all_algorithm_blocks.jl
all_juliaconsole_blocks.jl
all_test_blocks.jl
pythontex-files*
pythontex-files-book
pythontex-files-book
.venv/
46 changes: 46 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Pin Julia 1.10 — Weave.jl (used by pythontex's juliaconsole) is
# incompatible with Julia 1.12+.
julia := "julia +1.10"

# Install all dependencies (Julia packages, Python venv, lexer/style)
setup:
git submodule update --init
{{julia}} --project -e 'using Pkg; Pkg.instantiate()'
test -d .venv || uv venv --python 3.13
uv pip install --python .venv/bin/python ./style ./lexer

# Compile the full book
# lualatex returns non-zero due to tufte-latex + TeX Live 2025+ warnings;
# the PDF is still produced correctly.
compile: pull-code _ensure-venv
-lualatex -interaction=nonstopmode book
.venv/bin/python "$(which pythontex)" --interpreter "julia:julia +1.10" book
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The $(which pythontex) invocation will silently produce an empty string if pythontex is not found on the system PATH (e.g., under a non-standard TeX Live installation). In that case, the command reduces to .venv/bin/python "", which fails with a confusing error like can't open file ''. Consider using command -v pythontex with an explicit error check, or documenting that pythontex must be accessible via PATH after TeX Live installation. The same issue exists on line 25.

Copilot uses AI. Check for mistakes.
biber book
-lualatex -interaction=nonstopmode book

# Compile a single chapter, e.g.: just chapter introduction
# Pass the name without the chapter/ prefix or .tex extension.
chapter name: pull-code _ensure-venv
-lualatex -interaction=nonstopmode "\includeonly{chapter/{{name}}}\input{book}"
.venv/bin/python "$(which pythontex)" --interpreter "julia:julia +1.10" book
biber book
-lualatex -interaction=nonstopmode "\includeonly{chapter/{{name}}}\input{book}"

# Extract Julia code from tex files
pull-code:
{{julia}} --project pull_julia_code.jl

# Run tests on all juliatest blocks
test: pull-code
{{julia}} --project runtests.jl

# Ensure the venv exists (called as a dependency)
_ensure-venv:
test -d .venv || uv venv --python 3.13

# Remove generated files (keeps book.pdf)
clean:
rm -f book.aux book.bbl book.bcf book.blg book.idx book.ilg book.ind
rm -f book.log book.out book.pytxcode book.run.xml book.toc book.xwm
rm -f all_juliaconsole_blocks.jl all_algorithm_blocks.jl all_test_blocks.jl
rm -rf pythontex-files-book _minted-book
Loading