Skip to content

Commit 3c7b46f

Browse files
authored
Merge pull request #884 from MilesCranmer/compat-3.8
Compat with older Python
2 parents 0465b49 + ab0afe9 commit 3c7b46f

15 files changed

Lines changed: 44 additions & 11 deletions

.github/workflows/CI.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ jobs:
4141
python-version: '3.12'
4242
os: ubuntu-latest
4343
test-id: include
44+
- julia-version: '1'
45+
python-version: '3.8'
46+
os: ubuntu-latest
47+
test-id: include
4448

4549
steps:
4650
- uses: actions/checkout@v4

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
description = "Simple and efficient symbolic regression"
1212
readme = {file = "README.md", content-type = "text/markdown"}
1313
license = {file = "LICENSE"}
14-
requires-python = ">=3.10"
14+
requires-python = ">=3.8"
1515
classifiers = [
1616
"Programming Language :: Python :: 3",
1717
"Operating System :: OS Independent",
@@ -39,7 +39,7 @@ dev = [
3939
"mypy>=1,<2",
4040
"nbval>=0.11,<0.12",
4141
"pandas-stubs",
42-
"pre-commit>=3.7,<5",
42+
"pre-commit>=3.0,<5",
4343
"pytest-cov>=5,<7",
4444
"pytest>=8,<9",
4545
"tensorboard>=2,<3",

pysr/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import logging
24
import os
35

pysr/denoising.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Functions for denoising data during preprocessing."""
22

3+
from __future__ import annotations
4+
35
from typing import cast
46

57
import numpy as np

pysr/export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import copy
24
from collections.abc import Callable
35

pysr/export_latex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Functions to help export PySR equations to LaTeX."""
22

3+
from __future__ import annotations
4+
35
import pandas as pd
46
import sympy # type: ignore
57
from sympy.printing.latex import LatexPrinter # type: ignore

pysr/export_numpy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Code for exporting discovered expressions to numpy"""
22

3+
from __future__ import annotations
4+
35
import warnings
46

57
import numpy as np

pysr/export_sympy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Define utilities to export to sympy"""
22

3+
from __future__ import annotations
4+
35
from collections.abc import Callable
46

57
import sympy # type: ignore

pysr/expression_specs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from __future__ import annotations
2+
13
import copy
24
from abc import ABC, abstractmethod
35
from textwrap import dedent
4-
from typing import TYPE_CHECKING, Any, NewType, TypeAlias, overload
6+
from typing import TYPE_CHECKING, Any, NewType, overload
57

68
import numpy as np
79
import pandas as pd
@@ -10,6 +12,11 @@
1012
from .julia_helpers import jl_array
1113
from .julia_import import AnyValue, SymbolicRegression, jl
1214

15+
try:
16+
from typing import TypeAlias
17+
except ImportError:
18+
from typing_extensions import TypeAlias
19+
1320
# For type checking purposes
1421
if TYPE_CHECKING:
1522
from .sr import PySRRegressor # pragma: no cover

pysr/feature_selection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Functions for doing feature selection during preprocessing."""
22

3+
from __future__ import annotations
4+
35
import logging
46
from typing import cast
57

0 commit comments

Comments
 (0)