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
Binary file added doc_data_html.pcl
Binary file not shown.
39 changes: 21 additions & 18 deletions docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- Dockerfile -*-
FROM ubuntu:25.04
FROM ubuntu:26.04

ENV MATHICS3_HOME=/home/ubuntu
ENV MATHICS3_MODULE_OPTION="--load-module pymathics.graph,pymathics.natlang,pymathics.trepan"
Expand All @@ -26,6 +26,7 @@ RUN apt-get install -y -qq \
asymptote \
cargo \
evince \
enchant-2 \
gfortran \
git \
gyp \
Expand All @@ -38,8 +39,8 @@ RUN apt-get install -y -qq \
libxcb-cursor-dev \
libxml2-dev \
libxslt1-dev \
llvm-15 \
llvm-15-dev \
llvm-18 \
llvm-18-dev \
lmodern texlive-latex-extra \
maria \
mesa-utils \
Expand All @@ -48,7 +49,7 @@ RUN apt-get install -y -qq \
pkg-config \
pyqt5-dev-tools \
python3-pip \
python3.13-venv \
python3.14-venv \
remake \
rustc \
sqlite3 \
Expand All @@ -61,26 +62,24 @@ RUN apt-get install -y -qq \
# # defer deletion until close to the end
# # RUN rm -fr /tmp*_amd64.deb

RUN /usr/bin/python3.13 -m venv /opt/python3.13
ENV PATH=.:/opt/python3.13/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PYTHON=/opt/python3.13/bin/python3.13
ENV PIP=/opt/python3.13/bin/pip
RUN /usr/bin/python3.14 -m venv /opt/python3.14
ENV PATH=.:/opt/python3.14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PYTHON=/opt/python3.14/bin/python3.14
ENV PIP=/opt/python3.14/bin/pip
RUN $PYTHON -m pip install --upgrade pip

#########################
# Development libraries
#########################

RUN $PIP install --local -e git+https://github.com/rocky/python-xdis.git#egg=xdis
RUN $PYTHON -m pip install setuptools
RUN $PIP install --local --no-build-isolation -e git+https://github.com/rocky/python-filecache.git#egg=pyficache
RUN $PIP install --local -e git+https://github.com/rocky/python-uncompyle6.git#egg=uncompyle6
RUN $PIP install --local -e git+https://github.com/rocky/python-decompile3.git#egg=decompyle3
RUN $PIP install git+https://github.com/rocky/python-filecache#egg=pyficache
RUN $PIP install -e git+https://github.com/Trepan-Debuggers/python3-trepan#egg=trepan3k
RUN $PIP install -e git+https://github.com/Trepan-Debuggers/python3-trepan#egg=trepan3k
RUN git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git
RUN (cd Mathics3-scanner && $PIP install -e .[full] && bash -x ./admin-tools/make-JSON-tables.sh)
RUN $PIP install git+https://github.com/rocky/python-xdis.git
RUN $PIP install git+https://github.com/Trepan-Debuggers/python3-trepan.git

