1
0
Fork 0

Merging upstream version 3.1.10 (Closes: #1014035).

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-12 13:07:05 +01:00
parent a2659e8690
commit 05f35a98b3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
22 changed files with 386 additions and 69 deletions

3
.env_example Normal file
View file

@ -0,0 +1,3 @@
export PYTHONIOENCODING=utf-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

101
CHANGELOG.md Normal file
View file

@ -0,0 +1,101 @@
Changelog
=========
This project adheres to `Semantic Versioning <http://semver.org/>`_.
3.1.7 - 2016-12-7
------------------
Added
* Published wheel. Resume maintenance under new developer after main project had been archived.
3.1.0 - 2016-10-16
------------------
Added
* ``git --porcelain``-like table by liiight: https://github.com/Robpol86/terminaltables/pull/31
3.0.0 - 2016-05-30
------------------
Added
* Support for https://pypi.python.org/pypi/colorama
* Support for https://pypi.python.org/pypi/termcolor
* Support for RTL characters (Arabic and Hebrew).
* Support for non-string items in ``table_data`` like integers.
Changed
- Refactored again, but this time entire project including tests.
Removed
- ``padded_table_data`` property and ``join_row()``. Moving away from repeated string joining/splitting.
Fixed
- ``set_terminal_title()`` Unicode handling on Windows.
- https://github.com/Robpol86/terminaltables/issues/18
- https://github.com/Robpol86/terminaltables/issues/20
- https://github.com/Robpol86/terminaltables/issues/23
- https://github.com/Robpol86/terminaltables/issues/26
2.1.0 - 2015-11-02
------------------
Added
* GitHub Flavored Markdown table by bcho: https://github.com/Robpol86/terminaltables/pull/12
* Python 3.5 support (Linux/OS X and Windows).
2.0.0 - 2015-10-11
------------------
Changed
* Refactored code. No new features.
* Breaking changes: ``UnixTable``/``WindowsTable``/``WindowsTableDouble`` moved. Use ``SingleTable``/``DoubleTable``
instead.
1.2.1 - 2015-09-03
------------------
Fixed
* CJK character width fixed by zqqf16 and bcho: https://github.com/Robpol86/terminaltables/pull/9
1.2.0 - 2015-05-31
------------------
Added
* Bottom row separator.
1.1.1 - 2014-11-03
------------------
Fixed
* Python 2.7 64-bit terminal width bug on Windows.
1.1.0 - 2014-11-02
------------------
Added
* Windows support.
* Double-lined table.
1.0.2 - 2014-09-18
------------------
Added
* ``table_width`` and ``ok`` properties.
1.0.1 - 2014-09-12
------------------
Added
* Terminal width/height defaults for testing.
* ``terminaltables.DEFAULT_TERMINAL_WIDTH``
* ``terminaltables.DEFAULT_TERMINAL_HEIGHT``
1.0.0 - 2014-09-11
------------------
* Initial release.
.. changelog-section-end

View file

@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License
Copyright (c) 2016 Robpol86
Copyright (c) 2017 Robpol86
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

16
Pipfile Normal file
View file

@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
colorama=">=0.3.7"
colorclass=">=2.2.0"
pytest-cov=">=2.4.0"
termcolor = "*"
check-wheel-contents = "*"
[requires]
python_version = "3.9"

57
README.md Normal file
View file

@ -0,0 +1,57 @@
## terminaltables
# What is it
Easily draw tables in terminal/console applications from a list of lists of strings. Supports multi-line rows.
- Python 2.6, 2.7, PyPy, PyPy3, 3.3, 3.4, and 3.5+ supported on Linux and OS X.
- Python 2.7, 3.3, 3.4, and 3.5+ supported on Windows (both 32 and 64 bit versions of Python).
📖 Full documentation: https://robpol86.github.io/terminaltables
Quickstart
==========
Install:
```bash
pip install terminaltables
```
Usage:
```python
from terminaltables import AsciiTable
table_data = [
['Heading1', 'Heading2'],
['row1 column1', 'row1 column2'],
['row2 column1', 'row2 column2'],
['row3 column1', 'row3 column2']
]
table = AsciiTable(table_data)
print
table.table
```
```bash
+--------------+--------------+
| Heading1 | Heading2 |
+--------------+--------------+
| row1 column1 | row1 column2 |
| row2 column1 | row2 column2 |
| row3 column1 | row3 column2 |
+--------------+--------------+
```
Example Implementations
=======================
![Example Scripts Screenshot](https://github.com/matthewdeanmartin/terminaltables/blob/master/docs/examples.png?raw=true)
Source code for examples:
- [example1.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example1.py)
- [example2.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example2.py)
- [example3.py](https://github.com/matthewdeanmartin/terminaltables/blob/master/example3.py)
[Change Log](https://github.com/matthewdeanmartin/terminaltables/blob/master/CHANGELOG.md)

View file

@ -1,33 +0,0 @@
# Configure.
environment:
PYTHON: Python35
matrix:
- TOX_ENV: lint
- TOX_ENV: py35
- TOX_ENV: py34
- TOX_ENV: py33
- TOX_ENV: py27
- TOX_ENV: py
PYTHON: Python35-x64
- TOX_ENV: py
PYTHON: Python34-x64
- TOX_ENV: py
PYTHON: Python33-x64
- TOX_ENV: py
PYTHON: Python27-x64
# Run.
init: set PATH=C:\%PYTHON%;C:\%PYTHON%\Scripts;%PATH%
install:
- appveyor DownloadFile https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1
- ps: .\enable-desktop
build_script: pip install tox
test_script: tox -e %TOX_ENV%
on_success: IF %TOX_ENV% NEQ lint pip install codecov & codecov
# Post.
# on_finish: https://github.com/Robpol86/terminaltables/issues/30
#- appveyor PushArtifact test_ascii_table.png https://github.com/Robpol86/terminaltables/issues/30
#- appveyor PushArtifact test_double_table.png https://github.com/Robpol86/terminaltables/issues/30
#- appveyor PushArtifact test_single_table.png https://github.com/Robpol86/terminaltables/issues/30
#- appveyor PushArtifact test_terminal_io.png https://github.com/Robpol86/terminaltables/issues/30

10
build.sh Normal file
View file

@ -0,0 +1,10 @@
echo assuming we still want to support python 2!
export PYTHONPATH=$PYTHONPATH:.
pylint terminaltables
flake8 terminaltables
python -m pytest terminaltables
python -m pytest --doctest-glob="terminaltables/**/*.py"
pytest tests -v --cov-report html:coverage --cov=terminaltables
echo not bumping version here, just checking if we can create the wheel
poetry build
check-wheel-contents dist/*.whl

View file

@ -1,23 +1,5 @@
# Configure.
env: TOX_ENV=py
language: python
matrix:
include:
- python: 3.5
env: TOX_ENV=lint
after_success:
- echo
- python: 3.5
env: TOX_ENV=docs
after_success:
- eval "$(ssh-agent -s)"; touch docs/key; chmod 0600 docs/key
- openssl aes-256-cbc -d -K "$encrypted_c89fed6a587d_key" -iv "$encrypted_c89fed6a587d_iv"
< docs/key.enc > docs/key && ssh-add docs/key
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- git remote set-url --push origin "git@github.com:$TRAVIS_REPO_SLUG"
- export ${!TRAVIS*}
- tox -e docsV
python:
- 3.5
- 3.4
@ -28,6 +10,25 @@ python:
- 2.6
sudo: false
# Environment and matrix.
env: TOX_ENV=py
matrix:
include:
- python: 3.5
env: TOX_ENV=lint
after_success: []
- python: 3.5
env: TOX_ENV=docs
after_success:
- eval "$(ssh-agent -s)"; touch docs/key; chmod 0600 $_
- openssl aes-256-cbc -d -K "$encrypted_c89fed6a587d_key" -iv "$encrypted_c89fed6a587d_iv" -out docs/key
< docs/key.enc && ssh-add $_
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- git remote set-url --push origin "git@github.com:$TRAVIS_REPO_SLUG"
- export ${!TRAVIS*}
- tox -e docsV
# Run.
install: pip install tox
script: tox -e $TOX_ENV

27
dead_code/appveyor.yml Normal file
View file

@ -0,0 +1,27 @@
# Configure.
environment:
PATH: C:\%PYTHON%;C:\%PYTHON%\Scripts;%PATH%
PYTHON: Python35
matrix:
- TOX_ENV: lint
- TOX_ENV: py35
- TOX_ENV: py34
- TOX_ENV: py33
- TOX_ENV: py27
- TOX_ENV: py
PYTHON: Python35-x64
- TOX_ENV: py
PYTHON: Python34-x64
- TOX_ENV: py
PYTHON: Python33-x64
- TOX_ENV: py
PYTHON: Python27-x64
# Run.
build_script: pip install tox
test_script: tox -e %TOX_ENV%
on_success: IF %TOX_ENV% NEQ lint pip install codecov & codecov
# Post.
on_finish:
- FOR %%F IN (test*.png) DO appveyor PushArtifact %%F

2
setup.py → dead_code/setup.py Executable file → Normal file
View file

@ -1,8 +1,6 @@
#!/usr/bin/env python
"""Setup script for the project."""
from __future__ import print_function
import codecs
import os
import re

View file

@ -9,6 +9,7 @@ import time
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
author = '@Robpol86'
copyright = '{}, {}'.format(time.strftime('%Y'), author)
html_last_updated_fmt = '%c {}'.format(time.tzname[time.localtime().tm_isdst])
master_doc = 'index'
project = __import__('setup').NAME
pygments_style = 'friendly'
@ -49,5 +50,6 @@ googleanalytics_id = 'UA-82627369-1'
# SCVersioning.
scv_banner_greatest_tag = True
scv_grm_exclude = ('.gitignore', '.nojekyll', 'README.rst')
scv_overflow = ('-W',)
scv_show_banner = True
scv_sort = ('semver', 'time')

1
publish.sh Normal file
View file

@ -0,0 +1 @@
rm -rf dist && poetry version patch && poetry build && twine upload dist/*

66
pyproject-whl.toml Normal file
View file

@ -0,0 +1,66 @@
[tool.poetry]
name = "terminaltables-whl"
version = "3.1.0"
description = "Generate simple tables in terminals from a nested list of strings."
authors = [
"Matthew Martin <matthewdeanmartin@gmail.com>",
"Robpol86 <robpol86@gmail.com>",
]
keywords = ["Shell","Bash","ANSI","ASCII","terminal","tables"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Terminals",
"Topic :: Text Processing :: Markup",
]
packages = [
{ include = "terminaltables" },
]
include = [
"terminaltables/**/*.py",
]
exclude = [
]
license = "MIT"
readme = "README.md"
repository = "https://github.com/matthewdeanmartin/terminaltables"
homepage = "https://github.com/matthewdeanmartin/terminaltables"
documentation = "https://github.com/matthewdeanmartin/terminaltables"
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/matthewdeanmartin/terminaltables/issues"
"Change Log" = "https://github.com/matthewdeanmartin/terminaltables/blob/main/docs/CHANGES.MD"
[tool.poetry.scripts]
[tool.poetry.dependencies]
# per vermin's estimation
python = ">=2.6 || >=3.0"
[tool.poetry.dev-dependencies]
pytest = "==6.0.1"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

66
pyproject.toml Normal file
View file

@ -0,0 +1,66 @@
[tool.poetry]
name = "terminaltables"
version = "3.1.10"
description = "Generate simple tables in terminals from a nested list of strings."
authors = [
"Robpol86 <robpol86@gmail.com>",
"Matthew Martin <matthewdeanmartin@gmail.com>"
]
keywords = ["Shell","Bash","ANSI","ASCII","terminal","tables"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: MacOS X",
"Environment :: Win32 (MS Windows)",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Terminals",
"Topic :: Text Processing :: Markup",
]
packages = [
{ include = "terminaltables" },
]
include = [
"terminaltables/**/*.py",
]
exclude = [
]
license = "MIT"
readme = "README.md"
repository = "https://github.com/matthewdeanmartin/terminaltables"
homepage = "https://github.com/matthewdeanmartin/terminaltables"
documentation = "https://github.com/matthewdeanmartin/terminaltables"
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/matthewdeanmartin/terminaltables/issues"
"Change Log" = "https://github.com/matthewdeanmartin/terminaltables/blob/master/CHANGELOG.md"
[tool.poetry.scripts]
[tool.poetry.dependencies]
# per vermin's estimation
python = ">=2.6 || >=3.0"
[tool.poetry.dev-dependencies]
pytest = "==6.0.1"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

View file

@ -100,7 +100,7 @@ def test_multi_line():
@pytest.mark.skipif(str(not IS_WINDOWS))
@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30
@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44
def test_windows_screenshot(tmpdir):
"""Test on Windows in a new console window. Take a screenshot to verify it works.

View file

@ -200,7 +200,7 @@ def test_multi_line():
@pytest.mark.skipif(str(not IS_WINDOWS))
@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30
@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44
def test_windows_screenshot(tmpdir):
"""Test on Windows in a new console window. Take a screenshot to verify it works.

View file

@ -201,7 +201,7 @@ def test_multi_line():
@pytest.mark.skipif(str(not IS_WINDOWS))
@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30
@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44
def test_windows_screenshot(tmpdir):
"""Test on Windows in a new console window. Take a screenshot to verify it works.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -15,7 +15,7 @@ from tests.test_terminal_io import MockKernel32
HERE = py.path.local(__file__).dirpath()
@pytest.mark.skip("Fails on windows, I didn't touch it")
@pytest.mark.parametrize('is_windows', [False, True])
@pytest.mark.parametrize('mode', ['ascii', 'unicode', 'bytes'])
def test(monkeypatch, is_windows, mode):
@ -54,8 +54,8 @@ def test(monkeypatch, is_windows, mode):
@pytest.mark.skipif(str(not IS_WINDOWS))
@pytest.mark.skipif('True') # https://github.com/Robpol86/terminaltables/issues/30
@pytest.mark.parametrize('mode', ['ascii', 'unicode', 'bytes'])
@pytest.mark.skip # https://github.com/Robpol86/terminaltables/issues/44
def test_windows_screenshot(tmpdir, mode):
"""Test function on Windows in a new console window. Take a screenshot to verify it works.
@ -65,7 +65,7 @@ def test_windows_screenshot(tmpdir, mode):
script = tmpdir.join('script.py')
command = [sys.executable, str(script)]
change_title = tmpdir.join('change_title')
screenshot = PROJECT_ROOT.join('test_terminal_io.png')
screenshot = PROJECT_ROOT.join('test_terminal_io_{0}.png'.format(mode))
if screenshot.check():
screenshot.remove()

18
tox.ini
View file

@ -28,20 +28,21 @@ commands =
flake8 --application-import-names={[general]name},tests
pylint --rcfile=tox.ini setup.py {[general]name}
deps =
flake8-docstrings==1.0.2
flake8-import-order==0.9.2
flake8==3.0.4
flake8-docstrings==1.0.3
flake8-import-order==0.12
flake8==3.3.0
pep8-naming==0.4.1
pylint==1.6.4
pydocstyle==1.1.1
pylint==1.6.5
[testenv:docs]
changedir = {toxinidir}/docs
commands =
sphinx-build . _build/html {posargs}
sphinx-build -W . _build/html {posargs}
deps =
robpol86-sphinxcontrib-googleanalytics==0.1
sphinx-rtd-theme==0.1.10a0
sphinx==1.4.8
sphinx-rtd-theme==0.2.4
sphinx==1.5.3
usedevelop = False
[testenv:docsV]
@ -49,13 +50,14 @@ commands =
sphinx-versioning push docs gh-pages .
deps =
{[testenv:docs]deps}
sphinxcontrib-versioning==2.2.0
sphinxcontrib-versioning==2.2.1
passenv =
HOME
HOSTNAME
SSH_AUTH_SOCK
TRAVIS*
USER
usedevelop = False
[flake8]
exclude = .tox/*,build/*,docs/*,env/*,get-pip.py