Repository: mhostetter/galois (language: python)

Issue:
Support Python 3.12
Hi, I'm getting the following error while trying to install on Fedora 39 with Python 3.12.0. Is support for this Python release coming soon? Or should I switch to an older version?
```shell
pip3 install -U galois
Defaulting to user installation because normal site-packages is not writeable
Collecting galois
  Using cached galois-0.3.6-py3-none-any.whl.metadata (15 kB)
Requirement already satisfied: numpy<1.26,>=1.21.0 in /usr/lib64/python3.12/site-packages (from galois) (1.24.4)
Collecting numba<0.59,>=0.55 (from galois)
  Using cached numba-0.58.1.tar.gz (2.6 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-x2kbwjr0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-x2kbwjr0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-x2kbwjr0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-x2kbwjr0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 51, in <module>
        File "<string>", line 48, in _guard_py_ver
      RuntimeError: Cannot install on Python version 3.12.0; only versions >=3.8,<3.12 are supported.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
```


Discussion / hints:
Python 3.12 is not supported yet. We are waiting on Numba to support Python 3.12, https://github.com/numba/numba/issues/9197.

The latest supported version is Python 3.11. 

Fix patch:
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 9fc88f375..16e929e20 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -16,7 +16,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [3.7, 3.8, 3.9, '3.10', 3.11]
+        python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
     steps:
       - uses: actions/checkout@v3
 
diff --git a/pyproject.toml b/pyproject.toml
index ff9c6206c..b621d7bdd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,6 +42,7 @@ classifiers = [
     "Programming Language :: Python :: 3.9",
     "Programming Language :: Python :: 3.10",
     "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.12",
     "Topic :: Scientific/Engineering :: Mathematics",
     "Topic :: Security :: Cryptography",
     "Topic :: Software Development :: Libraries :: Python Modules",
@@ -49,8 +50,8 @@ classifiers = [
 ]
 requires-python = ">=3.7"
 dependencies = [
-    "numpy >= 1.21.0, < 1.26",    # v1.21.0 is needed for dtype support of ufuncs, see https://numpy.org/devdocs/release/1.21.0-notes.html#ufunc-signature-and-dtype-generalization-and-casting
-    "numba >= 0.55, < 0.59",      # v0.55 is needed for support of NumPy 1.21
+    "numpy >= 1.21.0, < 1.27",    # v1.21.0 is needed for dtype support of ufuncs, see https://numpy.org/devdocs/release/1.21.0-notes.html#ufunc-signature-and-dtype-generalization-and-casting
+    "numba >= 0.55, < 0.60",      # v0.55 is needed for support of NumPy 1.21
     "typing_extensions >= 4.0.0", # v4.0.0 is needed for use of Self (Python 3.11+) and Literal (Python 3.8+)
 ]
 dynamic = ["version"]
diff --git a/requirements-min.txt b/requirements-min.txt
index 4d8523cd0..92cff6149 100644
--- a/requirements-min.txt
+++ b/requirements-min.txt
@@ -1,8 +1,10 @@
+numpy==1.26.0; python_version=="3.12"
 numpy==1.23.2; python_version=="3.11"
 numpy==1.21.3; python_version=="3.10"
 numpy==1.21.0; python_version=="3.9"
 numpy==1.21.0; python_version=="3.8"
 numpy==1.21.0; python_version=="3.7"
+numba==0.59.0; python_version=="3.12"
 numba==0.57.0; python_version=="3.11"
 numba==0.55.0; python_version=="3.10"
 numba==0.55.0; python_version=="3.9"


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 2a8f6e8a1..192ecf310 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -81,7 +81,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.7, 3.8, 3.9, '3.10', 3.11]
+        python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
     runs-on: ${{ matrix.os }}
     steps:
       - uses: actions/checkout@v3
@@ -134,7 +134,7 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.7, 3.8, 3.9, '3.10', 3.11]
+        python-version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
     runs-on: ${{ matrix.os }}
     steps:
       - uses: actions/checkout@v3