From 476f16489441fae862accd6dc871ce383fdd9c41 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 27 Mar 2022 16:25:49 -0400 Subject: [PATCH] Update package metadata --- .github/workflows/test.yml | 4 +-- MANIFEST.in | 2 -- Makefile | 8 ++--- build.ps1 | 5 ++- pyproject.toml | 64 +++++++++++++++++++++++++++++++++++ release.ps1 | 4 +-- setup.cfg | 5 --- setup.py | 68 -------------------------------------- test-release | 4 +-- test-release.ps1 | 4 +-- tox.ini | 3 +- 11 files changed, 75 insertions(+), 96 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c893394..4d268f90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,15 +11,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy2", "pypy3", "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["pypy2", "pypy3", "2.7", "3.7", "3.8", "3.9", "3.10"] os: [ubuntu-latest, macos-latest, windows-latest] include: # Add new helper variables to existing jobs - {python-version: "pypy2", toxenv: "pypy"} - {python-version: "pypy3", toxenv: "pypy3"} - {python-version: "2.7", toxenv: "py27"} - - {python-version: "3.5", toxenv: "py35"} - - {python-version: "3.6", toxenv: "py36"} - {python-version: "3.7", toxenv: "py37"} - {python-version: "3.8", toxenv: "py38"} - {python-version: "3.9", toxenv: "py39"} diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 016aa76d..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include LICENSE.txt CHANGELOG.rst -recursive-include demos *.py *.bat *.sh diff --git a/Makefile b/Makefile index a0b8987c..77708462 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,6 @@ pip=$(virtualenv)/bin/pip syspython=python3.8 python=$(virtualenv)/bin/python twine=$(virtualenv)/bin/twine -version=$(shell $(python) setup.py --version) clean: ## Remove build artifacts, .pyc files, virtualenv -rm -rf build dist MANIFEST colorama.egg-info $(virtualenv) @@ -51,8 +50,8 @@ test: ## Run tests # build packages build: ## Build a release (sdist and wheel) - $(python) -m pip install --upgrade setuptools wheel - $(python) setup.py sdist bdist_wheel + $(python) -m pip install --upgrade build + $(python) -m build .PHONY: build test-release: build ## Test a built release @@ -60,6 +59,5 @@ test-release: build ## Test a built release .PHONY: test-release release: ## Upload a built release - $(twine) upload dist/colorama-$(version)*{.whl,.tar.gz} + $(twine) upload dist/colorama-*{.whl,.tar.gz} .PHONY: release - diff --git a/build.ps1 b/build.ps1 index a48e3578..bf26ebac 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,6 +1,5 @@ $ve="$HOME\.virtualenvs\colorama" $bin="$ve\Scripts" -& $bin\python.exe -m pip install --upgrade setuptools wheel -& $bin\python.exe setup.py sdist bdist_wheel - +& $bin\python.exe -m pip install --upgrade build +& $bin\python.exe -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..cf25d19f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,64 @@ +[build-system] +requires = [ + "hatchling>=0.22.0", +] +build-backend = "hatchling.build" + +[project] +name = "colorama" +description = "Cross-platform colored terminal text." +readme = "README.rst" +license = "BSD-3-Clause" +requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*" +authors = [ + { name = "Jonathan Hartley", email = "tartley@tartley.com" }, +] +keywords = [ + "ansi", + "color", + "colour", + "crossplatform", + "terminal", + "text", + "windows", + "xplatform", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Terminals", +] +dynamic = [ + "version", +] + +[project.urls] +Homepage = "https://github.com/tartley/colorama" + +[tool.hatch.version] +path = "colorama/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/colorama", + "/demos", + "/CHANGELOG.rst", +] + +[tool.hatch.build.targets.wheel] +include = [ + "/colorama/*", +] diff --git a/release.ps1 b/release.ps1 index ac4e2682..a9753bd9 100644 --- a/release.ps1 +++ b/release.ps1 @@ -1,7 +1,5 @@ $ve="$HOME\.virtualenvs\colorama" $bin="$ve\Scripts" -$version="$(& $bin\python.exe setup.py --version)" # Upload to PyPI. -& $bin\twine.exe upload dist\colorama-$version*.tar.gz dist\colorama-$version-*.whl - +& $bin\twine.exe upload dist\colorama-*.tar.gz dist\colorama-*.whl diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2e9053c0..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal = 1 - -[metadata] -license_file = LICENSE.txt diff --git a/setup.py b/setup.py deleted file mode 100644 index 4221fe1b..00000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. - -from __future__ import with_statement - -from io import open -import os -import re -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - - -NAME = 'colorama' - - -def read_file(path, encoding='ascii'): - with open(os.path.join(os.path.dirname(__file__), path), - encoding=encoding) as fp: - return fp.read() - -def _get_version_match(content): - # Search for lines of the form: # __version__ = 'ver' - regex = r"^__version__ = ['\"]([^'\"]*)['\"]" - version_match = re.search(regex, content, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - -def get_version(path): - return _get_version_match(read_file(path)) - -setup( - name=NAME, - version=get_version(os.path.join('colorama', '__init__.py')), - description='Cross-platform colored terminal text.', - long_description=read_file('README.rst'), - keywords='color colour terminal text ansi windows crossplatform xplatform', - author='Jonathan Hartley', - author_email='tartley@tartley.com', - maintainer='Arnon Yaari', - url='https://github.com/tartley/colorama', - license='BSD', - packages=[NAME], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', - # see classifiers https://pypi.org/pypi?%3Aaction=list_classifiers - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Terminals', - ] -) diff --git a/test-release b/test-release index 15812eff..3535b88b 100644 --- a/test-release +++ b/test-release @@ -15,11 +15,10 @@ set -eu -o pipefail syspython=python3.8 bin="$HOME/.virtualenvs/colorama/bin" -version=$($bin/python setup.py --version) sandbox=test-release-playground # Upload to the test PyPI. -$bin/twine upload --repository testpypi dist/colorama-$version-* \ +$bin/twine upload --repository testpypi dist/colorama-* \ || echo " > Expect a 400 if package was already uploaded." # cd elsewhere so we cannot import from local source. @@ -40,4 +39,3 @@ mkdir -p $sandbox # Tidy up rm -rf $sandbox - diff --git a/test-release.ps1 b/test-release.ps1 index 19c6967b..cfd5147c 100644 --- a/test-release.ps1 +++ b/test-release.ps1 @@ -1,10 +1,9 @@ $syspython="python3.8.exe" $ve="$HOME\.virtualenvs\colorama" $bin="$ve\Scripts" -$version="$(& $bin\python.exe setup.py --version)" # Upload to the test PyPI. -& $bin\twine.exe upload --repository testpypi dist\colorama-$version-* +& $bin\twine.exe upload --repository testpypi dist\colorama-* if(!$?) { write-host " > Expect a 400 if package was already uploaded" } @@ -27,4 +26,3 @@ print(colorama.Fore.GREEN + ""OK Colorama "" + colorama.__version__ + "" from te "@ cd .. - diff --git a/tox.ini b/tox.ini index 721d811d..179745ac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] -envlist = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3 +isolated_build = true +envlist = py27, py37, py38, py39, py310, pypy, pypy3 [testenv] deps = py27,pypy: mock