Axelrod-Python/Axelrod

Supporting Python 3.12

Closed this issue · 1 comments

setuptools is deprecated and removed in Python 3.12, so we have to either use a third party version or change how we do packaging. Right now setup.py fails because setuptools is not available in the standard library. See #1428

This link is helpful: https://gregoryszorc.com/blog/2023/10/30/my-user-experience-porting-off-setup.py/

IIUC we need to migrate from setup.py to pyproject.toml. But there are some choices that need to be made, e.g. which build tool. setuptools is still an option as a third party library but there are some changes.

Some options here: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/

Here's a rough translation to pyproject.toml

[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
dynamic = ["version"]
description = "Iterated Prisoner's Dilemma in Python"
readme = {file = "README.rst", content-type = "text/x-rst"}
license = {file = "LICENSE.txt"}
authors = [
  {name = "Vince Knight"},
  {name = "Owen Campbell"},
  {name = "Karol Langner"},
  {name = "Marc Harper"},
  {email = "axelrod-python@googlegroups.com")
]
maintainers = [
  {name = "Vince Knight"},
  {name = "Owen Campbell"},
  {name = "Marc Harper"},
  {name = "Nikoleta Glynasti"}
]
requires-python = ">= 3.8"
dependencies = [
  # dask dependencies: https://docs.dask.org/en/latest/install.html
  "cloudpickle>=0.2.2",
  "fsspec>=0.6.0",
  "toolz>=0.8.2",
  "dask>=2.9.2",
  "matplotlib>=3.0.3",
  "numpy>=1.17.4",
  "pandas>=1.0.0",
  "pyyaml>=5.1",
  "scipy>=1.3.3",
  "tqdm>=4.39.0"
]
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Intended Audience :: Developers",
  "Topic :: Software Development :: Build Tools",
  "License :: OSI Approved :: MIT License",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]

[project.optional-dependencies]
human = ["prompt-toolkit>=3.0"]
development = [
  "prompt-toolkit>=3.0",
  "hypothesis==5.19.3",
]

[project.urls]
Documentation = "https://axelrod.readthedocs.org/"
Repository = "https://github.com/Axelrod-Python/Axelrod"

It doesn't handle these lines from setup.py yet:

    include_package_data=True,
    package_data={"": ["axelrod/data/*"]},
    packages=["axelrod", "axelrod.strategies", "axelrod.data"],