Skip to content

Commit 6fe9de7

Browse files
committed
Revise for 4.0.0 release
docker/Dockerfile we now use llvm12 more recent asymptote and gv are copied into /usr/local/bin for now we'll copy in the mathics.pdf dmathicsscript: we pass through more environment variables ... for setting outside write directory $APP_DATADIR and $PWD entrypoint.sh will copy System django DB path to MATHICS_DJANGO_DB_PATH if the latter is empty.
1 parent 7e74d09 commit 6fe9de7

File tree

10 files changed

+69
-36
lines changed

10 files changed

+69
-36
lines changed

docker/Dockerfile

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ RUN apt-get install -qq apt-utils
1919
# Leave out inkscape for now.
2020

2121
# inxi and mesa-utils might be optional
22-
# npm puls in nodejs, but we'll be explicit.
23-
# llvm-11 and llvm-11-dev might work?
22+
# npm pulls in nodejs, but we'll be explicit.
2423

2524
# Install lots of packages
26-
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-10 llvm-10-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
25+
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-12 llvm-12-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
2726

2827
RUN pip install --no-cache-dir -r requirements.txt
2928
COPY requirements-mathicsscript.txt ./
@@ -32,20 +31,37 @@ RUN pip install --no-cache-dir -r requirements-mathicsscript.txt
3231
################
3332
# Mathics core #
3433
################
35-
RUN pip install "Mathics3[full]>=3.1.0"
34+
RUN pip install "Mathics3[full]>=4.0.0"
35+
36+
# We need newer versions of Asymptote and GhostScript for bulding the PDF
37+
COPY ubuntu-bin/gs /usr/local/bin/
38+
39+
# We would need to copy over a *full asy distribution*
40+
# COPY ubuntu-bin/asy /usr/local/bin/
41+
42+
# For now, until we package TeX sources skip building PDF and just copy it
43+
# to the place entrypoint.sh expects it.
44+
COPY tex-images/mathics.pdf /usr/src/app/data/mathics.pdf
3645

3746
#####################
3847
# Mathics Pymathics #
3948
#####################
4049

41-
RUN pip install pymathics-natlang
4250
RUN pip install pymathics-graph
4351

52+
# natlang installs spacy so this should come first
53+
RUN pip install pymathics-natlang
54+
RUN ${PYTHON} -m spacy download en
55+
RUN ${PYTHON} -m nltk.downloader wordnet omw
56+
4457
##################
4558
# Mathicsscript #
4659
##################
4760

48-
RUN ${PYTHON} -m pip install -e mathicsscript[full]
61+
# prompt toolkit needs an IPython that is newer than what got
62+
# implicitly installed above
63+
RUN ${PYTHON} -m pip install 'ipython<8.0,>=7.23.1'
64+
RUN ${PYTHON} -m pip install mathicsscript[full]
4965

5066
RUN ${PYTHON} -m nltk.downloader wordnet omw
5167
RUN ${PYTHON} -m spacy download en

docker/Dockerfile-dev

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ RUN apt-get install -qq apt-utils
1919
# Leave out inkscape for now.
2020

2121
# inxi and mesa-utils might be optional
22-
# npm puls in nodejs, but we'll be explicit.
23-
# llvm-11 and llvm-11-dev might work?
22+
# npm pulls in nodejs, but we'll be explicit.
2423

2524
# Install lots of packages
26-
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-10 llvm-10-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
25+
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-12 llvm-12-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
2726

2827
RUN pip install --no-cache-dir -r requirements.txt
2928
COPY requirements-mathicsscript.txt ./
@@ -32,7 +31,7 @@ RUN pip install --no-cache-dir -r requirements-mathicsscript.txt
3231
################
3332
# Mathics core #
3433
################
35-
# RUN pip install "Mathics3[full]>=3.1.0"
34+
# RUN pip install "Mathics3[full]>=4.0.0"
3635
RUN pip install git+git://github.com/mathics/Mathics.git#egg=Mathics3[full]
3736

