diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..bd8aab5 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,85 @@ +# This workflow will install Python dependencies, run tests, and smoke +# the sdist/wheel on a range of Python versions. +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# + +name: Python package + +on: + push: + branches: + - boilerplate + - dev + - idiomatic + - master + - rc1 + - rc2 + - rc3 + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + + steps: + - name: Checking out code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest + python -m pip install -e . + + - name: Test with pytest + run: | + pytest + + - name: Build and install smoke + run: | + python -m pip install build + python -m build + python -m pip install dist/woad-*.whl + python -c "import woad; assert woad.__version__ == '0.0.0'; print(woad.__version__)" + + build-py27: + + runs-on: ubuntu-latest + container: + image: python:2.7-slim + steps: + - uses: actions/checkout@v4 + - name: Compile library modules + run: | + python -m compileall woad + - name: Test with unittest + run: | + python -m unittest discover -s tests + env: + PYTHONPATH: ${{ github.workspace }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e342279 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# directories (by name) + +/.venv/ + +build/ +dist/ +scratch/ + +*.egg-info/ + + +# directories (by pattern) + + +# files (by name) + +.DS_Store + + +# files (by pattern) + +*~ +*.pyc +*.pyo +*.swo +*.swp +*.tmp +*.zip diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..05b76de --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,21 @@ +# woad.Python - Authors + + +## Major Contributors + +| Name | GitHub | +| ----------- | --------------------------------- | +| Matt Wilson | [mwsis](https://github.com/mwsis) | + + +## Defect reports, fixes and suggestions (for which we are very grateful) + +| Name | GitHub | +| ------- | ------ | +| \ | | + + +Contributions are welcomed. + + + diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..b9324d3 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,10 @@ +# woad.Python - Changes + + +## 0.0.0 - 15th August 2026 + +* initial project scaffolding; +* **Python** **2.7** and **3.8+** compatibility; + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c830d4d --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +woad.Python - BSD 3-Clause License + +Copyright (c) 2026, Matthew Wilson and Synesis Information Systems +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index ebd5146..6191a0f 100644 --- a/README.md +++ b/README.md @@ -1 +1,99 @@ -# woad.Python \ No newline at end of file +# woad.Python + +Minimal ANSI terminal colour codes, for Python + +![Language](https://img.shields.io/badge/Python-3776AB?style=flat&logo=python&logoColor=white) +[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +[![PyPI](https://img.shields.io/pypi/v/woad.svg)](https://pypi.org/project/woad/) +[![GitHub release](https://img.shields.io/github/v/release/synesissoftware/woad.Python.svg)](https://github.com/synesissoftware/woad.Python/releases/latest) +[![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/woad.Python)](https://github.com/synesissoftware/woad.Python/commits/master) +[![CI](https://github.com/synesissoftware/woad.Python/actions/workflows/python-package.yml/badge.svg)](https://github.com/synesissoftware/woad.Python/actions/workflows/python-package.yml) +![Python](https://img.shields.io/badge/Python-2.7%20%7C%203.8+-lightgrey) + + +## Table of Contents + +- [Introduction](#introduction) +- [Installation](#installation) +- [Components](#components) +- [Project Information](#project-information) + - [Where to get help](#where-to-get-help) + - [Contribution guidelines](#contribution-guidelines) + - [Dependencies](#dependencies) + - [Efferent (fan-out)](#efferent-fan-out) + - [Development Dependencies](#development-dependencies) + - [Afferent (fan-in)](#afferent-fan-in) + - [Related projects](#related-projects) + - [License](#license) + + +## Introduction + +**woad** provides the smallest useful set of fixed ANSI SGR colour sequences for library authors. It is not a console or TUI framework. + +**woad.Python** is the **Python** implementation. It supports **Python 2.7** and **Python 3.8+**. + + +## Installation + +Install via **pip**: + +``` +pip install woad +``` + +Use via **import**: + +```Python +import woad +``` + + +## Components + +**woad.Python** currently ships the **`woad`** package and version metadata (`woad.__version__`). Colour codes, TTY/stream gating, and Windows virtual-terminal opt-in are not implemented in this 0.0.0 skeleton. + + +## Project Information + + +### Where to get help + +[GitHub Page](https://github.com/synesissoftware/woad.Python "GitHub Page") + + +### Contribution guidelines + +Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/woad.Python. + + +### Dependencies + + +#### Efferent (fan-out) + +None. + + +#### Development Dependencies + +* [**pytest**](https://docs.pytest.org/) + + +#### Afferent (fan-in) + +None (currently). + + +### Related projects + +* [**woad.Ruby**](https://github.com/synesissoftware/woad.Ruby/) +* [**woad.Rust**](https://github.com/synesissoftware/woad.Rust/) + + +### License + +**woad.Python** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details. + + + diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..9b7e03e --- /dev/null +++ b/TODO.md @@ -0,0 +1,21 @@ +# woad.Python - TODO + + +## Functional improvements + +* [ ] SGR colour and reset codes; +* [ ] TTY-conditional colour codes (process and per-stream); +* [ ] Windows virtual-terminal gating (OS build + `GetConsoleMode`); + + +## Performance improvements + +* \ + + +## Packaging improvements + +* \ + + + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ed2f41d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,62 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=61.0", +] + + +[project] +authors = [ + { email = "matthew@synesis.com.au", name = "Matt Wilson" }, +] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Topic :: Software Development :: Libraries", + "Topic :: Terminals", +] +dependencies = [ +] +description = "Minimal ANSI terminal colour codes, for Python" +keywords = [ + "ansi", + "colour", + "sgr", + "terminal", + "tty", +] +license = { text = "BSD-3-Clause" } +name = "woad" +readme = "README.md" +requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*" +version = "0.0.0" + +[project.urls] +"Bug Tracker" = "https://github.com/synesissoftware/woad.Python/issues" +Changelog = "https://github.com/synesissoftware/woad.Python/blob/master/CHANGES.md" +Homepage = "https://github.com/synesissoftware/woad.Python" +Repository = "https://github.com/synesissoftware/woad.Python" + + +[tool.setuptools.packages.find] +exclude = [ + "examples*", + "tests*", +] +include = [ + "woad", + "woad.*", +] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b52737c --- /dev/null +++ b/setup.py @@ -0,0 +1,42 @@ + +import setuptools + +setuptools.setup( + + name='woad', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*', + version='0.0.0', + + author='Matt Wilson', + author_email='matthew@synesis.com.au', + classifiers=[ + + 'Intended Audience :: Developers', + "License :: OSI Approved :: BSD License", + 'Natural Language :: English', + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + 'Topic :: Software Development :: Libraries', + 'Topic :: Terminals', + ], + description='Minimal ANSI terminal colour codes, for Python', + keywords='ansi colour sgr terminal tty', + license='BSD-3-Clause', + long_description=open('README.md').read(), + long_description_content_type="text/markdown", + packages=setuptools.find_packages(exclude=[ + 'examples', + 'tests', + ]), + url='https://github.com/synesissoftware/woad.Python', +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ + diff --git a/tests/test_woad.py b/tests/test_woad.py new file mode 100644 index 0000000..3d13b4b --- /dev/null +++ b/tests/test_woad.py @@ -0,0 +1,10 @@ +import unittest + +import woad + + +class Test_woad(unittest.TestCase): + + def test_version(self): + + self.assertEqual('0.0.0', woad.__version__) diff --git a/woad/__init__.py b/woad/__init__.py new file mode 100644 index 0000000..37096dd --- /dev/null +++ b/woad/__init__.py @@ -0,0 +1,16 @@ + +""" +Minimal ANSI terminal colour codes, for Python. +""" + +__author__ = 'Matt Wilson' +__copyright__ = 'Copyright 2026, Synesis Information Systems' +__credits__ = [ + 'Matt Wilson', +] +__email__ = 'matthew@synesis.com.au' +__license__ = 'BSD-3-Clause' +__maintainer__ = 'Matt Wilson' +__status__ = 'Alpha' +__version__ = '0.0.0' +