From faafef8e3cbd2f95d54e4315a79e9027c83f9bb5 Mon Sep 17 00:00:00 2001
From: Timok Khan
Date: Tue, 21 Jun 2016 22:30:34 +0200
Subject: [PATCH 01/45] Add light colors in README
---
README.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/README.rst b/README.rst
index db046c4e..85d6d7a8 100644
--- a/README.rst
+++ b/README.rst
@@ -143,6 +143,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 dc8460c2417d8d87e4e9505b2a09e9a00a930a2a Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Mon, 12 Oct 2020 16:42:27 -0500
Subject: [PATCH 02/45] Make tests pass on all OS.
These were failing for me when run on Windows.
But passed on Linux.
Now they pass everywhere.
---
colorama/tests/ansitowin32_test.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/colorama/tests/ansitowin32_test.py b/colorama/tests/ansitowin32_test.py
index 99ebd292..bbe99f47 100644
--- a/colorama/tests/ansitowin32_test.py
+++ b/colorama/tests/ansitowin32_test.py
@@ -170,13 +170,19 @@ def test_reset_all_shouldnt_raise_on_closed_orig_stdout(self):
def test_wrap_shouldnt_raise_on_closed_orig_stdout(self):
stream = StringIO()
stream.close()
- converter = AnsiToWin32(stream)
- self.assertFalse(converter.strip)
+ with \
+ patch("colorama.ansitowin32.os.name", "nt"), \
+ patch("colorama.ansitowin32.winapi_test", lambda: True):
+ converter = AnsiToWin32(stream)
+ self.assertTrue(converter.strip)
self.assertFalse(converter.convert)
def test_wrap_shouldnt_raise_on_missing_closed_attr(self):
- converter = AnsiToWin32(object())
- self.assertFalse(converter.strip)
+ with \
+ patch("colorama.ansitowin32.os.name", "nt"), \
+ patch("colorama.ansitowin32.winapi_test", lambda: True):
+ converter = AnsiToWin32(object())
+ self.assertTrue(converter.strip)
self.assertFalse(converter.convert)
def testExtractParams(self):
From 688f6cce767fabe8baf8de8847aa689247184a49 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 13:47:50 -0500
Subject: [PATCH 03/45] Unicode README chars that don't render on PyPI
---
README.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.rst b/README.rst
index 13d0f1ac..8e51e9f0 100644
--- a/README.rst
+++ b/README.rst
@@ -20,8 +20,8 @@ cursor positioning) work under MS Windows.
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2MZ9D2GMLYCUJ&item_name=Colorama¤cy_code=USD
:alt: Donate with Paypal
-`PyPI for releases `_ ·
-`Github for source `_ ·
+`PyPI for releases `_ |
+`Github for source `_ |
`Colorama for enterprise on Tidelift `_
If you find Colorama useful, please |donate| to the authors. Thank you!
From 24721c0ce6fe0e9d23b9538c2dec5dfbf05293eb Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 22:30:54 -0500
Subject: [PATCH 04/45] Belated CHANGELOG entries for 0.4.4 release
---
CHANGELOG.rst | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index f88f449b..f2329072 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,20 @@
+0.4.5
+ Work in progress
+ * Tweak some README unicode characters that don't render correctly on PyPI.
+ * Fix some tests that were failing on some operating systems.
+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
+ automate bootstrapping a development environment, and automate the
+ process of testing wheels before they are uploaded to PyPI.
+ * Use stdlib unittest.mock where available
+ * Travis CI now also builds on arm64
+ * Demo06 demonstrates existing cursor positioning feature
+ * Fix OSC regex & handling to prevent hang or crash
+ * Document enterprise support by Tidelift
0.4.3
* Fix release 0.4.2 which was uploaded with missing files.
-0.4.2
+0.4.2 BROKEN DO NOT USE
* #228: Drop support for EOL Python 3.4, and add 3.7 and 3.8.
Thanks to hugovk.
* Several additions and fixes to documentation and metadata.
From b7596ad6d614108af038b7ecb4c8b4dfc0e6c717 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:13:19 -0500
Subject: [PATCH 05/45] Fix Changelog markup
---
CHANGELOG.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index f2329072..480421d5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,5 +1,5 @@
-0.4.5
- Work in progress
+0.4.5 In progress, unreleased
+ * 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.
0.4.4 Current release
From 759d5c767f0aca4a458f01ba1a0a1441ad377e94 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:13:42 -0500
Subject: [PATCH 06/45] Bump to version 0.4.5-pre
---
colorama/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/colorama/__init__.py b/colorama/__init__.py
index b149ed79..641fd6fc 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.4'
+__version__ = '0.4.5-pre'
From f7efb11d75ba275f1fca3b791378f871e4dd0125 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:14:22 -0500
Subject: [PATCH 07/45] Fix Makefile PHONY declaration
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 53682844..5f6faf75 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ test: ## Run tests
build: ## Build an sdist and wheel
$(python) -m pip install --upgrade setuptools wheel
$(python) setup.py sdist bdist_wheel
-.PHONY: sdist
+.PHONY: build
test-release: build
./test-release
From 5a393b23f25e8802111145190343fc9206489a48 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:15:09 -0500
Subject: [PATCH 08/45] Move contributing info to README-hacking.md
Also add a release checklist
---
README-hacking.md | 46 +++++++++++++++++++++++++++++++++++++++++
README.rst | 52 +++++++----------------------------------------
2 files changed, 53 insertions(+), 45 deletions(-)
create mode 100644 README-hacking.md
diff --git a/README-hacking.md b/README-hacking.md
new file mode 100644
index 00000000..cd70470d
--- /dev/null
+++ b/README-hacking.md
@@ -0,0 +1,46 @@
+# Colorama Development
+
+Help and fixes are welcome!
+
+Although Colorama has no requirements other than the Python standard library,
+development requires some Python packages, which are captured in
+requirements-dev.txt.
+
+Some common commands are captured as Linux makefile targets (which could
+perhaps be coaxed into running on OSX in Bash), and as Windows Powershell
+scripts.
+
+| Task | Linux | Windows |
+|---------------------------------|---------------------|----------------------|
+| Create & populate virtualenv. | `make bootstrap` | `.\bootstrap.ps1` |
+| Run tests. | `make test` | `.\test.ps1` |
+| Build a wheel. | `make build` | `.\build.ps1` |
+| Test the wheel. | `make test-release` | `.\test-release.ps1` |
+| Release the wheel on PyPI | `make release` | `.\release.ps1` |
+| Clean generated files & builds. | `make clean` | `.\clean.ps1` |
+
+The Makefile is self-documenting, so 'make' with no args will describe each
+target.
+
+If you use nose to run the tests, you must pass the ``-s`` flag; otherwise,
+``nosetests`` applies its own proxy to ``stdout``, which confuses the unit
+tests.
+
+## Release checklist
+
+1. Merge to master.
+2. Run the tests.
+3. Update the CHANGELOG.
+4. Remove the '-pre' suffix from `__version__` in `colorama/__init.py__.py`.
+5. * On Windows: `./clean.ps1 && .\bootstrap.ps1 && .\build.ps1 && .\test-release.ps1`
+ * On Linux: `make clean bootstrap build test-release`
+ * On OSX: View the makefile and manually run the equivalent commands for
+ each target. PR to automate this welcome!
+6. If all is well:
+ * On Windwos: `.\release.psq`
+ * On Linux: `make release`
+ This will upload the built package to PyPI, tag the current commit with the
+ version, and push the tag.
+7. Bump the version number in `colorama/__init__.py`, ready for the next
+ release, and add the '-pre' suffix again.
+
diff --git a/README.rst b/README.rst
index a8c8f7d4..1f52b09d 100644
--- a/README.rst
+++ b/README.rst
@@ -10,6 +10,7 @@
:target: https://travis-ci.org/tartley/colorama
:alt: Build Status
+
Colorama
========
@@ -30,6 +31,10 @@ If you find Colorama useful, please |donate| to the authors. Thank you!
Installation
------------
+Tested on CPython 2.7, 3.5, 3.6, 3.7 and 3.8.
+
+No requirements other than the standard library.
+
.. code-block:: bash
pip install colorama
@@ -296,6 +301,8 @@ I'd love to hear about it on that issues list, would be delighted by patches,
and would be happy to grant commit access to anyone who submits a working patch
or two.
+If you're hacking on the code, see [README-hacking.md](README-hacking.md)
+
License
-------
@@ -304,51 +311,6 @@ Copyright Jonathan Hartley & Arnon Yaari, 2013-2020. BSD 3-Clause license; see
LICENSE file.
-Development
------------
-
-Help and fixes welcome!
-
-Tested on CPython 2.7, 3.5, 3.6, 3.7 and 3.8.
-
-No requirements other than the standard library.
-Development requirements are captured in requirements-dev.txt.
-
-To create and populate a virtual environment::
-
- ./bootstrap.ps1 # Windows
- make bootstrap # Linux
-
-To run tests::
-
- ./test.ps1 # Windows
- make test # Linux
-
-If you use nose to run the tests, you must pass the ``-s`` flag; otherwise,
-``nosetests`` applies its own proxy to ``stdout``, which confuses the unit
-tests.
-
-To build a local wheel file::
-
- ./build.ps1 # Windows
- make build # Linux
-
-To test the wheel, (upload to test PyPI, then 'pip install' & use it)::
-
- ./test-release.ps1 # Windows
- make test-release # Linux
-
-To upload the wheel to PyPI::
-
- ./release.ps1 # Windows
- make release # Linux
-
-To clean all generated files, builds, virtualenv::
-
- ./clean.ps1 # Windows
- make clean # Linux
-
-
Professional support
--------------------
From d0801755703af4e753690e47bd89e20992bb55c0 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:16:52 -0500
Subject: [PATCH 09/45] Fix README link markup
---
README.rst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.rst b/README.rst
index 1f52b09d..ee30b7e7 100644
--- a/README.rst
+++ b/README.rst
@@ -301,7 +301,9 @@ I'd love to hear about it on that issues list, would be delighted by patches,
and would be happy to grant commit access to anyone who submits a working patch
or two.
-If you're hacking on the code, see [README-hacking.md](README-hacking.md)
+If you're hacking on the code, see `README_hacking.md`_.
+
+.. _README-hacking.md: README-hacking.md
License
From 99765af1197b62ee05f50891b7f1357e9ef93c7d Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:18:02 -0500
Subject: [PATCH 10/45] Fix README link markup
---
README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.rst b/README.rst
index ee30b7e7..51ca33dc 100644
--- a/README.rst
+++ b/README.rst
@@ -301,7 +301,7 @@ I'd love to hear about it on that issues list, would be delighted by patches,
and would be happy to grant commit access to anyone who submits a working patch
or two.
-If you're hacking on the code, see `README_hacking.md`_.
+If you're hacking on the code, see `README-hacking.md`_.
.. _README-hacking.md: README-hacking.md
From d8a7ff0d1e87c1884ae2bf435b7feac688be5a28 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:29:35 -0500
Subject: [PATCH 11/45] fix README-hacking typo
---
README-hacking.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README-hacking.md b/README-hacking.md
index cd70470d..996af1fe 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -37,7 +37,7 @@ tests.
* On OSX: View the makefile and manually run the equivalent commands for
each target. PR to automate this welcome!
6. If all is well:
- * On Windwos: `.\release.psq`
+ * On Windwos: `.\release.ps1`
* On Linux: `make release`
This will upload the built package to PyPI, tag the current commit with the
version, and push the tag.
From 14a21e98edacf35a5b4bd4c4e6656d6aa03bbc10 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Wed, 14 Oct 2020 23:33:25 -0500
Subject: [PATCH 12/45] README mentions Pypy compatibility.
---
README.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.rst b/README.rst
index 51ca33dc..bb90ecff 100644
--- a/README.rst
+++ b/README.rst
@@ -31,7 +31,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 and 3.8.
+Tested on CPython 2.7, 3.5, 3.6, 3.7 and 3.8, and Pypy 2.7.
No requirements other than the standard library.
From e0a314e302cd55dc4c78462965b6ef90dd3c74c8 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 15 Oct 2020 13:43:00 -0500
Subject: [PATCH 13/45] Release scripts now include sdist.
In response to https://github.com/tartley/colorama/issues/284
---
Makefile | 2 +-
release.ps1 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 5f6faf75..e086f64f 100644
--- a/Makefile
+++ b/Makefile
@@ -60,6 +60,6 @@ test-release: build
.PHONY: test-release
release: ## Upload our sdist and wheel
- $(twine) upload dist/colorama-$(version)-*
+ $(twine) upload dist/colorama-$(version)*{.whl,.tar.gz}
.PHONY: release
diff --git a/release.ps1 b/release.ps1
index e01014d0..ac4e2682 100644
--- a/release.ps1
+++ b/release.ps1
@@ -3,5 +3,5 @@ $bin="$ve\Scripts"
$version="$(& $bin\python.exe setup.py --version)"
# Upload to PyPI.
-& $bin\twine.exe upload dist\colorama-$version-*
+& $bin\twine.exe upload dist\colorama-$version*.tar.gz dist\colorama-$version-*.whl
From 938f5c5564302ef182227ddcb11c705d8a0bfd01 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 15 Oct 2020 16:06:27 -0500
Subject: [PATCH 14/45] Add Makefile docstring to test-release
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index e086f64f..a0b8987c 100644
--- a/Makefile
+++ b/Makefile
@@ -50,16 +50,16 @@ test: ## Run tests
# build packages
-build: ## Build an sdist and wheel
+build: ## Build a release (sdist and wheel)
$(python) -m pip install --upgrade setuptools wheel
$(python) setup.py sdist bdist_wheel
.PHONY: build
-test-release: build
+test-release: build ## Test a built release
./test-release
.PHONY: test-release
-release: ## Upload our sdist and wheel
+release: ## Upload a built release
$(twine) upload dist/colorama-$(version)*{.whl,.tar.gz}
.PHONY: release
From 86bfecd4f223fdaa983caf4db9b4e3fca9be42a3 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 15 Oct 2020 16:07:41 -0500
Subject: [PATCH 15/45] Add --extra-index-url to test-release scripts
This would be needed if the project had any dependencies.
It does not, so is redundant, but I figured better to add
it now while I just read about it, and then when dependencies
are added later (or when this gets cut and paste into a
different project), then hopefully things should just work.
---
test-release | 3 ++-
test-release.ps1 | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/test-release b/test-release
index fc20b06e..15812eff 100644
--- a/test-release
+++ b/test-release
@@ -31,7 +31,8 @@ mkdir -p $sandbox
$syspython -m venv --clear venv
# Install the package we just uploaded.
- venv/bin/python -m pip --quiet install --index-url https://test.pypi.org/simple colorama==$version
+ # (--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
# Import and use Colorama from the temp virtualenv.
venv/bin/python -c "import colorama; colorama.init(); print(colorama.Fore.GREEN + \"OK: Colorama\", colorama.__version__, \"from test pypi install.\")"
diff --git a/test-release.ps1 b/test-release.ps1
index 0466cf91..19c6967b 100644
--- a/test-release.ps1
+++ b/test-release.ps1
@@ -17,7 +17,8 @@ cd sandbox
& $syspython -m venv --clear venv
# Install the package we just uploaded.
-venv\Scripts\python -m pip --quiet install --index-url https://test.pypi.org/simple colorama==$version
+# (--extra-index-url for this project's requirements)
+venv\Scripts\python -m pip --quiet install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple colorama==$version
# Import and use colorama from the temp virtualenv.
venv\Scripts\python.exe -c @"
import colorama;
From 9b770a0c338a8cbde291dbd1eb6cb8fdb8f7a07b Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 15 Oct 2020 22:57:54 -0500
Subject: [PATCH 16/45] README-hacking on tagging
---
README-hacking.md | 111 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 96 insertions(+), 15 deletions(-)
diff --git a/README-hacking.md b/README-hacking.md
index 996af1fe..2ee99211 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -6,8 +6,16 @@ Although Colorama has no requirements other than the Python standard library,
development requires some Python packages, which are captured in
requirements-dev.txt.
+Throughout, if you're on a Mac, you can probably do something similar to the
+Linux instructions. Either use the makefile directly, or look in it to see
+what commands it executes, and manually execute something similar. PRs to
+automate for Mac appreciated! Especially if they just made the existing Linux
+Makefile targets work on Mac too.
+
+## Makefile and PowerShell scripts
+
Some common commands are captured as Linux makefile targets (which could
-perhaps be coaxed into running on OSX in Bash), and as Windows Powershell
+perhaps be coaxed into running on OSX in Bash), and as Windows PowerShell
scripts.
| Task | Linux | Windows |
@@ -28,19 +36,92 @@ tests.
## Release checklist
-1. Merge to master.
-2. Run the tests.
-3. Update the CHANGELOG.
-4. Remove the '-pre' suffix from `__version__` in `colorama/__init.py__.py`.
-5. * On Windows: `./clean.ps1 && .\bootstrap.ps1 && .\build.ps1 && .\test-release.ps1`
- * On Linux: `make clean bootstrap build test-release`
- * On OSX: View the makefile and manually run the equivalent commands for
- each target. PR to automate this welcome!
-6. If all is well:
- * On Windwos: `.\release.ps1`
+1. Check the CHANGELOG is updated with everything since the last release.
+2. Remove the '-pre' suffix from `__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:
+
+ * Windows: `./test.ps1`
+ * Linux: `make test`
+
+4. Verify you're all committed, merged to master, and pushed to origin (This
+ triggers a Travis build, which we'll check later on)
+
+5. 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
+ 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`
+
+ (This currently only tests the wheel, but
+ [should soon test the sdist too](https://github.com/tartley/colorama/issues/286).)
+
+7. Check the [Travis builds](https://travis-ci.org/github/tartley/colorama)
+ are complete and all passing. (This currently only tests on Linux, but
+ [should soon run on Windows too](https://github.com/tartley/colorama/issues/283).)
+
+8. Upload the distributables to PyPI:
+
+ * On Windows: `.\release.ps1`
* On Linux: `make release`
- This will upload the built package to PyPI, tag the current commit with the
- version, and push the tag.
-7. Bump the version number in `colorama/__init__.py`, ready for the next
- release, and add the '-pre' suffix again.
+
+ 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 (see below), so:
+
+ git tag -a -m "" $version
+ git push --follow-tags
+
+10. 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.)
+
+
+## On tagging
+
+Until today, all tags in the Colorama repo were regular _lightweight_ tags,
+created with `git tag NAME`.
+
+I recently learned about _annotated_ tags, created with `git tag -a -m
+"MESSAGE" NAME`. (If you don't specify `-m MESSAGE`, it annoyingly prompts you
+for one.)
+
+Two main differences, as far as I can tell:
+
+1. Annotated tags store the creator, created-date, and the message. This might
+ occasionally be useful for understanding what happened. A release tagged
+ this way shows us who created the release, and when, which might differ from
+ when the commit was created.
+
+2. The traditional way of pushing tags to the server:
+
+ git push --tags
+
+ is slightly broken, in that it pushes *all* tags. Some tags might be
+ intended as private development state. Some of them might be unreachable in
+ the origin repo (e.g. due to branches we haven't pushed.)
+
+ To fix this, git introduced:
+
+ git push --follow-tags
+
+ which aims to address these issues by:
+
+ * Only pushing annotated tags (hence, lightweight tags can be used as
+ local, private state)
+ * Only pushing tags that are on an ancestor of the commit being pushed.
+ Hence no unreachable tags are created on the origin.
+
+Upshot is: If you want to use any tags locally, use regular lightweight tags,
+and never `git push --tags`. For release tagging, from now onwards, we'll use
+annotated tags.
From 9946cfb04917f5b12b9534111e803c2631a99ef3 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Sat, 17 Oct 2020 14:48:19 -0500
Subject: [PATCH 17/45] Reference my blog p[ost about annotated tags
instead of writing all about there here
---
README-hacking.md | 44 ++------------------------------------------
1 file changed, 2 insertions(+), 42 deletions(-)
diff --git a/README-hacking.md b/README-hacking.md
index 2ee99211..cc17ae54 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -76,7 +76,8 @@ tests.
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 (see below), so:
+ 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
@@ -84,44 +85,3 @@ tests.
10. 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.)
-
-
-## On tagging
-
-Until today, all tags in the Colorama repo were regular _lightweight_ tags,
-created with `git tag NAME`.
-
-I recently learned about _annotated_ tags, created with `git tag -a -m
-"MESSAGE" NAME`. (If you don't specify `-m MESSAGE`, it annoyingly prompts you
-for one.)
-
-Two main differences, as far as I can tell:
-
-1. Annotated tags store the creator, created-date, and the message. This might
- occasionally be useful for understanding what happened. A release tagged
- this way shows us who created the release, and when, which might differ from
- when the commit was created.
-
-2. The traditional way of pushing tags to the server:
-
- git push --tags
-
- is slightly broken, in that it pushes *all* tags. Some tags might be
- intended as private development state. Some of them might be unreachable in
- the origin repo (e.g. due to branches we haven't pushed.)
-
- To fix this, git introduced:
-
- git push --follow-tags
-
- which aims to address these issues by:
-
- * Only pushing annotated tags (hence, lightweight tags can be used as
- local, private state)
- * Only pushing tags that are on an ancestor of the commit being pushed.
- Hence no unreachable tags are created on the origin.
-
-Upshot is: If you want to use any tags locally, use regular lightweight tags,
-and never `git push --tags`. For release tagging, from now onwards, we'll use
-annotated tags.
-
From d8a0836b1aacf5d8f1a49cce4041c595ba7c34b4 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Sun, 15 Nov 2020 10:28:16 -0800
Subject: [PATCH 18/45] Add support for Python 3.9
Released November 15, 2020.
https://docs.python.org/3.9/whatsnew/3.9.html
---
.travis.yml | 1 +
CHANGELOG.rst | 1 +
README.rst | 3 +--
setup.py | 1 +
tox.ini | 2 +-
5 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7e11b000..706b55c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,7 @@ cache: pip
matrix:
include:
- python: 2.7
+ - python: 3.9
- python: 3.8
- arch: arm64
python: 3.7
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 480421d5..6dbe30da 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -2,6 +2,7 @@
* 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.
+ * Add support for Python 3.9.
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/README.rst b/README.rst
index bb90ecff..e03e51f4 100644
--- a/README.rst
+++ b/README.rst
@@ -31,7 +31,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 and 3.8, and Pypy 2.7.
+Tested on CPython 2.7, 3.5, 3.6, 3.7, 3.8 and 3.9 and Pypy 2.7.
No requirements other than the standard library.
@@ -365,4 +365,3 @@ Thanks
to include Python 3.3 and 3.4
* Andy Neff for fixing RESET of LIGHT_EX colors.
* Jonathan Hartley for the initial idea and implementation.
-
diff --git a/setup.py b/setup.py
index 31720d02..4e75c12d 100644
--- a/setup.py
+++ b/setup.py
@@ -57,6 +57,7 @@ def get_version(path):
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Terminals',
diff --git a/tox.ini b/tox.ini
index aa8c7830..1588d99f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27, py35, py36, py37, py38, pypy
+envlist = py27, py35, py36, py37, py38, py39, pypy
[testenv]
deps = py27,pypy: mock
From 8f0587b0763739d45f7a14ee77629252efc3ff84 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Sun, 22 Nov 2020 04:20:40 -0800
Subject: [PATCH 19/45] Remove unused test imports and utils
Removing unused imports exposed redirected_output() as an unused
function. It too has been removed.
---
colorama/tests/initialise_test.py | 3 +--
colorama/tests/utils.py | 12 ------------
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/colorama/tests/initialise_test.py b/colorama/tests/initialise_test.py
index 4acea46d..7bbd18f9 100644
--- a/colorama/tests/initialise_test.py
+++ b/colorama/tests/initialise_test.py
@@ -1,5 +1,4 @@
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
-import os
import sys
from unittest import TestCase, main, skipUnless
@@ -10,7 +9,7 @@
from ..ansitowin32 import StreamWrapper
from ..initialise import init
-from .utils import osname, redirected_output, replace_by
+from .utils import osname, replace_by
orig_stdout = sys.stdout
orig_stderr = sys.stderr
diff --git a/colorama/tests/utils.py b/colorama/tests/utils.py
index 3e393fbb..472fafb4 100644
--- a/colorama/tests/utils.py
+++ b/colorama/tests/utils.py
@@ -4,10 +4,6 @@
import sys
import os
-try:
- from unittest.mock import Mock
-except ImportError:
- from mock import Mock
class StreamTTY(StringIO):
def isatty(self):
@@ -24,14 +20,6 @@ def osname(name):
yield
os.name = orig
-@contextmanager
-def redirected_output():
- orig = sys.stdout
- sys.stdout = Mock()
- sys.stdout.isatty = lambda: False
- yield
- sys.stdout = orig
-
@contextmanager
def replace_by(stream):
orig_stdout = sys.stdout
From 293d78250e281dbe8fdea1066f5fc341b85d5c38 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Sat, 15 Sep 2018 14:35:50 -0700
Subject: [PATCH 20/45] Remove discussion of unmaintained nose for running
tests
The nose project has ceased development. The last commit is from Mar 3,
2016. From their docs page:
https://nose.readthedocs.io/
> Note to Users
>
> Nose has been in maintenance mode for the past several years and will
> likely cease without a new person/team to take over maintainership.
> New projects should consider using Nose2, py.test, or just plain
> unittest/unittest2.
---
README-hacking.md | 4 ----
1 file changed, 4 deletions(-)
diff --git a/README-hacking.md b/README-hacking.md
index cc17ae54..8cc5b55a 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -30,10 +30,6 @@ scripts.
The Makefile is self-documenting, so 'make' with no args will describe each
target.
-If you use nose to run the tests, you must pass the ``-s`` flag; otherwise,
-``nosetests`` applies its own proxy to ``stdout``, which confuses the unit
-tests.
-
## Release checklist
1. Check the CHANGELOG is updated with everything since the last release.
From 0275556e10b28d0ed899a394334710c6a663a138 Mon Sep 17 00:00:00 2001
From: Jon Dufresne
Date: Sun, 15 Nov 2020 10:57:31 -0800
Subject: [PATCH 21/45] Add support and testing for PyPy3
---
.travis.yml | 1 +
CHANGELOG.rst | 1 +
README.rst | 2 +-
tox.ini | 2 +-
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 706b55c2..5d2bf77b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,6 +12,7 @@ matrix:
- python: 3.6
- python: 3.5
- python: pypy
+ - python: pypy3
install:
- "pip install mock"
script: "python -m unittest discover -p *_test.py"
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 6dbe30da..7ec3e8d2 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -3,6 +3,7 @@
* Tweak some README unicode characters that don't render correctly on PyPI.
* Fix some tests that were failing on some operating systems.
* Add support for Python 3.9.
+ * Add support for PyPy3.
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/README.rst b/README.rst
index e03e51f4..7e5c0800 100644
--- a/README.rst
+++ b/README.rst
@@ -31,7 +31,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 and 3.9 and Pypy 2.7.
+Tested on CPython 2.7, 3.5, 3.6, 3.7, 3.8 and 3.9 and Pypy 2.7 and 3.6.
No requirements other than the standard library.
diff --git a/tox.ini b/tox.ini
index 1588d99f..7663919e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27, py35, py36, py37, py38, py39, pypy
+envlist = py27, py35, py36, py37, py38, py39, pypy, pypy3
[testenv]
deps = py27,pypy: mock
From f690a2b68b53cf89a6ee6ff10c3c70e743da34a7 Mon Sep 17 00:00:00 2001
From: "John W. O'Brien"
Date: Sun, 22 Nov 2020 13:50:18 -0500
Subject: [PATCH 22/45] Use ASCII decoding explicitly in setup.py
---
setup.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 4e75c12d..03bcfe74 100644
--- a/setup.py
+++ b/setup.py
@@ -3,6 +3,7 @@
from __future__ import with_statement
+from io import open
import os
import re
try:
@@ -14,8 +15,9 @@
NAME = 'colorama'
-def read_file(path):
- with open(os.path.join(os.path.dirname(__file__), path)) as fp:
+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):
From eea3a58d369766f40a52b07026890970d739944a Mon Sep 17 00:00:00 2001
From: George Ogden <38294960+George-Ogden@users.noreply.github.com>
Date: Sun, 15 Aug 2021 13:05:12 +0100
Subject: [PATCH 23/45] Added new demo
---
demos/demo09.py | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 demos/demo09.py
diff --git a/demos/demo09.py b/demos/demo09.py
new file mode 100644
index 00000000..e4b898f8
--- /dev/null
+++ b/demos/demo09.py
@@ -0,0 +1,21 @@
+# https://www.youtube.com/watch?v=F5a8RLY2N8M&list=PL1_riyn9sOjcKIAYzo7f8drxD-Yg9La-D&index=61
+# Generic colorama demo using command line arguments
+# By George Ogden
+from colorama import Fore, Back, Style, init
+import argparse
+parser = argparse.ArgumentParser("colorama demo")
+
+def format(module):
+ return list(map(lambda x: x.lower(),module.__dict__.keys()))
+
+def find(module,item):
+ return module.__dict__[item.upper()]
+
+parser.add_argument("-c","--colour",choices=format(Fore),default="RESET")
+parser.add_argument("-b","--background",choices=format(Back),default="RESET")
+parser.add_argument("-s","--style",choices=format(Style),default="RESET_ALL")
+parser.add_argument("-t","--text",default="Lorem ipsum dolor sit amet")
+
+args = parser.parse_args()
+
+print(find(Style,args.style) + find(Fore,args.colour) + find(Back,args.background) + args.text + Style.RESET_ALL)
\ No newline at end of file
From 402d2367f25c99f4504f6216e43eac4f8b273b47 Mon Sep 17 00:00:00 2001
From: Antony Lee
Date: Sat, 28 Aug 2021 17:17:00 +0200
Subject: [PATCH 24/45] Note that escapes are stripped out for redirected
outputs.
---
README.rst | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/README.rst b/README.rst
index e03e51f4..5f94e478 100644
--- a/README.rst
+++ b/README.rst
@@ -98,9 +98,12 @@ text sent to ``stdout`` or ``stderr``, and replace them with equivalent Win32
calls.
On other platforms, calling ``init()`` has no effect (unless you request other
-optional functionality; see "Init Keyword Args", below). By design, this permits
-applications to call ``init()`` unconditionally on all platforms, after which
-ANSI output should just work.
+optional functionality, see "Init Keyword Args" below; or if output
+is redirected). By design, this permits applications to call ``init()``
+unconditionally on all platforms, after which ANSI output should just work.
+
+On all platforms, if output is redirected, ANSI escape sequences are completely
+stripped out.
To stop using Colorama before your program exits, simply call ``deinit()``.
This will restore ``stdout`` and ``stderr`` to their original values, so that
From f307a6d47edf8d96eadd82e2f11657990197bbc7 Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Wed, 6 Oct 2021 23:44:16 +0200
Subject: [PATCH 25/45] GitHub Action to lint Python code
---
.github/workflows/lint_python.yml | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 .github/workflows/lint_python.yml
diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml
new file mode 100644
index 00000000..8eaeb1ac
--- /dev/null
+++ b/.github/workflows/lint_python.yml
@@ -0,0 +1,25 @@
+name: lint_python
+on: [pull_request, push]
+jobs:
+ lint_python:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v2
+ - run: pip install --upgrade pip wheel
+ - run: pip install bandit black codespell flake8 flake8-bugbear
+ flake8-comprehensions isort mypy pytest pyupgrade safety
+ - run: bandit --recursive --skip B101 . || true # B101 is assert statements
+ - run: black --check . || true
+ - run: codespell || true # --ignore-words-list="" --skip="*.css,*.js,*.lock"
+ - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+ - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88
+ --show-source --statistics
+ - run: isort --check-only --profile black . || true
+ - run: pip install -r requirements.txt || pip install --editable . || true
+ - run: mkdir --parents --verbose .mypy_cache
+ - run: mypy --ignore-missing-imports --install-types --non-interactive . || true
+ - run: pytest . || true
+ - run: pytest --doctest-modules . || true
+ - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
+ - run: safety check
From 16847d7234b64853decdc2d301340dae5bcab155 Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Wed, 6 Oct 2021 23:52:29 +0200
Subject: [PATCH 26/45] Make bandit, codespell, and pytest mandatory tests
---
.github/workflows/lint_python.yml | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml
index 8eaeb1ac..52c7ba05 100644
--- a/.github/workflows/lint_python.yml
+++ b/.github/workflows/lint_python.yml
@@ -9,17 +9,16 @@ jobs:
- run: pip install --upgrade pip wheel
- run: pip install bandit black codespell flake8 flake8-bugbear
flake8-comprehensions isort mypy pytest pyupgrade safety
- - run: bandit --recursive --skip B101 . || true # B101 is assert statements
+ - run: bandit --recursive --skip B311
- run: black --check . || true
- - run: codespell || true # --ignore-words-list="" --skip="*.css,*.js,*.lock"
+ - run: codespell # --ignore-words-list="" --skip="*.css,*.js,*.lock"
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88
--show-source --statistics
- run: isort --check-only --profile black . || true
- - run: pip install -r requirements.txt || pip install --editable . || true
+ - run: pip install -r requirements.txt
- run: mkdir --parents --verbose .mypy_cache
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true
- - run: pytest . || true
- - run: pytest --doctest-modules . || true
+ - run: pytest .
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
- run: safety check
From 1d92c3a9c15fff03f94e844d3ff099e6ce4d04ca Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Wed, 6 Oct 2021 23:54:04 +0200
Subject: [PATCH 27/45] .
---
.github/workflows/lint_python.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml
index 52c7ba05..fb218d88 100644
--- a/.github/workflows/lint_python.yml
+++ b/.github/workflows/lint_python.yml
@@ -9,7 +9,7 @@ jobs:
- run: pip install --upgrade pip wheel
- run: pip install bandit black codespell flake8 flake8-bugbear
flake8-comprehensions isort mypy pytest pyupgrade safety
- - run: bandit --recursive --skip B311
+ - run: bandit --recursive --skip B311 .
- run: black --check . || true
- run: codespell # --ignore-words-list="" --skip="*.css,*.js,*.lock"
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
From 536e9667e16d397fb53c5af5734b778c8656d06b Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Wed, 6 Oct 2021 23:56:11 +0200
Subject: [PATCH 28/45] fixup! Fix typo discovered by codespell
---
CHANGELOG.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 6dbe30da..d0b2510c 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -165,7 +165,7 @@
* Remove setup.py dependency on setuptools, now uses stdlib distutils.
0.1.8
* Fix ghastly errors all over the place on Ubuntu.
- * Add init kwargs 'convert' and 'strip', which supercede the old 'wrap'.
+ * Add init kwargs 'convert' and 'strip', which supersede the old 'wrap'.
0.1.7
* Python 3 compatible.
* Fix: Now strips ansi on windows without necessarily converting it to
From 5ed10702fdbd3833bc3d30a74e94f95b54a7cf70 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 7 Oct 2021 00:07:01 -0500
Subject: [PATCH 29/45] README suggests not using Colorama to print colors
Colorama's primary purpose is to convert ANSI codes
to work on Windows. People are forever requesting or
submitting ways to improve the capabilities of Colorama's
Fore, Back, Style constants. I don't want to bloat out the
library with making fancy ways to print colors, when it's
never going to be as good as other libraries like Blessings
or Rich that are dedicated soley to that. Instead we aim
to do one thing well, i.e. convert ansi codes, whether you
generate them using Colorama, Blessings or manually,
into win32 calls so they work on Windows as well.
---
README.rst | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/README.rst b/README.rst
index 0fdf63f5..31aec6de 100644
--- a/README.rst
+++ b/README.rst
@@ -115,7 +115,8 @@ Colored Output
..............
Cross-platform printing of colored text can then be done using Colorama's
-constant shorthand for ANSI escape sequences:
+constant shorthand for ANSI escape sequences. These are deliberately
+rudimentary, see below.
.. code-block:: python
@@ -135,8 +136,13 @@ constant shorthand for ANSI escape sequences:
...or, Colorama can be used in conjunction with existing ANSI libraries
such as the venerable `Termcolor `_
-or the fabulous `Blessings `_.
-This is highly recommended for anything more than trivial coloring:
+the fabulous `Blessings `_,
+or the incredible `_Rich `_.
+
+If you wish Colorama's Fore, Back and Style constants were more capable,
+then consider using one of the above highly capable libraries to generate
+colors, etc, and use Colorama just for its primary purpose: to convert
+those ANSI sequences to also work on Windows:
.. code-block:: python
From 69f4644d24f6589a27b59d4fbad7e3f8b7750889 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade
Date: Thu, 7 Oct 2021 08:52:45 +0300
Subject: [PATCH 30/45] Replace Travis CI with GitHub Actions
---
.github/workflows/test.yml | 56 ++++++++++++++++++++++++++++++++++++++
.travis.yml | 18 ------------
README-hacking.md | 7 ++---
README.rst | 5 ++--
4 files changed, 61 insertions(+), 25 deletions(-)
create mode 100644 .github/workflows/test.yml
delete mode 100644 .travis.yml
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..0c893394
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,56 @@
+name: Test
+
+on: [push, pull_request, workflow_dispatch]
+
+env:
+ FORCE_COLOR: 1
+
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: ["pypy2", "pypy3", "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: "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"}
+ - {python-version: "3.10", toxenv: "py310"}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Get pip cache dir
+ id: pip-cache
+ run: |
+ echo "::set-output name=dir::$(pip cache dir)"
+
+ - name: Cache
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.pip-cache.outputs.dir }}
+ key:
+ ${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('**/tox.ini') }}
+ restore-keys: |
+ ${{ matrix.os }}-${{ matrix.python-version }}-v1-
+
+ - name: Install dependencies
+ run: |
+ python -m pip install tox
+
+ - name: Tox tests
+ run: |
+ tox -e ${{ matrix.toxenv }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5d2bf77b..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: python
-cache: pip
-matrix:
- include:
- - python: 2.7
- - python: 3.9
- - python: 3.8
- - arch: arm64
- python: 3.7
- - arch: amd64
- python: 3.7
- - python: 3.6
- - python: 3.5
- - python: pypy
- - python: pypy3
-install:
- - "pip install mock"
-script: "python -m unittest discover -p *_test.py"
diff --git a/README-hacking.md b/README-hacking.md
index 8cc5b55a..6ecc44cc 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -42,7 +42,7 @@ target.
* Linux: `make test`
4. Verify you're all committed, merged to master, and pushed to origin (This
- triggers a Travis build, which we'll check later on)
+ triggers a CI build, which we'll check later on)
5. Build the distributables (sdist and wheel), on either OS:
@@ -60,9 +60,8 @@ target.
(This currently only tests the wheel, but
[should soon test the sdist too](https://github.com/tartley/colorama/issues/286).)
-7. Check the [Travis builds](https://travis-ci.org/github/tartley/colorama)
- are complete and all passing. (This currently only tests on Linux, but
- [should soon run on Windows too](https://github.com/tartley/colorama/issues/283).)
+7. Check the [CI builds](https://github.com/tartley/colorama/actions/)
+ are complete and all passing.
8. Upload the distributables to PyPI:
diff --git a/README.rst b/README.rst
index 31aec6de..7efd9361 100644
--- a/README.rst
+++ b/README.rst
@@ -6,11 +6,10 @@
:target: https://pypi.org/project/colorama/
:alt: Supported Python versions
-.. image:: https://travis-ci.org/tartley/colorama.svg?branch=master
- :target: https://travis-ci.org/tartley/colorama
+.. image:: https://github.com/tartley/colorama/actions/workflows/test.yml/badge.svg
+ :target: https://github.com/tartley/colorama/actions/workflows/test.yml
:alt: Build Status
-
Colorama
========
From e8e311b0a7e4eff6d40fd92773569bc657327578 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 7 Oct 2021 10:39:40 -0500
Subject: [PATCH 31/45] Update README-hacking.md
Add a couple of paragraphs suggesting not to submit improvements
to how Fore, Back, Style, etc, work, because they are unlikely to be
merged.
---
README-hacking.md | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/README-hacking.md b/README-hacking.md
index 8cc5b55a..3255ed8b 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -12,6 +12,40 @@ what commands it executes, and manually execute something similar. PRs to
automate for Mac appreciated! Especially if they just made the existing Linux
Makefile targets work on Mac too.
+## Desired changes
+
+Colorama is unexpectedly popular, and is now a transitive dependency of many
+popular and high profile projects. If we break backwards compatibility, even in a
+subtle way, we can break applications - or pip installs - for lots of people.
+
+In addition, the project already takes more time & energy to maintain than
+the maintainers currently have available - for example the original author
+is now a parent, and no longer uses Windows, so time and motivation for this
+project are both much lower than they used to be.
+
+As a result of both the above, we are very conservative in what sorts of
+changes we can accept. Generally, we are not keen on new features. Even if
+they are small, they still add to the future maintenance burden, increasing
+the surface area into which future bugs or compatibility changes could be
+introduced.
+
+This is especially true if they are new ways to generate ANSI codes (e.g.
+context managers for handling Fore, Back or Style changes.), since it has
+always been Colorama's stance that if you want to print ANSI codes, then yes
+we can help out with that in a rudimentary way, but if you want to do advanced
+things, then you should be using a different library that specializes in that,
+such as Termcolor, Blessings, or Rich. These libraries are much better than
+Colorama at generating ANSI codes for colors and the like, and probably
+already include the feature you are trying to add to Colorama, plus many
+more.
+
+In addition to using those libraries, if you call colorama.init(), then your
+fancy new colors, etc, will also work on Windows. This is the main purpose
+of Colorama.
+
+The kinds of submissions we would encourage work towards that goal, or fix
+bugs, or improve compatibility across operating systems or environements.
+
## Makefile and PowerShell scripts
Some common commands are captured as Linux makefile targets (which could
@@ -32,6 +66,8 @@ 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`.
3. Run the tests locally on your preferred OS, just to save you from doing
From 53e0db31eab4b7e40b4aac66bfeef2736b82b813 Mon Sep 17 00:00:00 2001
From: Jonathan Hartley
Date: Thu, 7 Oct 2021 10:40:17 -0500
Subject: [PATCH 32/45] Update README-hacking.md
fix typo
---
README-hacking.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README-hacking.md b/README-hacking.md
index 3255ed8b..687e5088 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -26,7 +26,7 @@ project are both much lower than they used to be.
As a result of both the above, we are very conservative in what sorts of
changes we can accept. Generally, we are not keen on new features. Even if
they are small, they still add to the future maintenance burden, increasing
-the surface area into which future bugs or compatibility changes could be
+the surface area into which future bugs or compatibility breaks could be
introduced.
This is especially true if they are new ways to generate ANSI codes (e.g.
From 912fe9bf09f7d4b310e3e8d8e8fe88a4b0789838 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade
Date: Thu, 7 Oct 2021 08:47:28 +0300
Subject: [PATCH 33/45] Add support for Python 3.10
---
README.rst | 2 +-
setup.py | 1 +
tox.ini | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/README.rst b/README.rst
index 7efd9361..c341ad62 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 and 3.9 and Pypy 2.7 and 3.6.
+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.
No requirements other than the standard library.
diff --git a/setup.py b/setup.py
index 03bcfe74..4221fe1b 100644
--- a/setup.py
+++ b/setup.py
@@ -60,6 +60,7 @@ def get_version(path):
'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/tox.ini b/tox.ini
index 7663919e..721d811d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27, py35, py36, py37, py38, py39, pypy, pypy3
+envlist = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3
[testenv]
deps = py27,pypy: mock
From 78996837ec609a2e4adb7ffd14df1d03ca9bc8f9 Mon Sep 17 00:00:00 2001
From: Timok Khan
Date: Tue, 21 Jun 2016 22:30:34 +0200
Subject: [PATCH 34/45] Add light colors in README
---
README.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/README.rst b/README.rst
index c341ad62..9a349ac1 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 35/45] 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 6039a054..5286b22c 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 36/45] 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 bbe99f47..bbc647ba 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 37/45] 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 0c893394..eefd55ca 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 38/45] 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 83fc7f22..9034e502 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 6039a054..19291a04 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 39/45] 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 b7c93961..628b7ef8 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 40/45] Mention fixed ValueError at exit in CHANGELOG
---
CHANGELOG.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 9034e502..2d028f68 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 41/45] 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 628b7ef8..242f517f 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 3260f8b4..53ba3314 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 de9ba5ae..a2a59af3 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 641fd6fc..918a1fec 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 15812eff..29653041 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 19c6967b..950dfdaa 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 42/45] 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 a0b8987c..924a1b60 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 242f517f..a9026043 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 29653041..d22eec1a 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 43/45] 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 d8cbbcca..eb05b076 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 44/45] 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 a9026043..1213aa43 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 45/45] 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 918a1fec..9138a8cc 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'