From ce1b8bfb07592b5495e2cf0d236e373dffb82726 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Fri, 13 Jun 2025 12:29:09 +0100 Subject: [PATCH] Modify the pyprojetc.toml (possibly incorrectly) Hatch uses hatchling as the underlying build system. With older versions of hatchling the metadata is out of date with the expected metadata for pypi (something to do with the license file -- I'm not entirely sure what). The way to build the dist with hatch/hatchling: ``` hatch build ``` You can check the Metadata version with: ``` tar -xzf dist/axelrod-*.tar.gz cat axelrod-*/PKG-INFO | grep "Metadata-Version" ``` THIS SHOULD give you: ``` Metadata-Version: 2.4 ``` Once that's done, assuming the auth is set up correctly you publish with ``` hatch publish ``` While I was fixing all this I was changing the pyproject.toml file. We should open an issue to possibly put the license file back in and also document the release process (essentially putting some of the information I'm writing here). For other projects of mine I have setup a publish worklow so that github actions takes care of this. We could look in to doing that as well. --- pyproject.toml | 3 +-- setup.cfg | 2 -- setup.py | 53 -------------------------------------------------- 3 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 40d963607..8a94c2555 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling"] +requires = ["hatchling>=1.18.0"] build-backend = "hatchling.build" [project] @@ -7,7 +7,6 @@ name = "Axelrod" dynamic = ["version"] description = "Reproduce the Axelrod iterated prisoners dilemma tournament" readme = "README.rst" -license = {file = "LICENSE.txt"} requires-python = ">=3.6" authors = [ { name = "Vince Knight", email = "axelrod-python@googlegroups.com" }, diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2a9acf13d..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index ed16d6a98..000000000 --- a/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import pathlib -from collections import defaultdict - -from setuptools import setup - -# Read in the requirements files. -requirements = defaultdict(list) - -requirements_directory = pathlib.Path.cwd() / "requirements" -for filename in requirements_directory.glob("*.txt"): - variant = filename.stem - with filename.open() as libraries: - for library in libraries: - if len(library) > 0 and (not library.startswith("-r")): - requirements[variant].append(library.strip()) - -# Grab the default requirements -install_requires = requirements["requirements"] -# Delete the default from the dictionary for the extra variants. -del requirements["requirements"] -extras_require = dict(requirements) - -# Read in long description -with open("README.rst", "r") as f: - long_description = f.read() - -# Read in the version number -exec(open("axelrod/version.py", "r").read()) - -setup( - name="Axelrod", - version=__version__, - install_requires=install_requires, - author="Vince Knight, Owen Campbell, Karol Langner, Marc Harper", - author_email=("axelrod-python@googlegroups.com"), - packages=["axelrod", "axelrod.strategies", "axelrod.data"], - url="http://axelrod.readthedocs.org/", - license="The MIT License (MIT)", - description="Reproduce the Axelrod iterated prisoners dilemma tournament", - long_description=long_description, - long_description_content_type="text/x-rst", - include_package_data=True, - package_data={"": ["axelrod/data/*"]}, - classifiers=[ - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3 :: Only", - ], - python_requires=">=3.6", - extras_require=extras_require, -)