Skip to main content

Simple colored terminal output for Python

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

color_print_abi6374-0.3.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

color_print_abi6374-0.3.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file color_print_abi6374-0.3.0.tar.gz.

File metadata

  • Download URL: color_print_abi6374-0.3.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for color_print_abi6374-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4c92fc01a81a3c919d217747488d0d7e95ed567f4a4ae117f99cdc425540ed32
MD5 8ba9b9e62e360dafdbe30f651329dcc3
BLAKE2b-256 c995ddb20077eaff7b77ecf067f438c180d07432efd22f2a2a3c8f0c9509eab8

See more details on using hashes here.

File details

Details for the file color_print_abi6374-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for color_print_abi6374-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc278a1cc6c4daa828ac8627627ff5b44aa2895a54b69f6cfada90e91b25c8ea
MD5 af0d29344b541d8725e6d051714fae3e
BLAKE2b-256 9b7933d06182e1012e27c0f3891044149c942a1b4c4f725d5ea093658b594e7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page