Skip to content

Commit

Permalink
Merge branch 'master' into arithmetic_refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed Aug 3, 2024
2 parents c16e3bc + b5eeb1c commit 539a29b
Show file tree
Hide file tree
Showing 336 changed files with 14,486 additions and 8,312 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/consistency-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/isort-and-black-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install click, black and isort
run: pip install 'click==8.0.4' 'black==22.3.0' 'isort==5.10.1'
run: pip install 'click==8.0.4' 'black==23.12.1' 'isort==5.13.2'
- name: Run isort --check .
run: isort --check .
- name: Run black --check .
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,23 @@ on:
jobs:
build:
env:
LDFLAGS: "-L/usr/local/opt/llvm@11/lib"
CPPFLAGS: "-I/usr/local/opt/llvm@11/include"
LDFLAGS: "-L/usr/local/opt/llvm@14/lib"
CPPFLAGS: "-I/usr/local/opt/llvm@14/include"
runs-on: macos-latest
strategy:
matrix:
os: [macOS]
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OS dependencies
run: |
brew install llvm@11 tesseract
brew install llvm@14 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 Mathics3 with full Python dependencies
run: |
# We can comment out after next Mathics-Scanner release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
matrix:
python-version: ['3.11', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OS dependencies
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
strategy:
matrix:
os: [windows]
python-version: ['3.10', '3.11']
# "make doctest" on MS Windows fails without showing much of a
# trace of where things went wrong on Python before 3.11.
python-version: ['3.11']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install OS dependencies
Expand All @@ -27,7 +29,7 @@ jobs:
# so we will be safe here. Another possibility would be check and install
# conditionally.
choco install --force llvm
choco install tesseract
# choco install tesseract
set LLVM_DIR="C:\Program Files\LLVM"
- name: Install Mathics3 with Python dependencies
run: |
Expand All @@ -46,8 +48,6 @@ jobs:
run: |
pip install pyocr # from full
pip install -e .[dev]
set PYTEST_WORKERS="-n3"
# Until we can't figure out what's up with TextRecognize:
make pytest gstest
make doctest o="--exclude TextRecognize"
make doctest
# make check
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ default_language_version:
python: python
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: debug-statements
stages: [commit]
- id: end-of-file-fixer
stages: [commit]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
stages: [commit]
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.12.1
hooks:
- id: black
language_version: python3
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Additional contributions were made by:
- Pablo Emilio Escobar Gaviria @GarkGarcia
- Rocky Bernstein @rocky
- Tiago Cavalcante Trindade @TiagoCavalcante
- Li Xiang @Li-Xiang-Ideal
- Kevin Cao @kejcao

Thanks to the authors of all projects that are used in Mathics:
- Django
Expand Down
40 changes: 28 additions & 12 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,48 @@ CHANGES
New Builtins
++++++++++++

* ``$MaxLengthIntStringConversion``
* ``Elements``
* ``ConjugateTranspose``
* ``LeviCivitaTensor``
* ``RealAbs`` and ``RealSign``
* ``RealValuedNumberQ``

* `Elements`
* `RealAbs` and `RealSign`

Compatibility
-------------

* ``*Plot`` does not show messages during the evaluation.


* ``Range[]`` now handles a negative ``di`` PR #951
* Improved support for ``DirectedInfinity`` and ``Indeterminate``.
* ``Graphics`` and ``Graphics3D`` including wrong primitives and directives
are shown with a pink background. In the Mathics-Django interface, a tooltip
error message is also shown.

Internals
---

* ``eval_abs`` and ``eval_sign`` extracted from ``Abs`` and ``Sign`` and added to ``mathics.eval.arithmetic``.
* Maximum number of digits allowed in a string set to 7000 and can be adjusted using environment variable
``MATHICS_MAX_STR_DIGITS`` on Python versions that don't adjust automatically (like pyston).
* Real number comparisons implemented is based now in the internal implementation of `RealSign`.
* Real number comparisons implemented is based now in the internal implementation of ``RealSign``.
* For Python 3.11, the variable ``$MaxLengthIntStringConversion`` controls the maximum size of
the literal conversion between large integers and Strings.
* Older style non-appearing and non-pedagogical doctests have been converted to pytest
* Built-in code is directed explicitly rather than implicitly. This facilitates the ability to lazy load
builtins or "autoload" them a la GNU Emacs autoload.

Bugs
----

* Improved support for ``DirectedInfinity`` and ``Indeterminate``.
* ``Definitions`` is compatible with ``pickle``.


* Improved support for ``Quantity`` expressions, including conversions, formatting and arithmetic operations.
* ``Background`` option for ``Graphics`` and ``Graphics3D`` is operative again.
* ``Switch[]`` involving ``Infinity`` Issue #956
* ``Outer[]`` on ``SparseArray`` Issue #939
* ``ArrayQ[]`` detects ``SparseArray`` PR #947
* Numeric comparisons against expressions involving ``String``s (Issue #797).
Package updates
+++++++++++++++
Expand Down Expand Up @@ -131,7 +147,7 @@ Documentation
#. "Exponential Functional" split out from "Trigonometry Functions"
#. "Functional Programming" section split out.
#. "Image Manipulation" has been split off from Graphics and Drawing and turned into a guide section.
#. Image examples now appear in the LaTeX and therfore the PDF doc
#. Image examples now appear in the LaTeX and therefore the PDF doc
#. "Logic and Boolean Algebra" section reinstated.
#. "Forms of Input and Output" is its own guide section.
#. More URL links to Wiki pages added; more internal cross links added.
Expand Down Expand Up @@ -168,7 +184,7 @@ Bugs
#. Better handling of ``Infinite`` quantities.
#. Improved ``Precision`` and ``Accuracy``compatibility with WMA. In particular, ``Precision[0.]`` and ``Accuracy[0.]``
#. Accuracy in numbers using the notation ``` n.nnn``acc ``` now is properly handled.
#. numeric precision in mpmath was not reset after operations that changed these. This cause huges slowdowns after an operation that set the mpmath precison high. This was the source of several-minute slowdowns in testing.
#. numeric precision in mpmath was not reset after operations that changed these. This cause huges slowdowns after an operation that set the mpmath precision high. This was the source of several-minute slowdowns in testing.
#. GIF87a (```MadTeaParty.gif`` or ExampleData) image loading fixed
#. Replace non-free Leena image with a a freely distributable image. Issue #728

Expand Down Expand Up @@ -1046,7 +1062,7 @@ New features (50+ builtins)
#. ``SubsetQ`` and ``Delete[]`` #688, #784,
#. ``Subsets`` #685
#. ``SystemTimeZone`` and correct ``TimeZone`` #924
#. ``System\`Byteordering`` and ``System\`Environemnt`` #859
#. ``System\`Byteordering`` and ``System\`Environment`` #859
#. ``$UseSansSerif`` #908
#. ``randchoice`` option for ``NoNumPyRandomEnv`` #820
#. Support for ``MATHICS_MAX_RECURSION_DEPTH``
Expand Down Expand Up @@ -1396,7 +1412,7 @@ New features
#. ``PolarPlot``
#. IPython style (coloured) input
#. ``VectorAnalysis`` Package
#. More special functions (Bessel functions and othogonal polynomials)
#. More special functions (Bessel functions and orthogonal polynomials)
#. More NumberTheory functions
#. ``Import``, ``Export``, ``Get``, ``Needs`` and other IO related functions
#. PyPy compatibility
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

Expand Down
6 changes: 4 additions & 2 deletions FUTURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

.. contents::

The following 2023 road map that appears the 6.0.0 hasn't gone through enough discussion. This provisional.
Check the github repository for updates.

2024 Roadmap
============

To be decided...

2023 Roadmap
============
Expand Down
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ PYTHON ?= python3
PIP ?= pip3
BASH ?= bash
RM ?= rm
PYTEST_OPTIONS ?=
DOCTEST_OPTIONS ?=

# Variable indicating Mathics3 Modules you have available on your system, in latex2doc option format
MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang
Expand Down Expand Up @@ -73,7 +75,7 @@ develop-full-cython: mathics/data/op-tables.json
$(PIP) install -e .[dev,full,cython]


#: Make distirbution: wheels, eggs, tarball
#: Make distribution: wheels, eggs, tarball
dist:
./admin-tools/make-dist.sh

Expand All @@ -84,13 +86,16 @@ install:
#: Run the most extensive set of tests
check: pytest gstest doctest

#: Run the most extensive set of tests
check-for-Windows: pytest-for-windows gstest doctest

#: Build and check manifest of Builtins
check-builtin-manifest:
$(PYTHON) admin-tools/build_and_check_manifest.py

#: Run pytest consistency and style checks
check-consistency-and-style:
MATHICS_LINT=t $(PYTHON) -m pytest test/consistency-and-style
MATHICS_LINT=t $(PYTHON) -m pytest $(PYTEST_OPTIONS) test/consistency-and-style

check-full: check-builtin-manifest check-builtin-manifest check

Expand All @@ -113,9 +118,9 @@ clean: clean-cython clean-cache
rm -f mathics/data/op-tables || true; \
rm -rf build || true

#: Run py.test tests. Use environment variable "o" for pytest options
#: Run pytest tests. Use environment variable "PYTEST_OPTIONS" for pytest options
pytest:
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m pytest $(PYTEST_WORKERS) test $o
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m pytest $(PYTEST_OPTIONS) $(PYTEST_WORKERS) test


#: Run a more extensive pattern-matching test
Expand All @@ -128,9 +133,9 @@ gstest:
doctest-data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
MATHICS_CHARACTER_ENCODING="UTF-8" $(PYTHON) mathics/docpipeline.py --output --keep-going $(MATHICS3_MODULE_OPTION)

#: Run tests that appear in docstring in the code.
#: Run tests that appear in docstring in the code. Use environment variable "DOCTEST_OPTIONS" for doctest options
doctest:
MATHICS_CHARACTER_ENCODING="ASCII" SANDBOX=$(SANDBOX) $(PYTHON) mathics/docpipeline.py $o
MATHICS_CHARACTER_ENCODING="ASCII" SANDBOX=$(SANDBOX) $(PYTHON) mathics/docpipeline.py $(DOCTEST_OPTIONS)

#: Make Mathics PDF manual via Asymptote and LaTeX
latexdoc texdoc doc:
Expand Down
8 changes: 4 additions & 4 deletions PAST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A fair bit of code refactoring has gone on so that we might be able to
scale the code, get it to be more performant, and more in line with
other interpreters. There is Greater use of Symbols as opposed to strings.

The buitin Functions have been organized into grouping akind to what is found in WMA.
The builtin Functions have been organized into grouping akind to what is found in WMA.
This is not just for documentation purposes, but it better modularizes the code and keep
the modules smaller while suggesting where functions below as we scale.

Expand All @@ -34,14 +34,14 @@ Boxing and Formatting
While some work on formatting is done has been made and the change in API reflects a little of this.
However a lot more work needs to be done.

Excecution Performance
Execution Performance
----------------------

This has improved a slight bit, but not because it has been a focus, but
rather because in going over the code organization, we are doing this
less dumb, e.g. using Symbols more where symbols are intended. Or
fixing bugs like resetting mpmath numeric precision on operations that
need to chnage it temporarily.
need to change it temporarily.

Simpler Things
--------------
Expand All @@ -50,6 +50,6 @@ A number of items here remain, but should not be thought as independent items, b
"Forms, Boxing and Formatting".

"Making StandardOutput of polynomials match WMA" is really are Forms, Boxing and Formatting issue;
"Working on Jupyter integrations" is also very dependant this.
"Working on Jupyter integrations" is also very dependent this.

So the next major refactor will be on Forms, Boxing and Formatting.
1 change: 1 addition & 0 deletions SYMBOLS_MANIFEST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ System`LessEqual
System`LetterCharacter
System`LetterNumber
System`LetterQ
System`LeviCivitaTensor
System`Level
System`LevelQ
System`LightBlue
Expand Down
2 changes: 1 addition & 1 deletion admin-tools/build_and_check_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

from mathics.builtin.base import Builtin
from mathics.core.builtin import Builtin
from mathics.core.load_builtin import (
import_and_load_builtins,
modules,
Expand Down
3 changes: 2 additions & 1 deletion admin-tools/make-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ for pyversion in $PYVERSIONS; do
exit $?
fi
rm -fr build
python setup.py bdist_egg
# PYPI no longer supports eggs
# python setup.py bdist_egg
python setup.py bdist_wheel
done

Expand Down
2 changes: 1 addition & 1 deletion admin-tools/pyenv-versions
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
echo "This script should be *sourced* rather than run directly through bash"
exit 1
fi
export PYVERSIONS='3.6.15 3.7.16 pyston-2.3.5 pypy3.9-7.3.11 3.8.16 3.9.16 3.10.10'
export PYVERSIONS='3.6.15 3.7.16 pyston-2.3.5 pypy3.9-7.3.11 3.8.17 3.9.18 3.10.13 3.11.7'
2 changes: 1 addition & 1 deletion examples/symbolic_logic/gries_schneider/GS1.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@
right-hand side of the rule now, while parsing the rule itself, only later,
after doing the pattern substitutions specified by the rule."
Remember, evaluation is really aggressive. When you write a rule withe "->",
Remember, evaluation is really aggressive. When you write a rule with a "->",
mathics will try to evaluate the right-hand side.
Sometimes, it doesn't matter which of the two you use. In the example
Expand Down
Loading

0 comments on commit 539a29b

Please sign in to comment.