From 9fd88bcc3d58d7d9fee3cb76a6142ee307fce394 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Sun, 31 Dec 2023 13:12:23 +0000 Subject: [PATCH] Test types on 3.7 as well --- .github/workflows/CI.yml | 20 +++++++++++++++----- pysr/export_latex.py | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8368264a8..468dc9029 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -162,7 +162,10 @@ jobs: shell: bash -l {0} strategy: matrix: - python-version: ['3.11'] + python-version: + - '3.11' + - '3.7' + os: ['ubuntu-latest'] steps: - uses: actions/checkout@v3 @@ -174,8 +177,15 @@ jobs: - name: "Install PySR and all dependencies" run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install mypy jax jaxlib torch - python setup.py install + python -m pip install -r requirements.txt + python -m pip install mypy + python -m pip install . + - name: "Install additional dependencies" + run: python -m pip install jax jaxlib torch + if: ${{ matrix.python-version != '3.7' }} - name: "Run mypy" - run: mypy --install-types --non-interactive pysr + run: python -m mypy --install-types --non-interactive pysr + if: ${{ matrix.python-version != '3.7' }} + - name: "Run compatible mypy" + run: python -m mypy --ignore-missing-imports pysr + if: ${{ matrix.python-version == '3.7' }} diff --git a/pysr/export_latex.py b/pysr/export_latex.py index 0316f872a..cbe1d7e44 100644 --- a/pysr/export_latex.py +++ b/pysr/export_latex.py @@ -23,7 +23,7 @@ def sympy2latex(expr, prec=3, full_prec=True, **settings) -> str: """Convert sympy expression to LaTeX with custom precision.""" settings["full_prec"] = full_prec printer = PreciseLatexPrinter(settings=settings, prec=prec) - return printer.doprint(expr) + return str(printer.doprint(expr)) def generate_table_environment(