# #################
Expand All @@ -92,14 +91,15 @@ RUN git clone --depth 1 https://github.com/Mathics3/mathics-core.git
# We need to add the second repository Rubi, explicitly
RUN (cd mathics-core && git submodule update --init --recursive && \
git submodule add https://github.com/Mathics3/Mathics3-Rubi.git mathics/Packages/Rubi)
RUN (cd mathics-core && git submodule && $PIP install -e .[full])
RUN (cd mathics-core && git submodule && $PIP install -e .[full] --no-build-isolation)
RUN (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)

##############################################
# Mathics Modules: Trepan, Graph, and Natlang
##############################################
RUN pip install Mathics3-Module-Base
RUN pip install mathics-pygments
RUN $PIP install Mathics3-Module-Base
RUN git clone --depth 1 https://github.com/Mathics3/Mathics3-pygments.git
RUN (cd Mathics3-pygments && $PIP install -e . --no-build-isolation)
RUN git clone --depth 1 https://github.com/Mathics3/Mathics3-trepan.git
RUN (cd Mathics3-trepan && $PIP install --no-build-isolation -e .)

Expand All @@ -108,6 +108,7 @@ RUN (cd trepan3k-mathics-debugger && $PIP install -e .)

RUN $PIP install --no-build-isolation -e "git+https://github.com/Mathics3/Mathics3-Module-networkx#egg=Mathics3-Module-networkx"
RUN $PIP install --no-build-isolation -e "git+https://github.com/Mathics3/Mathics3-Module-nltk#egg=Mathics3-Module-nltk"
# RUN $PIP install --no-build-isolation -e "git+https://github.com/Mathics3/Mathics3-Module-PyICU#egg=Mathics3-Module-PyICU"

RUN $PIP install spacy wordcloud
RUN $PYTHON -m spacy download en_core_web_md
Expand All @@ -130,7 +131,7 @@ RUN $PIP install nltk
# # COPY src/documentation.tex mathics-core/mathics/doc/latex/documentation.tex
# # COPY src/version-info.tex mathics-core/mathics/doc/latex/

COPY src/mathics.pdf mathics-core/mathics/doc/latex/mathics.pdf
COPY src/mathics3.pdf mathics-core/mathics/doc/latex/mathics3.pdf

##################
# Mathics Django #
Expand All @@ -145,7 +146,9 @@ RUN (cd Mathics3-django && make build)
# # RUN (cd src/Mathics3-django && PIP=$PIP make)
# RUN (cd Mathics3-django && $PYTHON Mathics3_django/docpipeline.py -ok) || true
COPY src/doc_html_data.pcl doc_html_data.pcl
RUN mv -v doc_html_data.pcl /home/ubuntu/Mathics3-django/mathics_django/doc/doc_data_html.pcl
RUN mkdir -p ${MATHICS3_HOME}/.local/var/Mathics3/
RUN mv -v doc_html_data.pcl /home/ubuntu/.local/var/Mathics3/doc_data_html.pcl
RUN (cd Mathics3-django && $PYTHON -m pip install --no-build-isolation -e .)

##################
# Mathicsscript #
Expand All @@ -154,7 +157,7 @@ RUN mv -v doc_html_data.pcl /home/ubuntu/Mathics3-django/mathics_django/doc/doc_
RUN git clone --depth 1 https://github.com/Mathics3/mathicsscript.git
RUN (cd mathicsscript && PYTHON=$PYTHON make install)

RUN ${PYTHON} -m pip install mathicsscript[full]
RUN (cd mathicsscript && $PYTHON -m pip install -e .[full])
# RUN ${PYTHON} -m pip install -e git+https://github.com/Mathics3/mathicsscript#egg=mathicsscript[full]
# RUN (cd src/mathicsscript && make)

Expand All @@ -181,7 +184,7 @@ RUN mkdir -p ${MATHICS3_HOME}/.local
RUN mkdir -p ${MATHICS3_HOME}/.config
RUN mkdir -p ${MATHICS3_HOME}/data
RUN mkdir -p ${MATHICS3_HOME}/.local/var/Mathics3/Packages
COPY django-db/mathics.sqlite ${MATHICS3_HOME}/.local/var/Mathics3/mathics.sqlite
COPY django-db/mathics3.sqlite ${MATHICS3_HOME}/.local/var/Mathics3/mathics3.sqlite
RUN chown -R ubuntu:ubuntu $MATHICS3_HOME ${MATHICS3_HOME}/.local
RUN chown -R ubuntu:ubuntu ${MATHICS3_HOME}/data
USER ubuntu
Expand Down
Binary file not shown.
18 changes: 10 additions & 8 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This is the docker entry point and gets installed as /usr/local/bin/mathics.sh

USER_HOME="/home/ubuntu"
MATHICS_DJANGO_SYSTEM_DB_PATH="${USER_HOME}/.local/var/Mathics3/mathics.sqlite"
MATHICS_DJANGO_SYSTEM_DB_PATH="${USER_HOME}/.local/var/Mathics3/mathics3.sqlite"

export PATH="/opt/python3.13/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${USER_HOME}/.local/bin"
export PATH="/opt/python3.14/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${USER_HOME}/.local/bin"
export PYTHONBREAKPOINT=trepan.api.debug

script_cmd="${ENTRYPOINT_COMMAND:-$(basename $0)}"
Expand Down Expand Up @@ -57,17 +57,19 @@ done
case $mathics_mode in
cli) mathicsscript $@
;;
mathics3-tokens) mathics3-tokens $@
mathics3-code-tokenize) mathics3-code-tokenize $@
;;
mathics3-code-parse) mathics3-code-parse $@
;;
minimal|mathics|mathics3)
mathics $@
mathics3 $@
;;
document|pdf)
evince ${USER_HOME}/mathics-core/mathics/doc/latex/mathics.pdf
evince ${USER_HOME}/mathics-core/mathics/doc/latex/mathics3.pdf
;;
copy)
echo "Copying mathics.pdf to host-attached filesystem ${TEMPDIR}."
cp ${USER_HOME}/mathics-core/mathics/doc/latex/mathics.pdf /usr/src/app/data/mathics.pdf
cp ${USER_HOME}/mathics-core/mathics/doc/latex/mathics3.pdf /usr/src/app/data/mathics3.pdf
;;
django|ui|gui)
echo
Expand All @@ -79,11 +81,11 @@ case $mathics_mode in
cp -vp $MATHICS_DJANGO_SYSTEM_DB_PATH $MATHICS_DJANGO_DB_PATH
fi
else
echo "~~~~ SQLite data (worksheets, user info) will be stored in $MATHICS_HOME/data/mathics.sqlite"
echo "~~~~ SQLite data (worksheets, user info) will be stored in $MATHICS_HOME/data/mathics3.sqlite"
fi
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo
mathicsserver -e $@ ;;
Mathics3server runserver $@ ;;
shell) /bin/bash ;;
*) echo "unknown mathics_mode=$mathics_mode. See '$script_cmd --help'" ; exit 2 ;;
esac
Binary file added docker/src/doc_data_html.pcl
Binary file not shown.
Binary file modified docker/src/mathics3.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ include = ["script/dmathics3"]

