Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyston workflow #3

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4738d31
add workflow for pyston
mmatera Jun 9, 2022
9436936
force pyston in make
mmatera Jun 9, 2022
5bf9c0a
fix name
mmatera Jun 9, 2022
91a65c9
fix indent
mmatera Jun 9, 2022
1ea133c
Update ubuntu-pyston.yml
mmatera Jun 9, 2022
33d5eea
adding dependency
mmatera Jun 9, 2022
d8e6dde
add dependency
mmatera Jun 9, 2022
77862dc
l18
mmatera Jun 9, 2022
25a16ef
llvm
mmatera Jun 9, 2022
4545032
llvm
mmatera Jun 9, 2022
2335037
llvm
mmatera Jun 9, 2022
200998f
removing the other wfs
mmatera Jun 9, 2022
e93d6e4
ubuntu 22
mmatera Jun 9, 2022
513ad9d
ubuntu 22
mmatera Jun 9, 2022
4f69d73
ubuntu 22
mmatera Jun 9, 2022
f14fe19
ubuntu 22
mmatera Jun 9, 2022
e1b1bd0
ubuntu 22
mmatera Jun 9, 2022
83e1a3a
make llvmlite as optional
mmatera Jun 9, 2022
5ccd181
make llvmlite as optional
mmatera Jun 9, 2022
41848f9
llvm
mmatera Jun 10, 2022
6f2835e
llvm
mmatera Jun 10, 2022
5136ee2
llvm
mmatera Jun 10, 2022
2f3538e
llvm
mmatera Jun 10, 2022
467f33e
llvm
mmatera Jun 10, 2022
27a9584
check requires
mmatera Jun 10, 2022
a0c403e
verbose skip
mmatera Jun 10, 2022
09dd96e
verboser
mmatera Jun 10, 2022
12fdceb
skip not installed symbols
mmatera Jun 10, 2022
5ec887a
skip not installed symbols
mmatera Jun 10, 2022
f09a0a5
remove print
mmatera Jun 10, 2022
99cc4a0
skip not installed symbols
mmatera Jun 10, 2022
878efae
chapters does not have installed attribute
mmatera Jun 10, 2022
108e382
requires for scipy
mmatera Jun 10, 2022
5f44b72
...
mmatera Jun 10, 2022
10f2672
removing test for MaxRecursion
mmatera Jun 10, 2022
79fccbc
tiny changes
mmatera Jun 10, 2022
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
36 changes: 0 additions & 36 deletions .github/workflows/osx.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/ubuntu-cython.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/ubuntu-pyston.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Mathics (ubuntu full with Pyston)

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
pyston-version: [2.3.4]
steps:
- uses: actions/checkout@v3
- name: Set up Pyston ${{ matrix.pyston-version }}
run: |
wget https://github.com/pyston/pyston/releases/download/pyston_2.3.4/pyston_2.3.4_20.04_amd64.deb
sudo apt-get install tk8.6-blt2.5 libffi7
sudo dpkg -i pyston_2.3.4_20.04_amd64.deb
- name: Install dependencies
run: |
sudo apt-get update -qq && sudo apt-get install -qq liblapack-dev llvm-11 llvm-11-dev
# sudo /usr/lib/llvm-11/bin/llvm-config --version
sudo pyston -m pip install --upgrade pip
sudo LLVM_CONFIG=/usr/lib/llvm-11/bin/llvm-config pyston -m pip install llvmlite
- name: Install Mathics with minimal dependencies
run: |
make develop
- name: Test Mathics
run: |
# py.test seems to use always the default python interpreter of the system. Any idea about how to
# change this behaviour?
make -j3 PYTHON=pyston doctest
34 changes: 0 additions & 34 deletions .github/workflows/ubuntu.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/windows.yml

This file was deleted.

2 changes: 2 additions & 0 deletions mathics/algorithm/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,5 @@ def apply_D_to_Integral(func, domain, var, evaluation, options, head):
}
integrator_methods["Simpson"] = integrator_methods["Internal"]
integrator_methods["Automatic"] = integrator_methods["Internal"]

integrator_messages = {}
30 changes: 15 additions & 15 deletions mathics/builtin/numbers/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,18 +1285,9 @@ class _BaseFinder(Builtin):
This class is the basis class for FindRoot, FindMinimum and FindMaximum.
"""

options = {
"MaxIterations": "100",
"Method": "Automatic",
"AccuracyGoal": "Automatic",
"PrecisionGoal": "Automatic",
"StepMonitor": "None",
"EvaluationMonitor": "None",
"Jacobian": "Automatic",
}

attributes = hold_all | protected

requires = ["scipy"]
methods = {}
messages = {
"snum": "Value `1` is not a number.",
"nnum": "The function value is not a number at `1` = `2`.",
Expand All @@ -1313,7 +1304,15 @@ class _BaseFinder(Builtin):
),
}

methods = {}
options = {
"MaxIterations": "100",
"Method": "Automatic",
"AccuracyGoal": "Automatic",
"PrecisionGoal": "Automatic",
"StepMonitor": "None",
"EvaluationMonitor": "None",
"Jacobian": "Automatic",
}

def apply(self, f, x, x0, evaluation, options):
"%(name)s[f_, {x_, x0_}, OptionsPattern[]]"
Expand Down Expand Up @@ -2048,6 +2047,7 @@ class NIntegrate(Builtin):

"""