3837
RUN git clone https://github.com/mathics/Mathics.git

docker/Dockerfile-dev+debug

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ RUN apt-get install -qq apt-utils
1919
# Leave out inkscape for now.
2020

2121
# inxi and mesa-utils might be optional
22-
# npm puls in nodejs, but we'll be explicit.
23-
# llvm-11 and llvm-11-dev might work?
22+
# npm pulls in nodejs, but we'll be explicit.
2423

2524
# Install lots of packages
26-
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-10 llvm-10-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
25+
RUN DEBIAN_FRONTEND="noninteractive" TZ="US/Eastern" apt-get install -qq liblapack-dev llvm-12 llvm-12-dev gfortran maria libmysqlclient-dev sqlite3 python3-pip python3-setuptools git python3-numpy python3-matplotlib python-matplotlib-data x11-apps asymptote w3m latexmk texlive-xetex lmodern texlive-latex-extra texlive-fonts-recommended nodejs npm xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri mesa-utils evince
2726

2827
RUN pip install --no-cache-dir -r requirements.txt
2928
COPY requirements-mathicsscript.txt ./
@@ -32,7 +31,7 @@ RUN pip install --no-cache-dir -r requirements-mathicsscript.txt
3231
################
3332
# Mathics core #
3433
################
35-
# RUN pip install "Mathics3[full]>=3.1.0"
34+
# RUN pip install "Mathics3[full]>=4.0.0"
3635
RUN pip install git+git://github.com/mathics/Mathics.git#egg=Mathics3[full]
3736

3837
RUN git clone https://github.com/mathics/Mathics.git

docker/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
DJANGO_DOC_HTML_DATA_PATH="/usr/local/lib/python3.8/dist-packages/mathics_django/doc/doc_html_data.pcl"
4+
MATHICS_DJANGO_SYSTEM_DB_PATH="/usr/src/app/.local/var/mathics/mathics.sqlite"
5+
36
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/.local/bin
47

58
script_cmd="${ENTRYPOINT_COMMAND:-$(basename $0)}"
@@ -69,6 +72,10 @@ case $mathics_mode in
6972
echo "~~~~ app/data has been mounted to $MATHICS_HOME/data ~~~~"
7073
if [[ -n $MATHICS_DJANGO_DB_PATH ]]; then
7174
echo "~~~~ SQLite data (worksheets, user info) will be stored in $MATHICS_DJANGO_DB_PATH ~~~~"
75+
if [[ ! -s $MATHICS_DJANGO_DB_PATH ]] && [[ -n $MATHICS_DJANGO_SYSTEM_DB_PATH ]]; then
76+
echo "~~~~ Copying internal SQLite data (worksheets, user info) to location specified in \$MATHICS_DJANGO_DB_PATH"
77+
cp -vp $MATHICS_DJANGO_SYSTEM_DB_PATH $MATHICS_DJANGO_DB_PATH
78+
fi
7279
else
7380
echo "~~~~ SQLite data (worksheets, user info) will be stored in $MATHICS_HOME/data/mathics.sqlite"
7481
fi

docker/tex-images/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/mathics.pdf

docker/ubuntu-bin/asy

38.9 MB
Binary file not shown.

docker/ubuntu-bin/gs

26.3 MB
Binary file not shown.

mathics_omnibus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# well as importing into Python. That's why there is no
66
# space around "=" below.
77
# fmt: off
8-
__version__="3.1.1.dev0" # noqa
8+
__version__="4.0.0.dev0" # noqa

script/dmathicsscript

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ if [ -n "$DEBUG" ]; then
55
fi
66

77
# Allow customization using POSIX environment variables:
8+
APP_DATADIR=${APP_DATADIR:-/tmp}
89
DOCKER=${DOCKER:-docker}
910
TAG=${TAG:-latest}
1011

