From 38f2663b0e15f552c0d45d7f18ccb655264deef9 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Mar 2026 12:24:17 -0400 Subject: [PATCH 1/6] Administrivia * Use pyproject.toml * Bump version to 10ish * Update copyrights --- Makefile | 2 +- mathics_django/version.py | 2 +- mathics_django/web/templates/about.html | 2 +- mathics_django/web/templates/welcome.html | 2 +- pyproject.toml | 67 +++++++ setup.py | 206 +--------------------- 6 files changed, 76 insertions(+), 205 deletions(-) create mode 100644 pyproject.toml diff --git a/Makefile b/Makefile index 03f42f4fb..521adcdfc 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ PYTHON ?= python PIP ?= pip3 RM ?= rm -MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang +MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang,pymathics.icu .PHONY: all build \ check clean \ diff --git a/mathics_django/version.py b/mathics_django/version.py index 44002f85a..6e4862945 100644 --- a/mathics_django/version.py +++ b/mathics_django/version.py @@ -4,4 +4,4 @@ # well as importing into Python. That's why there is no # space around "=" below. # fmt: off -__version__="9.0.1.dev0" # noqa +__version__="10.0.0.dev0" # noqa diff --git a/mathics_django/web/templates/about.html b/mathics_django/web/templates/about.html index 2151821e6..9b8da1e20 100644 --- a/mathics_django/web/templates/about.html +++ b/mathics_django/web/templates/about.html @@ -165,7 +165,7 @@

Connection Information

Mathics3 is a general-purpose computer algebra system.

-

Copyright (C) 2021-2025 The Mathics3 Team


+

Copyright (C) 2021-2026 The Mathics3 Team


This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it diff --git a/mathics_django/web/templates/welcome.html b/mathics_django/web/templates/welcome.html index d612fa318..48d864d94 100644 --- a/mathics_django/web/templates/welcome.html +++ b/mathics_django/web/templates/welcome.html @@ -2,7 +2,7 @@

Welcome to Mathics3 (in Django)!

-

Copyright (C) 2021-2025 The Mathics3 Team


+

Copyright (C) 2021-2026 The Mathics3 Team


