diff --git a/.github/workflows/consistency-checks.yml b/.github/workflows/consistency-checks.yml index 0dbf299..3884590 100644 --- a/.github/workflows/consistency-checks.yml +++ b/.github/workflows/consistency-checks.yml @@ -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 diff --git a/.github/workflows/isort-and-black-checks.yml b/.github/workflows/isort-and-black-checks.yml index 190c5fc..955df1a 100644 --- a/.github/workflows/isort-and-black-checks.yml +++ b/.github/workflows/isort-and-black-checks.yml @@ -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 diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 8fea1ac..753f0eb 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -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 diff --git a/pymathics/natlang/__init__.py b/pymathics/natlang/__init__.py index 9e8cb39..ccc6fbe 100644 --- a/pymathics/natlang/__init__.py +++ b/pymathics/natlang/__init__.py @@ -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, @@ -65,8 +66,6 @@ WordSimilarity, WordStem, ) - -from pymathics.natlang.linguistic_data.translation import LanguageIdentify from pymathics.natlang.version import __version__ pymathics_version_data = { diff --git a/pymathics/natlang/nltk.py b/pymathics/natlang/nltk.py index b17b678..405f1c3 100644 --- a/pymathics/natlang/nltk.py +++ b/pymathics/natlang/nltk.py @@ -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 diff --git a/pymathics/natlang/normalization.py b/pymathics/natlang/normalization.py index 3bb7a62..438ba18 100644 --- a/pymathics/natlang/normalization.py +++ b/pymathics/natlang/normalization.py @@ -9,6 +9,7 @@ This module uses spacy as a backend. """ + import itertools from itertools import islice from typing import Optional diff --git a/pymathics/natlang/spacy.py b/pymathics/natlang/spacy.py index 36c2403..840cb1f 100644 --- a/pymathics/natlang/spacy.py +++ b/pymathics/natlang/spacy.py @@ -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 diff --git a/pymathics/natlang/textual_analysis.py b/pymathics/natlang/textual_analysis.py index faa380e..9061ee9 100644 --- a/pymathics/natlang/textual_analysis.py +++ b/pymathics/natlang/textual_analysis.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 94f0278..ec3125d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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"] @@ -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",