[tool.poetry.scripts]
dmathics3 = { reference = "script/dmathics3", type = "file" }
dmathics3-tokens = { reference = "script/dmathics3-tokens", type = "file" }
dmathics3-parser = { reference = "script/dmathics3-parse", type = "file" }
dmathics3-tokenize = { reference = "script/dmathics3-tokenize", type = "file" }
dmathics3copy = { reference = "script/dmathics3copy", type = "file" }
dmathics3doc = { reference = "script/dmathics3doc", type = "file" }
dmathics3Server = { reference = "script/dmathics3server", type = "file" }

[tool.setuptools.packages.find]
include = ["mathics3_omnibus*"]
Expand Down
26 changes: 26 additions & 0 deletions script/dmathics3-code-parse
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
if [ -n "$DEBUG" ]; then
set -x
fi

# The release name we are configured to run under.
typeset dmathics_version='1.0.0'

# Allow customization using POSIX environment variables:
DOCKER=${DOCKER:-docker}

TAG=${TAG:-latest}
MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}

# Show environment variables
for env_setting in MATHICS3_IMAGE; do
echo $env_setting = ${!env_setting}
done


$DOCKER run --rm -it \
--name mathics3-code-parse \
--volume /tmp:/usr/src/app/data \
$MATHICS3_IMAGE \
--mode mathics3-code-parse -- $@
2 changes: 1 addition & 1 deletion script/dmathics3-tokens → script/dmathics3-code-tokenize
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ $DOCKER run --rm -it \
--name mathics-cli \
--volume /tmp:/usr/src/app/data \
$MATHICS3_IMAGE \
--mode mathics3-tokens -- $@
--mode mathics3-code-tokenize -- $@
File renamed without changes.
File renamed without changes.
27 changes: 13 additions & 14 deletions script/dmathicsserver → script/dmathics3server
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ if [ -n "$DEBUG" ]; then
fi