This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..4b51b63bd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[build-system] +requires = ["setuptools"] + +build-backend = "setuptools.build_meta" + +[project] +name = "Mathics3-Django" +description = "A Django-based frontend for Mathics3" +dependencies = [ + "Django >=3.1", + "Mathics3 >9", + "Mathics_Scanner > 9", + "pygments", # For colorized Python tracebacks + "requests" +] +requires-python = ">=3.10" +readme = "README.rst" +license = "GPL-3.0-or-later" +maintainers = [ + {name = "Mathics3 Group"}, +] +classifiers = [ + "Framework :: Django", + "Intended Audience :: Science/Research", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Mathematics", +] +dynamic = ["version"] + +# Conditional dependency for macOS only +# scikit-image = { version = "*", markers = "sys_platform == 'darwin'" } + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-django" +] + +full = [ + "Mathics3-Module-PyICU", + "Mathics3-Module-nltk", + "Mathics3-Module-networkx", +] + + +[project.scripts] +Mathics3server = "mathics_django.manage:main" + +[project.urls] +Homepage = "https://mathics.org/" + +[tool.setuptools.package-data] +include = [ + "mathics_django/autoload/*.m", + "mathics_django/doc/*.pcl", + "mathics_django/web/media/css/*.css", + "mathics_django/web/media/img/**/*", + "mathics_django/web/media/fonts/**/*", + "mathics_django/web/media/js/**/*.js", + "mathics_django/web/media/js/mathics-threejs-backend/**/*", + "mathics_django/web/templates/**/*.html", + "mathics_django/web/media/js/mathjax/**/*" +] + +[tool.setuptools.dynamic] +version = {attr = "mathics_django.version.__version__"} diff --git a/setup.py b/setup.py index 6540e1010..7019d8069 100644 --- a/setup.py +++ b/setup.py @@ -1,206 +1,10 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -"""Setuptools based setup script for the Django front end to Mathics. +from setuptools import find_packages, setup -For the easiest installation just type the following command (you'll probably -need root privileges): - - python setup.py install - -This will install the library in the default location. For instructions on -how to customize the install procedure read the output of: - - python setup.py --help install - -In addition, there are some other commands: - - python setup.py clean -> will clean all trash (*.pyc and stuff) - -To get a full list of available commands, read the output of: - - python setup.py --help-commands - -Or, if all else fails, feel free to write to the mathics users list at -mathics-users@googlegroups.com and ask for help. -""" - -import os.path as osp -import platform -import re -import sys - -from setuptools import Command, setup - - -def get_srcdir(): - filename = osp.normcase(osp.dirname(osp.abspath(__file__))) - return osp.realpath(filename) - - -def read(*rnames): - return open(osp.join(get_srcdir(), *rnames)).read() - - -# stores __version__ in the current namespace -exec( - compile( - open("mathics_django/version.py").read(), "mathics_django/version.py", "exec" +if __name__ == "__main__": + setup( + packages=find_packages(), + include_package_data=True, ) -) - -# Get/set VERSION and long_description from files -long_description = read("README.rst") + "\n" - - -is_PyPy = platform.python_implementation() == "PyPy" or hasattr( - sys, "pypy_version_info" -) - -DEPENDENCY_LINKS = [] -INSTALL_REQUIRES = [] - -if sys.platform == "darwin": - INSTALL_REQUIRES += ["scikit-image"] - -# General Requirements -INSTALL_REQUIRES += [ - "Mathics-Scanner >2.0", - "Mathics3 >9.1", - "django", - "matplotlib", # For networkx graphs - "networkx >= 3.0", - "pygments", # For colorized Python tracebacks - "requests", -] - - -def subdirs(root, file="*.*", depth=10): - for k in range(depth): - yield root + "*/" * k + file - - -class initialize(Command): - """ - Manually create the Django database used by the web notebook - """ - - description = "manually create the Django database used by the web notebook" - user_options = [] # distutils complains if this is not here. - - def __init__(self, *args): - self.args = args[0] # so we can pass it to other classes - Command.__init__(self, *args) - - def initialize_options(self): # distutils wants this - pass - - def finalize_options(self): # this too - pass - - def run(self): - import os - import subprocess - - settings = {} - exec( - compile( - open("mathics_django/settings.py").read(), - "mathics-django/settings.py", - "exec", - ), - settings, - ) - - database_file = settings["DATABASES"]["default"]["NAME"] - print("Creating data directory %s" % settings["DATA_DIR"]) - if not osp.exists(settings["DATA_DIR"]): - os.makedirs(settings["DATA_DIR"]) - print("Creating database %s" % database_file) - try: - subprocess.check_call( - [sys.executable, "mathics_django/manage.py", "migrate", "--noinput"] - ) - print("") - print("Database created successfully.") - except subprocess.CalledProcessError: - print("Error: failed to create database") - sys.exit(1) - - -mathjax_files = list(subdirs("media/js/mathjax/")) - -extra_requires = [] -for line in open("requirements-full.txt").read().split("\n"): - if line and not line.startswith("#"): - requires = re.sub(r"([^#]+)(\s*#.*$)?", r"\1", line) - extra_requires.append(requires) - -EXTRA_REQUIRES = {"full": extra_requires} - -setup( - name="Mathics-Django", - version=__version__, - packages=[ - "mathics_django", - "mathics_django.doc", - "mathics_django.web", - "mathics_django.web.controllers", - "mathics_django.web.templatetags", - "mathics_django.web.migrations", - ], - install_requires=INSTALL_REQUIRES, - extras_require=EXTRA_REQUIRES, - dependency_links=DEPENDENCY_LINKS, - package_data={ - "mathics_django": ["autoload/*.m"], - "mathics_django.doc": ["*.pcl"], - "mathics_django.web": [ - "media/css/*.css", - "media/img/*.*", - "media/fonts/*", - "media/img/favicons/*", - "media/js/innerdom/*.js", - "media/js/mathics-threejs-backend/*", - "media/js/prototype/*.js", - "media/js/scriptaculous/*.js", - "media/js/*.js", - "templates/*.html", - "templates/doc/*.html", - ] - + mathjax_files, - }, - entry_points={ - "console_scripts": [ - "mathicsserver = mathics_django.server:main", - ], - }, - long_description=long_description, - long_description_content_type="text/x-rst", - # don't pack Mathics in egg because of media files, etc. - zip_safe=False, - # metadata for upload to PyPI - maintainer="Mathics3 Group", - maintainer_email="mathics-devel@googlegroups.com", - description="A Django front end for Mathics3.", - license="GPL", - url="https://mathics.org/", - keywords=["Mathematica", "Wolfram", "Interpreter", "Shell", "Math", "CAS"], - classifiers=[ - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Programming Language :: Python", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Mathematics", - "Topic :: Scientific/Engineering :: Physics", - "Topic :: Software Development :: Interpreters", - ], - # TODO: could also include long_description, download_url, -) From 188ee45329856fafc11ce434dcb2c961ffcf4661 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Mar 2026 12:30:38 -0400 Subject: [PATCH 2/6] Back off "full' testing in CI for now --- .github/workflows/macos.yml | 4 +++- .github/workflows/ubuntu.yml | 4 +++- .github/workflows/windows.yml | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 656b39705..33453a2be 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -39,7 +39,9 @@ jobs: npm install - name: Install Mathics3 Django run: | - pip install -e .[full] + # We will do full after release of the various Mathics3 Modules + # pip install -e .[full] + pip install -e . make develop - name: Test Mathics3 Django run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 306fd569d..eefe6d6e0 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -39,7 +39,9 @@ jobs: npm install - name: Install Mathics3 Django run: | - python -m pip install -e .[full] + # We will do full after release of the various Mathics3 Modules + # python -m pip install -e .[full] + python -m pip install -e . make develop - name: Test Mathics3 Django run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 339c890ce..75008917f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,7 +43,9 @@ jobs: run: | cp node_modules/\@mathicsorg/mathics-threejs-backend/docs/build.js mathics_django/web/media/js/mathics-threejs-backend/index.js cp node_modules/\@mathicsorg/mathics-threejs-backend/package.json mathics_django - python -m pip install -e .[full] + # We will do full after release of the various Mathics3 Modules + # python -m pip install -e .[full] + python -m pip install -e . - name: Test Mathics3 Django run: | make pytest gstest From 5596abb8c085019c607f71a15c0910fd87b46015 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Mar 2026 14:51:38 -0400 Subject: [PATCH 3/6] Try using llvm14 --- .github/workflows/macos.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 33453a2be..134ae24ac 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ['3.11', '3.12', '3.13'] + python-version: ['3.13', '3.12'] steps: - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} @@ -20,9 +20,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install OS dependencies run: | - brew install llvm nodejs npm tesseract + brew install llvm@14 nodejs npm tesseract python -m pip install --upgrade pip - LLVM_CONFIG=/usr/local/Cellar/llvm@11/11.1.0/bin/llvm-config pip install llvmlite - name: Install Python dependencies run: | # Can adjust when next Mathics3 is released From 9e2d3561d3be1d70826eec5bb275f5e2ff538079 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Mar 2026 15:03:06 -0400 Subject: [PATCH 4/6] CI testing: add scikit-image on MacOS --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 4b51b63bd..36f3610b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,10 @@ dynamic = ["version"] # Conditional dependency for macOS only # scikit-image = { version = "*", markers = "sys_platform == 'darwin'" } +[tool.poetry.dependencies] +# Conditional dependency for macOS only +scikit-image = { version = "*", markers = "sys_platform == 'darwin'" } + [project.optional-dependencies] dev = [ "pytest", From 3dbb429139a27ea7bca58052e4d68f09507f0828 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 21 Mar 2026 15:10:01 -0400 Subject: [PATCH 5/6] CI get scikit-image installed on MacOS --- pyproject.toml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 36f3610b1..de4fd6ea7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,8 @@ dependencies = [ "Mathics3 >9", "Mathics_Scanner > 9", "pygments", # For colorized Python tracebacks - "requests" + "requests", + "scikit-image; sys_platform == 'darwin'", ] requires-python = ">=3.10" readme = "README.rst" @@ -28,13 +29,6 @@ classifiers = [ ] dynamic = ["version"] -# Conditional dependency for macOS only -# scikit-image = { version = "*", markers = "sys_platform == 'darwin'" } - -[tool.poetry.dependencies] -# Conditional dependency for macOS only -scikit-image = { version = "*", markers = "sys_platform == 'darwin'" } - [project.optional-dependencies] dev = [ "pytest", From c79c708efd5da920ce1df38aefa137a50a9f8d45 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 22 Mar 2026 07:33:47 -0400 Subject: [PATCH 6/6] Miscellaneous CI tweaks --- .github/workflows/macos.yml | 4 ++-- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 3 ++- .gitignore | 1 + Makefile | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 134ae24ac..a8230b43d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,4 +1,4 @@ -name: Mathics-Django (macos) +name: Mathics3-django (MacOS) on: push: @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python-version: ['3.13', '3.12'] + python-version: ['3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index eefe6d6e0..461acefc8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: Mathics-Django (ubuntu) +name: Mathics3-django (ubuntu) on: push: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 75008917f..780ea3726 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,5 @@ -name: Mathics (Windows) +# -*- yaml -*- +name: Mathics3-django (Windows) on: push: diff --git a/.gitignore b/.gitignore index 604ffef6b..df4405b22 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /.python-version /ChangeLog-spell-corrected /ChangeLog.orig +/Mathics3_Django.egg-info /Mathics_Django.egg-info /node_modules /package-lock.json diff --git a/Makefile b/Makefile index 521adcdfc..03f42f4fb 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ PYTHON ?= python PIP ?= pip3 RM ?= rm -MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang,pymathics.icu +MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang .PHONY: all build \ check clean \