Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for reverse video and underline on Windows 10. #267

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Expand Up @@ -9,4 +9,6 @@
# open_collective: # Replace with a single Open Collective username
# otechie: # Replace with a single Otechie username
# patreon: # Replace with a single Patreon username
custom: ["https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2MZ9D2GMLYCUJ&item_name=Colorama&currency_code=USD"]
tidelift: "pypi/colorama"

9 changes: 5 additions & 4 deletions .gitignore
Expand Up @@ -2,11 +2,12 @@
*.egg-info
.coverage
.tox/
MANIFEST
dist
tags
/MANIFEST
/build/
/dist/
/sandbox/
/tags
virtualenv
build

# PyCharm
.idea
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -3,6 +3,7 @@ cache: pip
matrix:
include:
- python: 2.7
- python: 3.9
- python: 3.8
- arch: arm64
python: 3.7
Expand Down
19 changes: 18 additions & 1 deletion CHANGELOG.rst
@@ -1,6 +1,23 @@
0.4.6
* Support reverse video and underline on Windows 10
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.
* 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
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.
Expand Down
54 changes: 43 additions & 11 deletions Makefile
Expand Up @@ -10,24 +10,56 @@ help: ## Display help for documented make targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-7s\033[0m %s\n", $$1, $$2}'

clean: ## Remove build artifacts and .pyc files
-rm -rf build dist MANIFEST colorama.egg-info

# bootstrap environment

virtualenv=~/.virtualenvs/colorama
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)
-find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
.PHONY: clean

build: clean ## Build an sdist and wheel
python setup.py sdist bdist_wheel
.PHONY: sdist
$(virtualenv):
$(syspython) -m venv --clear $(virtualenv)
$(pip) install --upgrade pip

upload: ## Upload our sdist and wheel
twine upload dist/*
.PHONY: release
venv: $(virtualenv) ## Create or clear a virtualenv
.PHONY: venv

bootstrap: venv ## Populate the virtualenv
$(pip) install -r requirements.txt -r requirements-dev.txt
.PHONY: bootstrap

test: ## Run tests
python -m unittest discover -p *_test.py
.PHONY: test

# development

tags: ## Create tags file
ctags -R ${NAME}
.PHONY: tags

test: ## Run tests
$(python) -m unittest discover -p *_test.py
.PHONY: test


# build packages

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 a built release
./test-release
.PHONY: test-release

release: ## Upload a built release
$(twine) upload dist/colorama-$(version)*{.whl,.tar.gz}
.PHONY: release

83 changes: 83 additions & 0 deletions README-hacking.md
@@ -0,0 +1,83 @@
# 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.

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
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.

## Release 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
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 [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. 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.)