requires = ["scipy"]
summary_text = "numerical integration in one or several variables"
messages = {
"bdmtd": "The Method option should be a built-in method name.",
Expand Down Expand Up @@ -2077,6 +2077,7 @@ class NIntegrate(Builtin):
"Automatic": (None, False),
}
try:
# builtin integrators
from mathics.algorithm.integrators import (
integrator_methods,
integrator_messages,
Expand All @@ -2088,6 +2089,7 @@ class NIntegrate(Builtin):
pass

try:
# scipy integrators
from mathics.builtin.scipy_utils.integrators import (
scipy_nintegrate_methods,
scipy_nintegrate_messages,
Expand All @@ -2096,11 +2098,9 @@ class NIntegrate(Builtin):
methods.update(scipy_nintegrate_methods)
messages.update(scipy_nintegrate_messages)
except Exception as e:
print(e)
print("scipy integrators was not loaded.")
pass

methods.update(
messages.update(
{
"bdmtd": "The Method option should be a "
+ "built-in method name in {`"
Expand Down
8 changes: 6 additions & 2 deletions mathics/builtin/optiondoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,14 @@ class MaxRecursion(Builtin):
<dd>is an option for functions like NIntegrate and Plot that specifies how many recursive subdivisions can be made.
</dl>

>> NIntegrate[Exp[-10^8 x^2], {x, -1, 1}, MaxRecursion -> 10]
= 1.97519×10^-207
>> NIntegrate[Exp[-10^8 x^2], {x, -1, 1}, Method->"Internal", MaxRecursion -> 3]
= 0.0777778
>> NIntegrate[Exp[-10^8 x^2], {x, -1, 1}, Method->"Internal", MaxRecursion -> 6]
= 0.00972222
"""

# This test does not pass if scipy is not available...

summary_text = "maximum number of recursive subdivisions"


Expand Down
56 changes: 35 additions & 21 deletions mathics/doc/common_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@
test_result_map = {}


# TODO: Use this when checking requires for modules.
requires_lib_cache = {}


def check_requires_list(requires: list) -> bool:
global requires_cache

for package in requires:
lib_is_installed = requires_lib_cache.get(package, None)
if lib_is_installed is None:
lib_is_installed = True
try:
importlib.import_module(package)
except ImportError:
lib_is_installed = False
requires_lib_cache[package] = lib_is_installed

if not lib_is_installed:
return False
return True


def get_results_by_test(test_expr: str, full_test_key: list, doc_data: dict) -> list:
"""
Sometimes test numbering is off, either due to bugs or changes since the
Expand Down Expand Up @@ -665,6 +687,8 @@ def get_tests(self):
# iterated below. Probably some other code is faulty and
# when fixed the below loop and collection into doctest_list[]
# will be removed.
if not docsubsection.installed:
continue
doctest_list = []
index = 1
for doctests in docsubsection.items:
Expand Down Expand Up @@ -906,13 +930,8 @@ def add_section(
object to the chapter, a DocChapter object.
"section_object" is either a Python module or a Class object instance.
"""
installed = True
for package in getattr(section_object, "requires", []):
try:
importlib.import_module(package)
except ImportError:
installed = False
break
installed = check_requires_list(getattr(section_object, "requires", []))

# FIXME add an additional mechanism in the module
# to allow a docstring and indicate it is not to go in the
# user manual
Expand Down Expand Up @@ -949,17 +968,12 @@ def add_subsection(
operator=None,
in_guide=False,
):
installed = True
for package in getattr(instance, "requires", []):
try:
importlib.import_module(package)
except ImportError:
installed = False
break
installed = check_requires_list(getattr(instance, "requires", []))

# FIXME add an additional mechanism in the module
# to allow a docstring and indicate it is not to go in the
# user manual

if not instance.__doc__:
return
subsection = DocSubsection(
Expand Down Expand Up @@ -1058,6 +1072,8 @@ def __init__(self, module=None):
and var.__module__[: len(self.pymathicsmodule.__name__)]
== self.pymathicsmodule.__name__
): # nopep8
if not check_requires_list(var):
continue
instance = var(expression=False)
if isinstance(instance, Builtin):
self.symbols[instance.get_name()] = instance
Expand Down Expand Up @@ -1105,13 +1121,7 @@ def __init__(self, module=None):
chapter = DocChapter(builtin_part, title, XMLDoc(text))
for name in self.symbols:
instance = self.symbols[name]
installed = True
for package in getattr(instance, "requires", []):
try:
importlib.import_module(package)
except ImportError:
installed = False
break
installed = check_requires_list(getattr(instance, "requires", []))
section = DocSection(
chapter,
strip_system_prefix(name),
Expand Down Expand Up @@ -1329,8 +1339,12 @@ def get_tests(self):
# A guide section's subsection are Sections without the Guide.
# it is *their* subsections where we generally find tests.
for section in self.subsections:
if not section.installed:
continue
for subsection in section.subsections:
# FIXME we are omitting the section title here...
if not subsection.installed:
continue
for doctests in subsection.items:
yield doctests.get_tests()

Expand Down