From 78996837ec609a2e4adb7ffd14df1d03ca9bc8f9 Mon Sep 17 00:00:00 2001 From: Timok Khan Date: Tue, 21 Jun 2016 22:30:34 +0200 Subject: [PATCH 01/20] Add light colors in README --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index c341ad6..9a349ac 100644 --- a/README.rst +++ b/README.rst @@ -163,6 +163,11 @@ Available formatting constants are:: ``Style.RESET_ALL`` resets foreground, background, and brightness. Colorama will perform this reset automatically on program exit. +These are fairly well supported, but not part of the standard:: + + Fore: LIGHTBLACK_EX, LIGHTRED_EX, LIGHTGREEN_EX, LIGHTYELLOW_EX, LIGHTBLUE_EX, LIGHTMAGENTA_EX, LIGHTCYAN_EX, LIGHTWHITE_EX + Back: LIGHTBLACK_EX, LIGHTRED_EX, LIGHTGREEN_EX, LIGHTYELLOW_EX, LIGHTBLUE_EX, LIGHTMAGENTA_EX, LIGHTCYAN_EX, LIGHTWHITE_EX + Cursor Positioning .................. From 788106f7c4d0e4e18e52964b0271a070843819dd Mon Sep 17 00:00:00 2001 From: Max Tilley <1138504+3tilley@users.noreply.github.com> Date: Thu, 28 Oct 2021 23:56:57 +0100 Subject: [PATCH 02/20] Detached stream fix --- colorama/ansitowin32.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/colorama/ansitowin32.py b/colorama/ansitowin32.py index 6039a05..5286b22 100644 --- a/colorama/ansitowin32.py +++ b/colorama/ansitowin32.py @@ -57,7 +57,9 @@ def closed(self): stream = self.__wrapped try: return stream.closed - except AttributeError: + # AttributeError in the case that the stream doesn't support being closed + # ValueError for the case that the stream has already been detached when atexit runs + except (AttributeError, ValueError): return True From 8a364bd03c68e42e5b7f5a908b2030e50d153b7b Mon Sep 17 00:00:00 2001 From: Max Tilley <1138504+3tilley@users.noreply.github.com> Date: Fri, 29 Oct 2021 19:56:51 +0100 Subject: [PATCH 03/20] Added test --- colorama/tests/ansitowin32_test.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/colorama/tests/ansitowin32_test.py b/colorama/tests/ansitowin32_test.py index bbe99f4..bbc647b 100644 --- a/colorama/tests/ansitowin32_test.py +++ b/colorama/tests/ansitowin32_test.py @@ -1,5 +1,5 @@ # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. -from io import StringIO +from io import StringIO, TextIOWrapper from unittest import TestCase, main try: @@ -40,6 +40,17 @@ def testProxyNoContextManager(self): with StreamWrapper(mockStream, mockConverter) as wrapper: wrapper.write('hello') + def test_closed_shouldnt_raise_on_closed_stream(self): + stream = StringIO() + stream.close() + wrapper = StreamWrapper(stream, None) + self.assertEqual(wrapper.closed, True) + + def test_closed_shouldnt_raise_on_detached_stream(self): + stream = TextIOWrapper(StringIO()) + stream.detach() + wrapper = StreamWrapper(stream, None) + self.assertEqual(wrapper.closed, True) class AnsiToWin32Test(TestCase): From 8ba396b33d3655386cbdbbc6effc0d263c70371b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 16 Nov 2021 16:02:20 +0200 Subject: [PATCH 04/20] Replace deprecated pypyX with pypy-X.Y --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c89339..eefd55c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,12 +11,12 @@ 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: ["pypy-2.7", "pypy-3.8", "2.7", "3.5", "3.6", "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: "pypy-2.7", toxenv: "pypy"} + - {python-version: "pypy-3.8", toxenv: "pypy3"} - {python-version: "2.7", toxenv: "py27"} - {python-version: "3.5", toxenv: "py35"} - {python-version: "3.6", toxenv: "py36"} From 35e9a91732a3d9e61cbafa5c843c2db1eab66e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Tue, 29 Mar 2022 08:46:31 +0200 Subject: [PATCH 05/20] Add methods to ``StreamWrapper`` to allow better pickling --- CHANGELOG.rst | 1 + colorama/ansitowin32.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 83fc7f2..9034e50 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,7 @@ * Fix some tests that were failing on some operating systems. * Add support for Python 3.9. * Add support for PyPy3. + * Add support for pickling with the ``dill`` module. 0.4.4 Current release * Re-org of README, to put the most insteresting parts near the top. * Added Linux makefile targets and Windows powershell scripts to diff --git a/colorama/ansitowin32.py b/colorama/ansitowin32.py index 6039a05..19291a0 100644 --- a/colorama/ansitowin32.py +++ b/colorama/ansitowin32.py @@ -37,6 +37,12 @@ def __enter__(self, *args, **kwargs): def __exit__(self, *args, **kwargs): return self.__wrapped.__exit__(*args, **kwargs) + def __setstate__(self, state): + self.__dict__ = state + + def __getstate__(self): + return self.__dict__ + def write(self, text): self.__convertor.write(text) From e86623096b5b14b20c59129830bb84d53596ecfb Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Tue, 14 Jun 2022 15:20:05 -0500 Subject: [PATCH 06/20] Release checklist includes '.candidate' releases I had intended that adding this might remove the need to do releases to test.pypi.org, but that is fully automated, so running that command on each release doen't seem like a burden. --- README-hacking.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/README-hacking.md b/README-hacking.md index b7c9396..628b7ef 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -66,10 +66,11 @@ target. ## Release checklist -TODO: Add the use of release candidate versions to this checklist. - 1. Check the CHANGELOG is updated with everything since the last release. -2. Remove the '-pre' suffix from `__version__` in `colorama/__init.py__.py`. + +2. First we'll make a candidate release. Ensure the '-candidate1' suffix is + present on `__version__` in `colorama/__init.py__.py`. + 3. Run the tests locally on your preferred OS, just to save you from doing the following time-consuming steps while there are still obvious problems in the code: @@ -93,8 +94,8 @@ TODO: Add the use of release candidate versions to this checklist. .\test-release.ps1` * Linux: `make clean bootstrap build test-release` - (This currently only tests the wheel, but - [should soon test the sdist too](https://github.com/tartley/colorama/issues/286).) + (This currently only tests the wheel, but + [should soon test the sdist too](https://github.com/tartley/colorama/issues/286).) 7. Check the [CI builds](https://github.com/tartley/colorama/actions/) are complete and all passing. @@ -113,6 +114,18 @@ TODO: Add the use of release candidate versions to this checklist. git tag -a -m "" $version git push --follow-tags -10. Bump the version number in `colorama/__init__.py`, and add the '-pre' +10. Test by installing the candidate version from PyPI, and sanity check it with + 'demo.sh', making sure this is running against the PyPI installation, not + local source. + +11. Maybe wait a day for anyone using pre-release installs to report any + problems? + +12. Remove the '.candidateX' suffix from `__version__` in + `colorama/__init__.py`. + +13. Repeat steps 5 to 10, for the actual (non-candidate) release. + +14. Bump the version number in `colorama/__init__.py`, and add the '-pre' suffix again, ready for the next release. Commit and push this (directly to master is fine.) From 6105ab364ee0bafbbbebf3bab3ab6497a5480f25 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Tue, 14 Jun 2022 18:32:49 -0500 Subject: [PATCH 07/20] Mention fixed ValueError at exit in CHANGELOG --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9034e50..2d028f6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,5 @@ 0.4.5 In progress, unreleased + * Catch a racy ValueError that could occur on exit. * Create README-hacking.md, for Colorama contributors. * Tweak some README unicode characters that don't render correctly on PyPI. * Fix some tests that were failing on some operating systems. From c29f133adde3ada0e374e92f8b06e30fb5a264c3 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Wed, 15 Jun 2022 11:02:54 -0500 Subject: [PATCH 08/20] tweaks for build process --- README-hacking.md | 12 +++++++++--- bootstrap.ps1 | 2 +- clean.ps1 | 2 +- colorama/__init__.py | 2 +- test-release | 2 +- test-release.ps1 | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README-hacking.md b/README-hacking.md index 628b7ef..242f517 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -75,8 +75,14 @@ target. the following time-consuming steps while there are still obvious problems in the code: - * Windows: `./test.ps1` - * Linux: `make test` + * Windows: + * First allow powershell to execute scripts, see: + https://stackoverflow.com/a/32328091 + * `powershell bootstrap.ps1` + * `powershell test.ps1` + * Linux: + * `make bootstrap` + * `make test` 4. Verify you're all committed, merged to master, and pushed to origin (This triggers a CI build, which we'll check later on) @@ -90,7 +96,7 @@ target. HTTP 400 response on uploading to test.pypi.org, but outputs a message saying this is expected and carries on: - * Windows: `./clean.ps1 && .\bootstrap.ps1 && .\build.ps1 && + * Windows: `.\clean.ps1 && .\bootstrap.ps1 && .\build.ps1 && .\test-release.ps1` * Linux: `make clean bootstrap build test-release` diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 3260f8b..53ba331 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -1,4 +1,4 @@ -$syspython="python3.8.exe" +$syspython="python.exe" $ve="$HOME\.virtualenvs\colorama" $bin="$ve\Scripts" diff --git a/clean.ps1 b/clean.ps1 index de9ba5a..a2a59af 100644 --- a/clean.ps1 +++ b/clean.ps1 @@ -1,4 +1,4 @@ -$syspython="python3.8.exe" +$syspython="python.exe" $ve="$HOME\.virtualenvs\colorama" remove-item -r -fo * -I build,dist,MANIFEST,colorama.egg-info,$ve,sandbox diff --git a/colorama/__init__.py b/colorama/__init__.py index 641fd6f..918a1fe 100644 --- a/colorama/__init__.py +++ b/colorama/__init__.py @@ -3,4 +3,4 @@ from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.5-pre' +__version__ = '0.4.5rc1' diff --git a/test-release b/test-release index 15812ef..2965304 100644 --- a/test-release +++ b/test-release @@ -13,7 +13,7 @@ # Exit on error set -eu -o pipefail -syspython=python3.8 +syspython=python3 bin="$HOME/.virtualenvs/colorama/bin" version=$($bin/python setup.py --version) sandbox=test-release-playground diff --git a/test-release.ps1 b/test-release.ps1 index 19c6967..950dfda 100644 --- a/test-release.ps1 +++ b/test-release.ps1 @@ -1,4 +1,4 @@ -$syspython="python3.8.exe" +$syspython="python.exe" $ve="$HOME\.virtualenvs\colorama" $bin="$ve\Scripts" $version="$(& $bin\python.exe setup.py --version)" From 0f5c36f4780ff2244c1507dd9986928f5f7da7f3 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Wed, 15 Jun 2022 11:32:31 -0500 Subject: [PATCH 09/20] Further tweaks made to support the release * Add executable flag to the test-release script. * Further refinements of the release checklist * Fix makefile globbing which didn't find the sdist --- Makefile | 2 +- README-hacking.md | 24 +++++++++++------------- test-release | 2 +- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index a0b8987..924a1b6 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,6 @@ 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-$(version)* .PHONY: release diff --git a/README-hacking.md b/README-hacking.md index 242f517..a902604 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -87,12 +87,19 @@ target. 4. Verify you're all committed, merged to master, and pushed to origin (This triggers a CI build, which we'll check later on) -5. Build the distributables (sdist and wheel), on either OS: +5. Tag the current commit with the `__version__` from `colorama/__init__.py`. + We should start using + [annotated tags for releases](https://www.tartley.com/posts/til-git-annotated-tags/), so: + + git tag -a -m "" $version + git push --follow-tags + +6. Build the distributables (sdist and wheel), on either OS: * Windows: `.\build.ps1` * Linux: `make build` -6. Test the distributables on both OS. Whichever one you do 2nd will get an +7. Test the distributables on both OS. Whichever one you do 2nd will get an HTTP 400 response on uploading to test.pypi.org, but outputs a message saying this is expected and carries on: @@ -103,23 +110,14 @@ target. (This currently only tests the wheel, but [should soon test the sdist too](https://github.com/tartley/colorama/issues/286).) -7. Check the [CI builds](https://github.com/tartley/colorama/actions/) +8. Check the [CI builds](https://github.com/tartley/colorama/actions/) are complete and all passing. -8. Upload the distributables to PyPI: +9. Upload the distributables to PyPI: * On Windows: `.\release.ps1` * On Linux: `make release` - This [should soon tag the release for you](https://github.com/tartley/colorama/issues/282). Until then: - -9. Tag the current commit with the `__version__` from `colorama/__init__.py`. - We should start using - [annotated tags for releases](https://www.tartley.com/posts/til-git-annotated-tags/), so: - - git tag -a -m "" $version - git push --follow-tags - 10. Test by installing the candidate version from PyPI, and sanity check it with 'demo.sh', making sure this is running against the PyPI installation, not local source. diff --git a/test-release b/test-release index 2965304..d22eec1 100644 --- a/test-release +++ b/test-release @@ -19,7 +19,7 @@ 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-$version* \ || echo " > Expect a 400 if package was already uploaded." # cd elsewhere so we cannot import from local source. From 372c486ecd756833b0e9c393cf55343a81cc39f8 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Wed, 15 Jun 2022 11:55:51 -0500 Subject: [PATCH 10/20] Omit demo06 from demos.sh It is too visually disruptive, making it hard to see whether any of the demos are working properly --- demos/demo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/demos/demo.sh b/demos/demo.sh index d8cbbcc..eb05b07 100644 --- a/demos/demo.sh +++ b/demos/demo.sh @@ -27,8 +27,9 @@ rm -f demo04.out # Demonstrate the difference between colorama initialized with wrapping on and off. python demo05.py -# Demonstrate printing colored, random characters at random positions on the screen -python demo06.py +# Skip demo06 +# It is too visually disruptive, +# making it hard to see whether any of the demos are working correctly. # Demonstrate cursor relative movement: UP, DOWN, FORWARD, and BACK in colorama.CURSOR python demo07.py From f411cb9e62a3f9beaf22ac9fbaf80f3a66ea4898 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Wed, 15 Jun 2022 22:18:36 -0500 Subject: [PATCH 11/20] Release checklist: no need to rebuild --- README-hacking.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README-hacking.md b/README-hacking.md index a902604..1213aa4 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -103,9 +103,8 @@ target. HTTP 400 response on uploading to test.pypi.org, but outputs a message saying this is expected and carries on: - * Windows: `.\clean.ps1 && .\bootstrap.ps1 && .\build.ps1 && - .\test-release.ps1` - * Linux: `make clean bootstrap build test-release` + * Windows: `.\test-release.ps1` + * Linux: `make test-release` (This currently only tests the wheel, but [should soon test the sdist too](https://github.com/tartley/colorama/issues/286).) From f8ab4fd9e8494d7208d669df5c2d5e3d59439643 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Thu, 16 Jun 2022 07:17:02 -0500 Subject: [PATCH 12/20] version bump 0.4.5 --- colorama/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorama/__init__.py b/colorama/__init__.py index 918a1fe..9138a8c 100644 --- a/colorama/__init__.py +++ b/colorama/__init__.py @@ -3,4 +3,4 @@ from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.5rc1' +__version__ = '0.4.5' From 2c1210db1023b44b02cf894c85377eae237f66c2 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Thu, 16 Jun 2022 07:35:28 -0500 Subject: [PATCH 13/20] Add voodoo sleep to test-release script --- test-release | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test-release b/test-release index d22eec1..c09a056 100644 --- a/test-release +++ b/test-release @@ -30,6 +30,11 @@ mkdir -p $sandbox # Create a temporary disposable virtualenv. $syspython -m venv --clear venv + # voodoo sleep. I saw the following install fail, due to expected version + # not being listed at test.pypi.org, but then a few seconds later, re-run + # manually. it worked fine. + sleep 5 + # Install the package we just uploaded. # (--extra-index-url for this project's requirements) venv/bin/python -m pip --quiet install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple colorama==$version From da57715a05c64134d067cd1f8d4203fbd6ddf0eb Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Thu, 16 Jun 2022 07:43:05 -0500 Subject: [PATCH 14/20] bump to dev1 version suffix And clarify this step in the release checklist --- README-hacking.md | 11 ++++++++--- colorama/__init__.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README-hacking.md b/README-hacking.md index 1213aa4..fa6ffd0 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -129,6 +129,11 @@ target. 13. Repeat steps 5 to 10, for the actual (non-candidate) release. -14. Bump the version number in `colorama/__init__.py`, and add the '-pre' - suffix again, ready for the next release. Commit and push this (directly to - master is fine.) +14. Bump the version number in `colorama/__init__.py`, and add a 'dev1' + suffix, eg: + + `0.4.5dev1` + + so that any build artifacts created are clearly labelled as not a real + release. Commit and push this (directly to master is fine.) + diff --git a/colorama/__init__.py b/colorama/__init__.py index 9138a8c..518ac80 100644 --- a/colorama/__init__.py +++ b/colorama/__init__.py @@ -3,4 +3,4 @@ from .ansi import Fore, Back, Style, Cursor from .ansitowin32 import AnsiToWin32 -__version__ = '0.4.5' +__version__ = '0.4.6dev1' From b4fe4c2468612979f468056d1f73566a414f47bf Mon Sep 17 00:00:00 2001 From: Arnon Yaari Date: Fri, 17 Jun 2022 16:47:15 +0300 Subject: [PATCH 15/20] Update changelog and release process --- CHANGELOG.rst | 4 ++-- README-hacking.md | 7 ++++--- test-release | 0 3 files changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 test-release diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2d028f6..9d1e3cd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,4 @@ -0.4.5 In progress, unreleased +0.4.5 Current release * Catch a racy ValueError that could occur on exit. * Create README-hacking.md, for Colorama contributors. * Tweak some README unicode characters that don't render correctly on PyPI. @@ -6,7 +6,7 @@ * Add support for Python 3.9. * Add support for PyPy3. * Add support for pickling with the ``dill`` module. -0.4.4 Current release +0.4.4 * Re-org of README, to put the most insteresting parts near the top. * Added Linux makefile targets and Windows powershell scripts to automate bootstrapping a development environment, and automate the diff --git a/README-hacking.md b/README-hacking.md index fa6ffd0..21fab3e 100644 --- a/README-hacking.md +++ b/README-hacking.md @@ -67,8 +67,10 @@ target. ## Release checklist 1. Check the CHANGELOG is updated with everything since the last release. + Update CHANGELOG.rst with the new release version (move the comment for + "Current release") -2. First we'll make a candidate release. Ensure the '-candidate1' suffix is +2. First we'll make a candidate release. Ensure the '.rc1' suffix is present on `__version__` in `colorama/__init.py__.py`. 3. Run the tests locally on your preferred OS, just to save you from doing @@ -124,7 +126,7 @@ target. 11. Maybe wait a day for anyone using pre-release installs to report any problems? -12. Remove the '.candidateX' suffix from `__version__` in +12. Remove the '.rcX' suffix from `__version__` in `colorama/__init__.py`. 13. Repeat steps 5 to 10, for the actual (non-candidate) release. @@ -136,4 +138,3 @@ target. so that any build artifacts created are clearly labelled as not a real release. Commit and push this (directly to master is fine.) - diff --git a/test-release b/test-release old mode 100644 new mode 100755 From ddf34ea86515138544615edb267971f65db8bacc Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 27 Mar 2022 16:25:49 -0400 Subject: [PATCH 16/20] 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 mode change 100755 => 100644 test-release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eefd55c..68074ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,15 +11,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy-2.7", "pypy-3.8", "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + python-version: ["pypy-2.7", "pypy-3.8", "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: "pypy-2.7", toxenv: "pypy"} - {python-version: "pypy-3.8", 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 016aa76..0000000 --- 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 924a1b6..7770846 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)* + $(twine) upload dist/colorama-*{.whl,.tar.gz} .PHONY: release - diff --git a/build.ps1 b/build.ps1 index a48e357..bf26eba 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 0000000..cf25d19 --- /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 ac4e268..a9753bd 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 2e9053c..0000000 --- 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 4221fe1..0000000 --- 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 old mode 100755 new mode 100644 index c09a056..e89d5da --- a/test-release +++ b/test-release @@ -15,11 +15,10 @@ set -eu -o pipefail syspython=python3 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. @@ -45,4 +44,3 @@ mkdir -p $sandbox # Tidy up rm -rf $sandbox - diff --git a/test-release.ps1 b/test-release.ps1 index 950dfda..e9af4a8 100644 --- a/test-release.ps1 +++ b/test-release.ps1 @@ -1,10 +1,9 @@ $syspython="python.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 721d811..179745a 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 From 72ffc4634affdec406ff7a7ebcc64e2558b4a8e8 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Tue, 14 Jun 2022 14:30:18 -0400 Subject: [PATCH 17/20] Pin for Python 2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cf25d19..931362d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "hatchling>=0.22.0", + "hatchling==0.22.0", ] build-backend = "hatchling.build" From d4fc1f03606f746d29a303da96cb4624c05d73b7 Mon Sep 17 00:00:00 2001 From: Jonathan Hartley Date: Tue, 14 Jun 2022 15:13:55 -0500 Subject: [PATCH 18/20] Comment the reversion required when dropping Py2.7 --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 931362d..4a7d46d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires = [ + # When dropping Python2.7, revert to "hatchling>=0.22.0" "hatchling==0.22.0", ] build-backend = "hatchling.build" From ae087c93d1c0c46e2d54642dbaabeb22a35217ff Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Tue, 14 Jun 2022 18:32:27 -0400 Subject: [PATCH 19/20] fix Windows --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4a7d46d..7f53978 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,6 @@ [build-system] requires = [ - # When dropping Python2.7, revert to "hatchling>=0.22.0" - "hatchling==0.22.0", + "hatchling>=0.25.1", ] build-backend = "hatchling.build" From 0086cc645e2df1fb4557698c59b1d0bcca7aad36 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 19 Jun 2022 11:55:14 -0400 Subject: [PATCH 20/20] address --- Makefile | 3 +-- README.rst | 2 +- requirements-dev.txt | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7770846..d56a3f7 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ test: ## Run tests # build packages build: ## Build a release (sdist and wheel) - $(python) -m pip install --upgrade build $(python) -m build .PHONY: build @@ -59,5 +58,5 @@ test-release: build ## Test a built release .PHONY: test-release release: ## Upload a built release - $(twine) upload dist/colorama-*{.whl,.tar.gz} + $(twine) upload dist/colorama-* .PHONY: release diff --git a/README.rst b/README.rst index 9a349ac..fb0b75f 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,7 @@ If you find Colorama useful, please |donate| to the authors. Thank you! Installation ------------ -Tested on CPython 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 and 3.10 and Pypy 2.7 and 3.6. +Tested on CPython 2.7, 3.7, 3.8, 3.9 and 3.10 and Pypy 2.7 and 3.8. No requirements other than the standard library. diff --git a/requirements-dev.txt b/requirements-dev.txt index dae7e97..f52af22 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ mock>=1.0.1;python_version<"3.3" twine>=3.1.1 +build -e .