12+
# TODO: allow setting:
13+
# XDG_CONFIG_HOME \
14+
# CONFIG_HOME \
15+
# CONFIGDIR \
16+
# MATHICSSCRIPT_HISTSIZE \
17+
# MATHICSSCRIPT_HISTFILE \
18+
1119
MATHICS_IMAGE=${MATHICS_IMAGE:-mathicsorg/mathics:${TAG}}
1220

1321
for arg in $@ ; do
1422
case "$arg" in
15-
-u | --upgrade | upgrade)
23+
-u | -U | --upgrade | upgrade)
1624
$DOCKER pull $MATHICS_IMAGE
1725
exit $?
1826
;;
@@ -33,7 +41,6 @@ else
3341
style="--style colorful"
3442
fi
3543

36-
3744
XAUTH=${XAUTH:-$HOME/.Xauthority}
3845
touch $XAUTH
3946

@@ -49,7 +56,8 @@ $DOCKER run \
4956
--tty \
5057
--interactive \
5158
--network=host \
52-
--volume "/tmp:/usr/src/app/data" \
59+
--volume="$PWD":/app \
60+
--volume "${APP_DATADIR}:/usr/src/app/data" \
5361
$DEVICE \
54-
$MATHICS_IMAGE \
62+
$MATHICS_IMAGE \
5563
--mode cli -- $style $@

script/dmathicsserver

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,34 @@ if [ -n "$DEBUG" ]; then
44
set -x
55
fi
66

7+
# Allow customization using POSIX environment variables:
8+
APP_DATADIR=${APP_DATADIR:-/tmp}
9+
DOCKER=${DOCKER:-docker}
10+
MATHICS_DJANGO_DB=${MATHICS_DJANGO_DB:-"mathics.sqlite"}
11+
MATHICS_DJANGO_DB_PATH=${MATHICS_DJANGO_DB_PATH:-/usr/src/app/.local/var/mathics/${MATHICS_DJANGO_DB}}
712
TAG=${TAG:-latest}
13+
814
MATHICS_IMAGE=${MATHICS_IMAGE:-mathicsorg/mathics:${TAG}}
915

1016
for arg in "$@" ; do
1117
case "$arg" in
12-
-u | | -U | --upgrade | upgrade)
18+
-u | -U | --upgrade | upgrade)
1319
$DOCKER pull $MATHICS_IMAGE
1420
exit $?
1521
;;
1622
esac
1723
done
1824

19-
# Allow customization using POSIX environment variables:
20-
DOCKER=${DOCKER:-docker}
21-
MATHICS_DJANGO_DB=${MATHICS_DJANGO_DB:-"mathics.sqlite"}
22-
MATHICS_DJANGO_DB_PATH=${MATHICS_DJANGO_DB_PATH:-/usr/src/app/.local/var/mathics/${MATHICS_DJANGO_DB}}
23-
24-
$DOCKER run -it \
25-
--name mathics-web \
26-
--rm \
27-
--env="DISPLAY" \
28-
--env "MATHICS_DJANGO_DB_PATH=$MATHICS_DJANGO_DB_PATH" \
29-
--workdir=/app \
30-
--volume="$PWD":/app \
31-
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
32-
--volume="/tmp:/usr/src/app/data" \
33-
-p 8000:8000 $MATHICS_IMAGE \
34-
--mode ui -- $@
25+
$DOCKER run \
26+
-it \
27+
--name mathics-django \
28+
--rm \
29+
--env="DISPLAY" \
30+
--env "MATHICS_DJANGO_DB_PATH=$MATHICS_DJANGO_DB_PATH" \
31+
--workdir=/app \
32+
--volume="$PWD":/app \
33+
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
34+
--volume="${APP_DATADIR}:/usr/src/app/data" \
35+
-p 8000:8000 \
36+
$MATHICS_IMAGE \
37+
--mode ui -- $@

0 commit comments

Comments
 (0)