Skip to content

Commit 9a74823

Browse files
committed
move to bookbase based building process
1 parent a826c51 commit 9a74823

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+21
-6612
lines changed

.github/workflows/build.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
name: publish
22

33
on:
4-
push:
4+
push:
55
branches:
66
- main
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/[email protected]
13+
with:
14+
submodules: true
1315
- uses: xu-cheng/texlive-action@d9f893f837a29f066e3c70080540976b47263721
1416
with:
1517
scheme: full

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "bookbase"]
2+
path = bookbase
3+
url = https://github.com/thomasWeise/bookbase

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This version may change since this course and book both are work in progress.
4444
You can freely share this.
4545
You can also copy text or figures under the license given below, as long as you cite the book as the original source, e.g., by using the following BibTeX:
4646

47-
<pre>@book{programmingWithPython,<br/>&nbsp;author&nbsp;=&nbsp;{<a href="http://iao.hfuu.edu.cn/5">Thomas&nbsp;Weise</a>},<br/>&nbsp;title&nbsp;=&nbsp;{Programming&nbsp;with&nbsp;Python},<br/>&nbsp;year&nbsp;=&nbsp;{2024},<br/>&nbsp;publisher&nbsp;=&nbsp;{<a href="http://iao.hfuu.edu.cn">Institute&nbsp;of&nbsp;Applied&nbsp;Optimization</a>,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.hfuu.edu.cn/aibd">School&nbsp;of&nbsp;Artificial&nbsp;Intelligence&nbsp;and&nbsp;Big&nbsp;Data</a>,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.hfuu.edu.cn/">Hefei&nbsp;University</a>},<br/>&nbsp;address&nbsp;=&nbsp;{Hefei,&nbsp;Anhui,&nbsp;China},<br/>&nbsp;url&nbsp;=&nbsp;{<a href="https://thomasweise.github.io/programmingWithPython">https://thomasweise.github.io/programmingWithPython</a>}<br/>}</pre>
47+
<pre>@book{programmingWithPython,<br/>&nbsp;author&nbsp;=&nbsp;{<a href="http://iao.hfuu.edu.cn/5">Thomas&nbsp;Weise</a>},<br/>&nbsp;title&nbsp;=&nbsp;{Programming&nbsp;with&nbsp;Python},<br/>&nbsp;year&nbsp;=&nbsp;{2024--2025},<br/>&nbsp;publisher&nbsp;=&nbsp;{<a href="http://iao.hfuu.edu.cn">Institute&nbsp;of&nbsp;Applied&nbsp;Optimization</a>,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.hfuu.edu.cn/aibd">School&nbsp;of&nbsp;Artificial&nbsp;Intelligence&nbsp;and&nbsp;Big&nbsp;Data</a>,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.hfuu.edu.cn/">Hefei&nbsp;University</a>},<br/>&nbsp;address&nbsp;=&nbsp;{Hefei,&nbsp;Anhui,&nbsp;China},<br/>&nbsp;url&nbsp;=&nbsp;{<a href="https://thomasweise.github.io/programmingWithPython">https://thomasweise.github.io/programmingWithPython</a>}<br/>}</pre>
4848

4949
**If you have any comments or suggestions regarding the book, or if you spotted an error or typo, please feel free to submit an [issue here](https://github.com/thomasWeise/programmingWithPython/issues).**
5050
Your feedback would help us to improve the book.

bibliography/bibliography.bib

-3,603
This file was deleted.

book.tex

+3-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
11
\pdfminorversion=7%
22
\documentclass[a4paper,oneside,10pt]{memoir}%
33
%
4-
\setsecnumdepth{subsubsection}% number down to sub-sub-sections
5-
%
6-
%% prepare and set the book margins
7-
\setlrmarginsandblock{3cm}{3cm}{*}%
8-
\setulmarginsandblock{2.5cm}{2.5cm}{*}%
9-
\setlength{\parskip}{3pt}%
10-
%
11-
%% Allow more space per page to be consumed by floats.
12-
%% This is helpful when we later have larger programs as examples.
13-
\renewcommand{\topfraction}{.85}%
14-
\renewcommand{\bottomfraction}{.85}%
15-
\renewcommand{\textfraction}{.15}%
16-
\renewcommand{\floatpagefraction}{.8}%
17-
\renewcommand{\dbltopfraction}{.8}%
18-
\renewcommand{\dblfloatpagefraction}{.8}%
19-
\setcounter{topnumber}{9}%
20-
\setcounter{bottomnumber}{9}%
21-
\setcounter{totalnumber}{20}%
22-
\setcounter{dbltopnumber}{9}%
23-
%
24-
\checkandfixthelayout%
25-
%
26-
\usepackage{styles/styles}% import our own basic styles
27-
\usepackage{notation/notation}% import the book-specific notation
28-
%
29-
\makeglossaries% make the glossary
4+
\xdef\bookbaseDir{./bookbase}%
5+
\usepackage{bookbase/styles/book}% import our own basic styles
6+
\xdef\courseUrlQR{text/front/preface/courseUrl}%
307
%
318
\title{Programming with Python}%
32-
\author{Thomas Weise}%
33-
\date{\today}%
349
%%
3510
\begin{document}%
3611
%

bookbase

Submodule bookbase added at cc0e9b4

draft.sh

+1-44
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,4 @@
22

33
# Make a draft of the book.
44

5-
# strict error handling
6-
set -o pipefail # trace ERR through pipes
7-
set -o errtrace # trace ERR through 'time command' and other functions
8-
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
9-
set -o errexit # set -e : exit the script if any statement returns a non-true return value
10-
11-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Welcome to the draft building script."
12-
13-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): First deleting the git cache."
14-
rm -rf __git__ || true
15-
16-
currentDir="$(pwd)"
17-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We are working in directory: '$currentDir'."
18-
scriptDir="$currentDir/scripts"
19-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The script directory is '$scriptDir'."
20-
21-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We delete all left over data."
22-
rm "book.pdf" || true
23-
rm -rf "$currentDir/website" || true
24-
25-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We setup a virtual environment in a temp directory."
26-
venvDir="$(mktemp -d)"
27-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Got temp dir '$venvDir', now creating environment in it."
28-
python3 -m venv --upgrade-deps --copies "$venvDir"
29-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Activating virtual environment in '$venvDir'."
30-
source "$venvDir/bin/activate"
31-
export PYTHON_INTERPRETER="$venvDir/bin/python3"
32-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Setting python interpreter to '$PYTHON_INTERPRETER'."
33-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We install all required Python packages from requirements.txt to virtual environment in '$venvDir'."
34-
"$PYTHON_INTERPRETER" -m pip install --no-input --timeout 360 --retries 100 -r requirements.txt
35-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished installing the requirements, now printing all installed packages."
36-
pip freeze
37-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished printing all installed packages."
38-
39-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the pdflatex compiler script."
40-
"$scriptDir/pdflatex.sh" "book.tex" quick
41-
42-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deactivating virtual environment."
43-
deactivate
44-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deleting virtual environment."
45-
rm -rf "$venvDir"
46-
47-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We have finished the book building process."
48-
evince book.pdf
5+
./bookbase/scripts/bookDraft.sh

make.sh

+1-44
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,4 @@ set -o errtrace # trace ERR through 'time command' and other functions
88
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
99
set -o errexit # set -e : exit the script if any statement returns a non-true return value
1010

11-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Welcome to the book building script."
12-
13-
argument="${1:-}" # get command line argument, if any
14-
15-
currentDir="$(pwd)"
16-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We are working in directory: '$currentDir'."
17-
scriptDir="$currentDir/scripts"
18-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The script directory is '$scriptDir'."
19-
20-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We delete all left over data."
21-
rm "book.pdf" || true
22-
rm -rf "$currentDir/website" || true
23-
24-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We setup a virtual environment in a temp directory."
25-
venvDir="$(mktemp -d)"
26-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Got temp dir '$venvDir', now creating environment in it."
27-
python3 -m venv --upgrade-deps --copies "$venvDir"
28-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Activating virtual environment in '$venvDir'."
29-
source "$venvDir/bin/activate"
30-
export PYTHON_INTERPRETER="$venvDir/bin/python3"
31-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Setting python interpreter to '$PYTHON_INTERPRETER'."
32-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We install all required Python packages from requirements.txt to virtual environment in '$venvDir'."
33-
"$PYTHON_INTERPRETER" -m pip install --no-input --timeout 360 --retries 100 -r requirements.txt
34-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished installing the requirements, now printing all installed packages."
35-
pip freeze
36-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished printing all installed packages."
37-
38-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the pdflatex compiler script."
39-
"$scriptDir/pdflatex.sh" "book.tex"
40-
41-
if [ "$argument" == "--no-website" ]; then
42-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Website generation has been disabled."
43-
else
44-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the website building script."
45-
"$scriptDir/website.sh"
46-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Website has been generated."
47-
fi
48-
49-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deactivating virtual environment."
50-
deactivate
51-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deleting virtual environment."
52-
rm -rf "$venvDir"
53-
54-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We have finished the book building process."
11+
./bookbase/scripts/bookMake.sh "programmingWithPython" "Programming with Python" "https://thomasweise.github.io/programmingWithPython"

notation/acronyms.sty

-22
This file was deleted.

notation/math.sty

-72
This file was deleted.

notation/notation.sty

-7
This file was deleted.

0 commit comments

Comments
 (0)