Skip to content
Merged
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
15 changes: 8 additions & 7 deletions .github/workflows/consistency-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,28 @@ jobs:
matrix:
python-version: ['3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest setuptools
python -m pip install Mathics3-Module-Base
# Can comment out when next Mathics3 core and Mathics-scanner are released
# python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
# Until the next Mathics3-scanner release
git clone https://github.com/Mathics3/Mathics3-scanner
(cd Mathics3-scanner && pip3 install -e .[full] --no-build-isolation && bash -x ./admin-tools/make-JSON-tables.sh)
# Until the next mathics-core release
git clone https://github.com/Mathics3/mathics-core
(cd mathics-core && python -m pip install -e .[full])
(cd mathics-core && python -m pip install --no-build-isolation -e .[full])
(cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)

- name: Install Mathics3 Module nltk
run: |
python -m pip install --no-build-isolation setuptools Mathics3[full] nltk PatternLite enchant
make develop
- name: Test Mathics Consistency and Style
- name: Test Mathics3 Consistency and Style
run: |
make check-consistency-and-style
32 changes: 15 additions & 17 deletions .github/workflows/isort-and-black-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@
# Othewrwise, Black is run and its changes are committed back to the incoming pull request.
# https://github.com/cclauss/autoblack

name: isort and black
name: isort and black check
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
- uses: actions/checkout@v6
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.13
python-version: 3.14
- name: Install click, black and isort
run: pip install 'click==8.2.1' 'black==25.11.0' 'isort==5.13.2'
- name: Run isort --check .
run: isort --check .
- name: Run black --check --diff .
run: black --check --diff .
- name: If needed, commit black changes to the pull request
if: failure()
run: |
black .
git config --global user.name 'autoblack'
git config --global user.email 'rocky@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: Format Python code with Black"
git push
# - name: If needed, commit black changes to the pull request
# if: failure()
# run: |
# black .
# git config --global user.name 'autoblack'
# git config --global user.email 'rocky@users.noreply.github.com'
# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
# git checkout $GITHUB_HEAD_REF
# git commit -am "fixup: Format Python code with Black"
# git push
18 changes: 11 additions & 7 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,32 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
python-version: ['3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest setuptools
# Go over and comment out stuff when next Mathics core and Mathics-scanner are released
# Go over and comment out stuff when next Mathics core and Mathics3-scanner are released
git clone https://github.com/Mathics3/Mathics3-scanner
(cd Mathics3-scanner && pip3 install -e .[full] --no-build-isolation && bash -x ./admin-tools/make-JSON-tables.sh)
# python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
# Until the next mathics-core release
git clone https://github.com/Mathics3/mathics-core
(cd mathics-core && python -m pip install -e .[full])
(cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)
(cd mathics-core && pip3 install --no-biuild-isolation -e .[full])
(cd mathics-core && bash -x ./admin-tools/make-JSON-tables.sh)

- name: Install Mathics3 Module nltk
run: |
python -m pip install --no-build-isolation setuptools Mathics3[full] nltk PatternLite enchant
make develop
python -m pip install -e .[full] --no-build-isolation
# make develop
- name: Test Mathics3 Module nltk
run: |
make -j3 check
3 changes: 1 addition & 2 deletions pymathics/natlang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
WordDefinition,
WordList,
)
from pymathics.natlang.linguistic_data.translation import LanguageIdentify
from pymathics.natlang.manipulate import Pluralize
from pymathics.natlang.normalization import (
DeleteStopwords,
Expand All @@ -65,8 +66,6 @@
WordSimilarity,
WordStem,
)

from pymathics.natlang.linguistic_data.translation import LanguageIdentify
from pymathics.natlang.version import __version__

pymathics_version_data = {
Expand Down
4 changes: 2 additions & 2 deletions pymathics/natlang/nltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"""
nltk backend
"""

import re
from itertools import chain

import nltk
from pattern.text.en import lexeme, pluralize

from mathics.builtin.codetables import iso639_3
from mathics.core.atoms import String
from mathics.core.builtin import Builtin, MessageException
from mathics.core.evaluation import Evaluation
from mathics.core.symbols import strip_context
from pattern.text.en import lexeme, pluralize

# Don't consider this for user documentation
no_doc = True
Expand Down
1 change: 1 addition & 0 deletions pymathics/natlang/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

This module uses spacy as a backend.
"""

import itertools
from itertools import islice
from typing import Optional
Expand Down
1 change: 0 additions & 1 deletion pymathics/natlang/spacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Optional

import spacy

from mathics.core.atoms import String
from mathics.core.builtin import Builtin
from mathics.core.evaluation import Evaluation
Expand Down
1 change: 0 additions & 1 deletion pymathics/natlang/textual_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import enchant
import nltk
import spacy

from mathics.core.atoms import Integer, Real, String
from mathics.core.builtin import Builtin
from mathics.core.evaluation import Evaluation
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build-backend = "setuptools.build_meta"
name = "Mathics3-Module-nltk"
description = "Mathics3 Natural Language Toolkit module"
dependencies = [
"Mathics3>=9.0.0",
"Mathics3>9.0.0",
"Mathics3-Module-Base>=9.0.0",
"click>=8.0",
"joblib>=1.0.1",
Expand All @@ -35,7 +35,7 @@ dependencies = [
"spacy>=3.4",
"wasabi<1.1.0,>=0.8.2",
]
requires-python = ">=3.10"
requires-python = ">=3.11"
readme = "README.rst"
license = "GPL-3.0-or-later"
keywords = ["Mathematica", "Wolfram", "Interpreter", "Shell", "Math", "CAS"]
Expand All @@ -46,10 +46,10 @@ classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"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 :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering",
Expand Down