# The release name we are configured to run under.
typeset dmathicsserver_version='2.0.0'
typeset dmathicsserver_version='10.0.0'

# Allow customization using POSIX environment variables:
APP_DATADIR=${APP_DATADIR:-/tmp}
DOCKER=${DOCKER:-docker}
ASYMPTOTE_PDFVIEWER=${ASYMPTOTE_PDFVIWER:-/usr/bin/evince}
USER_HOME="/home/ubuntu"
MATHICS_DJANGO_DB=${MATHICS_DJANGO_DB:-"mathics.sqlite"}
MATHICS_DJANGO_DB_PATH=${MATHICS_DJANGO_DB_PATH:-${USER_HOME}/.local/var/Mathics3/${MATHICS_DJANGO_DB}}
MATHICS3_DJANGO_DB=${MATHICS_DJANGO_DB:-"mathics3.sqlite"}
MATHICS3_DJANGO_DB_PATH=${MATHICS_DJANGO_DB_PATH:-${USER_HOME}/.local/var/Mathics3/${MATHICS3_DJANGO_DB}}
TAG=${TAG:-latest}

MATHICS3_IMAGE=${MATHICS3_IMAGE:-mathicsorg/mathics:${TAG}}
Expand All @@ -26,9 +26,9 @@ for arg in "$@" ; do
-h | --help | help )
cat <<_EOH
usage:
dmathicsserver [options]
dmathics3server [options]

runs the Mathics command-line interface from a docker container.
runs the Mathics3 command-line interface from a docker container.

Options specfic to dmathicsserver:

Expand All @@ -39,7 +39,7 @@ Options specfic to dmathicsserver:
show this help

-V| --version
show the dmathicserver version and exit
show the dmathics3server version and exit

We will now pass help along to the docker image. Just a sec...

Expand All @@ -50,7 +50,7 @@ _EOH
$DOCKER pull $MATHICS3_IMAGE
;;
-v | -V | --version)
echo "dmathicsserver version ${dmathicsserver_version}"
echo "dmathics3server version ${dmathicsserver_version}"
exit 100
;;
default)
Expand All @@ -59,24 +59,23 @@ _EOH
done

# Show environment variables
for env_setting in MATHICS_DJANGO_DB_PATH APP_DATADIR MATHICS3_IMAGE DISPLAY; do
for env_setting in MATHICS3_DJANGO_DB_PATH APP_DATADIR MATHICS3_IMAGE DISPLAY; do
echo $env_setting = ${!env_setting}
done

$DOCKER run \
-it \
--name mathics-django \
--name Mathics3-django \
--rm \
--env "COLORFGBG=$COLORFGBG" \
--env="DISPLAY" \
--env="ASYMPTOTE_PDFVIEWER=/usr/bin/evince" \
--env "MATHICS_DJANGO_DB_PATH=$MATHICS_DJANGO_DB_PATH" \
--env "PYTHON=/opt/python3.12/bin/python3.12" \
--env "PYTHON=/opt/python3.14/bin/python3.14" \
--user=$(id -u) \
--workdir=/app \
--volume="$PWD":/app \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="${APP_DATADIR}:/home/ubuntu/.local/var/Mathics3" \
-p 8000:8000 \
--network=host \
$MATHICS3_IMAGE \
--mode ui -- $stripped_args
--mode ui -- $stripped_args \
# --volume="${APP_DATADIR}:/home/ubuntu/.local/var/Mathics3" \