Skip to main content

color-print

Tiny Python package to format and print colored text using ANSI escape sequences.

Usage

from color_print import color_print, format_text

color_print("Hello", "green")
# or
s = format_text("Hello", "red")
print(s)

Install

# install from source
pip install .

# or install the published package from PyPI (unique name chosen to avoid conflicts):
pip install color-print-abi6374

Run tests

pip install -e .[test]
pytest

CI & Publishing

This repository includes GitHub Actions workflows to run tests and publish releases.

  • CI: .github/workflows/ci.yml — runs tests on push and PRs to main across multiple Python versions and OSes.
  • Publish (tag-based): .github/workflows/publish.yml — builds and uploads to PyPI when you push a tag matching v*.*.*.
  • Release-based: .github/workflows/release-publish.yml — builds on GitHub Release published and uploads to PyPI.

Before publishing to PyPI

  1. Create a PyPI API token on https://pypi.org/manage/account/#api-tokens. Copy the token immediately.
  2. In GitHub, go to your repository → Settings → Secrets and variables → Actions → New repository secret.
    • Name: PYPI_API_TOKEN
    • Value: paste the token from PyPI

Publish using a tag (from PowerShell)

# create annotated tag at current main HEAD
git checkout main
git pull origin main
git tag -a v0.1.0 -m "release v0.1.0"
git push origin v0.1.0

Or publish by creating a GitHub Release (UI): create a release for the version and publish it — the release-publish.yml workflow will run.

If a workflow fails to resolve a third-party action (for example pypa/gh-action-pypi-publish@...), the repository includes fallbacks that run twine directly on the runner. Ensure PYPI_API_TOKEN is set and the tag/release points at the commit that contains the updated workflow file.

Metadata

Release files for color-print-abi6374 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for color-print-abi6374 0.3.0
File Size Uploaded
color_print_abi6374-0.3.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for color-print-abi6374 0.3.0
File Interpreter ABI Platform
color_print_abi6374-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / color_print_abi6374-0.3.0.tar.gz

Download URL color_print_abi6374-0.3.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4c92fc01a81a3c919d217747488d0d7e95ed567f4a4ae117f99cdc425540ed32
BLAKE2b-256 checksum
How to use checksums
c995ddb20077eaff7b77ecf067f438c180d07432efd22f2a2a3c8f0c9509eab8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / color_print_abi6374-0.3.0-py3-none-any.whl

Download URL color_print_abi6374-0.3.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc278a1cc6c4daa828ac8627627ff5b44aa2895a54b69f6cfada90e91b25c8ea
BLAKE2b-256 checksum
How to use checksums
9b7933d06182e1012e27c0f3891044149c942a1b4c4f725d5ea093658b594e7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page