diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 1a99f73..22dac73 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -1,10 +1,11 @@ -name: mathicsscript (MacOS) +--- +name: Mathics3 script (MacOS) on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: @@ -14,34 +15,34 @@ jobs: os: [macOS] python-version: ['3.12', '3.13', '3.14'] steps: - - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - brew install asymptote - python3 -m pip install --upgrade pip - python3 -m pip install setuptools - # We can comment out after next Mathics3-Scanner release - # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git - # cd Mathics3-scanner/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - # We can comment out after next Mathics3-pygments release - # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments - # We can comment out after next mathics-core release - # git clone --depth 1 https://github.com/Mathics3/mathics-core.git - # cd mathics-core/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - - name: Install mathicsscript - run: | - make - - name: Test mathicsscript - run: | - pip3 install -r requirements-dev.txt - make check + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + brew install asymptote + python3 -m pip install --upgrade pip + python3 -m pip install setuptools + # We can comment out after next Mathics3-Scanner release + # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git + # cd Mathics3-scanner/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + # We can comment out after next Mathics3-pygments release + # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments + # We can comment out after next mathics-core release + # git clone --depth 1 https://github.com/Mathics3/mathics-core.git + # cd mathics-core/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + - name: Install Mathics3 script + run: | + make + - name: Test Mathics3 script + run: | + pip3 install -r requirements-dev.txt + make check diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index be11464..40e81c1 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,10 +1,11 @@ -name: mathicsscript (ubuntu) +--- +name: Mathics3 script (ubuntu) on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: @@ -13,35 +14,35 @@ jobs: matrix: python-version: ['3.13', '3.11', '3.12', '3.14'] steps: - - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - sudo apt-get update -qq && sudo apt-get install -qq liblapack-dev llvm-dev asymptote - python3 -m pip install --upgrade pip - python3 -m pip install setuptools - # We can comment out after next Mathics3-Scanner release - # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git - # cd Mathics3-scanner/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - # We can comment out after next Mathics3-pygments release - # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments - # We can comment out after next mathics-core release - # cd .. - # git clone --depth 1 https://github.com/Mathics3/mathics-core.git - # cd mathics-core/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - - name: Install mathicsscript - run: | - make - - name: Test mathicsscript - run: | - pip3 install pytest - make check + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + sudo apt-get update -qq && sudo apt-get install -qq liblapack-dev llvm-dev asymptote + python3 -m pip install --upgrade pip + python3 -m pip install setuptools + # We can comment out after next Mathics3-Scanner release + # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git + # cd Mathics3-scanner/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + # We can comment out after next Mathics3-pygments release + # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments + # We can comment out after next mathics-core release + # cd .. + # git clone --depth 1 https://github.com/Mathics3/mathics-core.git + # cd mathics-core/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + - name: Install mathicsscript + run: | + make + - name: Test mathicsscript + run: | + pip3 install pytest + make check diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 95e02a3..a931c5e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,10 +1,11 @@ -name: mathicsscript (Windows) +--- +name: Mathics3 script (MS Windows) on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: @@ -14,34 +15,34 @@ jobs: os: [windows] python-version: ['3.12', '3.14'] steps: - - uses: actions/checkout@v6 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install wheel setuptools - set LLVM_DIR="C:\Program Files\LLVM" - # We can comment out after next Mathics-Scanner release - # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git - # cd Mathics3-scanner/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - # We can comment out after next Mathics3-pygments release - # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments - # We can comment out after next mathics-core release - # git clone --depth 1 https://github.com/Mathics3/mathics-core.git - # cd mathics-core/ - # pip install --no-build-isolation -e . - # bash -x admin-tools/make-JSON-tables.sh - # cd .. - - name: Install mathicsscript - run: | - make - - name: Test mathicsscript - run: | - pip3 install -r requirements-dev.txt - make check + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install wheel setuptools + set LLVM_DIR="C:\Program Files\LLVM" + # We can comment out after next Mathics-Scanner release + # git clone --depth 1 https://github.com/Mathics3/Mathics3-scanner.git + # cd Mathics3-scanner/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + # We can comment out after next Mathics3-pygments release + # python -m pip install -e git+https://github.com/Mathics3/Mathics3-pygments#egg=Mathics3-pygments + # We can comment out after next mathics-core release + # git clone --depth 1 https://github.com/Mathics3/mathics-core.git + # cd mathics-core/ + # pip install --no-build-isolation -e . + # bash -x admin-tools/make-JSON-tables.sh + # cd .. + - name: Install mathicsscript + run: | + make + - name: Test mathicsscript + run: | + pip3 install -r requirements-dev.txt + make check diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b5322c..e0fdb98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,29 @@ +--- default_language_version: python: python repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - - id: check-merge-conflict - - id: debug-statements - stages: [pre-commit] - exclude: ChangeLog-spell-corrected.diff - - id: end-of-file-fixer - exclude: ChangeLog-spell-corrected.diff - stages: [pre-commit] - - id: trailing-whitespace - exclude: ChangeLog-spell-corrected.diff -- repo: https://github.com/psf/black + - id: check-merge-conflict + - id: debug-statements + stages: [pre-commit] + exclude: ChangeLog-spell-corrected.diff + - id: end-of-file-fixer + exclude: ChangeLog-spell-corrected.diff + stages: [pre-commit] + - id: trailing-whitespace + exclude: ChangeLog-spell-corrected.diff + - repo: https://github.com/psf/black rev: 25.11.0 hooks: - - id: black - language_version: python3 - exclude: 'mathicsscript/version.py' + - id: black + language_version: python3 + exclude: 'mathicsscript/version.py' + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.31.0 # Use the latest version + hooks: + - id: check-github-workflows # - repo: https://github.com/pycqa/flake8 # rev: 3.9.2 # hooks: diff --git a/Makefile b/Makefile index de4e39d..9c3b24a 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ build: inputrc develop: inputrc $(PIP) install -e . -#: Make distirbution: wheels, eggs, tarball +#: Make distirbution: wheel and tarball dist: ./admin-tools/make-dist.sh diff --git a/mathicsscript/format.py b/mathicsscript/format.py index 35a90eb..0706a3e 100644 --- a/mathicsscript/format.py +++ b/mathicsscript/format.py @@ -9,6 +9,7 @@ import networkx as nx from mathics.core.atoms import String +from mathics.core.expression import BoxError, Expression from mathics.core.symbols import Symbol from mathics.core.systemsymbols import ( SymbolAborted, @@ -22,7 +23,6 @@ SymbolInterpretationBox, SymbolMathMLForm, SymbolOutputForm, - SymbolPaneBox, SymbolPlot, SymbolStandardForm, SymbolTeXForm, @@ -92,8 +92,6 @@ def eval_boxed(result, fn: Callable, obj, **options): if isinstance(format, dict): return dict((k, obj.format_output(expr, f)) for k, f in format.items()) - from mathics.core.expression import BoxError, Expression - expr_type = expr.get_head_name() expr_head = expr.get_head() @@ -224,7 +222,7 @@ def eval_boxed(result, fn: Callable, obj, **options): raise ValueError try: - boxes = result.boxes_to_text(evaluation=obj) + boxes = result.to_text(evaluation=obj) except BoxError: boxes = None if not hasattr(obj, "seen_box_error"): diff --git a/pyproject.toml b/pyproject.toml index 1d8c7ef..3d2ba93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ name = "Mathics3_script" description = "Command-line interface to Mathics3" dependencies = [ "Mathics3_Scanner>=10.0.0", - "Mathics3 >= 10.0.0", + "Mathics3 >= 10.0.1", "click >= 8.0.0", "colorama", "columnize",