Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-prettytable for openSUSE:Factory checked in at 2023-09-08 21:15:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-prettytable (Old) and /work/SRC/openSUSE:Factory/.python-prettytable.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-prettytable" Fri Sep 8 21:15:01 2023 rev:9 rq:1109518 version:3.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-prettytable/python-prettytable.changes 2023-05-09 13:06:43.896804486 +0200 +++ /work/SRC/openSUSE:Factory/.python-prettytable.new.1766/python-prettytable.changes 2023-09-08 21:15:16.997917910 +0200 @@ -1,0 +2,7 @@ +Thu Sep 7 11:15:30 UTC 2023 - Dirk Müller <[email protected]> + +- update to 3.8.0: + * Add `get_formatted_string()` convenience function (#241) + * Drop support for EOL Python 3.7 (#245) + +------------------------------------------------------------------- Old: ---- prettytable-3.7.0.tar.gz New: ---- prettytable-3.8.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-prettytable.spec ++++++ --- /var/tmp/diff_new_pack.novZWA/_old 2023-09-08 21:15:18.181960227 +0200 +++ /var/tmp/diff_new_pack.novZWA/_new 2023-09-08 21:15:18.185960370 +0200 @@ -17,10 +17,9 @@ # -%define skip_python2 1 %{?sle15_python_module_pythons} Name: python-prettytable -Version: 3.7.0 +Version: 3.8.0 Release: 0 Summary: Library for displaying tabular data in formatted fashion License: BSD-2-Clause ++++++ prettytable-3.7.0.tar.gz -> prettytable-3.8.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/.github/workflows/lint.yml new/prettytable-3.8.0/.github/workflows/lint.yml --- old/prettytable-3.7.0/.github/workflows/lint.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/.github/workflows/lint.yml 2020-02-02 01:00:00.000000000 +0100 @@ -2,6 +2,9 @@ on: [push, pull_request, workflow_dispatch] +permissions: + contents: read + jobs: lint: runs-on: ubuntu-latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/.github/workflows/release.yml new/prettytable-3.8.0/.github/workflows/release.yml --- old/prettytable-3.7.0/.github/workflows/release.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/.github/workflows/release.yml 2020-02-02 01:00:00.000000000 +0100 @@ -42,4 +42,4 @@ with: user: jazzband password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository_url: https://jazzband.co/projects/prettytable/upload + repository-url: https://jazzband.co/projects/prettytable/upload diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/.github/workflows/require-pr-label.yml new/prettytable-3.8.0/.github/workflows/require-pr-label.yml --- old/prettytable-3.7.0/.github/workflows/require-pr-label.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/.github/workflows/require-pr-label.yml 2020-02-02 01:00:00.000000000 +0100 @@ -8,8 +8,11 @@ label: runs-on: ubuntu-latest + permissions: + issues: write + steps: - - uses: mheap/github-action-required-labels@v3 + - uses: mheap/github-action-required-labels@v4 with: mode: minimum count: 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/.github/workflows/test.yml new/prettytable-3.8.0/.github/workflows/test.yml --- old/prettytable-3.7.0/.github/workflows/test.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/.github/workflows/test.yml 2020-02-02 01:00:00.000000000 +0100 @@ -11,7 +11,7 @@ strategy: fail-fast: false matrix: - python-version: ["pypy3.9", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] + python-version: ["pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12"] os: [windows-latest, macos-latest, ubuntu-latest] steps: @@ -21,6 +21,7 @@ uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true cache: pip cache-dependency-path: pyproject.toml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/.pre-commit-config.yaml new/prettytable-3.8.0/.pre-commit-config.yaml --- old/prettytable-3.7.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 @@ -1,9 +1,9 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py38-plus] - repo: https://github.com/psf/black rev: 23.3.0 @@ -33,34 +33,35 @@ hooks: - id: check-case-conflict - id: check-merge-conflict + - id: check-json - id: check-toml - id: check-yaml - id: end-of-file-fixer - repo: https://github.com/tox-dev/pyproject-fmt - rev: 0.9.2 + rev: 0.10.0 hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.12.2 + rev: v0.13 hooks: - id: validate-pyproject - repo: https://github.com/tox-dev/tox-ini-fmt - rev: 1.0.0 + rev: 1.3.0 hooks: - id: tox-ini-fmt - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier args: [--prose-wrap=always, --print-width=88] exclude: ^.github/ISSUE_TEMPLATE/bug_report.md$ - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.1.1" + rev: "v1.3.0" hooks: - id: mypy additional_dependencies: [types-colorama, types-setuptools] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/PKG-INFO new/prettytable-3.8.0/PKG-INFO --- old/prettytable-3.7.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: prettytable -Version: 3.7.0 +Version: 3.8.0 Summary: A simple Python library for easily displaying tabular data in a visually appealing ASCII table format Project-URL: Changelog, https://github.com/jazzband/prettytable/releases Project-URL: Homepage, https://github.com/jazzband/prettytable @@ -13,7 +13,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 @@ -23,8 +22,7 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Text Processing Classifier: Typing :: Typed -Requires-Python: >=3.7 -Requires-Dist: importlib-metadata; python_version < '3.8' +Requires-Python: >=3.8 Requires-Dist: wcwidth Provides-Extra: tests Requires-Dist: pytest; extra == 'tests' @@ -237,6 +235,17 @@ `print(x)`. You can now do all the usual things you can do with a string, like write your table to a file or insert it into a GUI. +The table can be displayed in several different formats using `get_formatted_string` by +changing the `out_format=<text|html|json|csv|latex>`. This function passes through +arguments to the functions that render the table, so additional arguments can be given. +This provides a way to let a user choose the output formatting. + +```python +def my_cli_function(table_format: str = 'text'): + ... + print(x.get_formatted_string(table_format)) +``` + #### Controlling which data gets displayed If you like, you can restrict the output of `print(x)` or `x.get_string` to only the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/README.md new/prettytable-3.8.0/README.md --- old/prettytable-3.7.0/README.md 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/README.md 2020-02-02 01:00:00.000000000 +0100 @@ -203,6 +203,17 @@ `print(x)`. You can now do all the usual things you can do with a string, like write your table to a file or insert it into a GUI. +The table can be displayed in several different formats using `get_formatted_string` by +changing the `out_format=<text|html|json|csv|latex>`. This function passes through +arguments to the functions that render the table, so additional arguments can be given. +This provides a way to let a user choose the output formatting. + +```python +def my_cli_function(table_format: str = 'text'): + ... + print(x.get_formatted_string(table_format)) +``` + #### Controlling which data gets displayed If you like, you can restrict the output of `print(x)` or `x.get_string` to only the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/pyproject.toml new/prettytable-3.8.0/pyproject.toml --- old/prettytable-3.7.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -12,13 +12,12 @@ license = {text = "BSD (3 clause)"} maintainers = [{name ="Jazzband"}] authors = [{name = "Luke Maurits", email = "[email protected]"}] -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -33,7 +32,6 @@ "version", ] dependencies = [ - 'importlib-metadata; python_version < "3.8"', "wcwidth", ] [project.optional-dependencies] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/src/prettytable/__init__.py new/prettytable-3.8.0/src/prettytable/__init__.py --- old/prettytable-3.7.0/src/prettytable/__init__.py 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/src/prettytable/__init__.py 2020-02-02 01:00:00.000000000 +0100 @@ -44,11 +44,6 @@ "from_json", ] -try: - # Python 3.8+ - import importlib.metadata as importlib_metadata -except ImportError: - # <Python 3.7 and lower - import importlib_metadata # type: ignore +import importlib.metadata -__version__ = importlib_metadata.version(__name__) +__version__ = importlib.metadata.version(__name__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/src/prettytable/prettytable.py new/prettytable-3.8.0/src/prettytable/prettytable.py --- old/prettytable-3.7.0/src/prettytable/prettytable.py 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/src/prettytable/prettytable.py 2020-02-02 01:00:00.000000000 +0100 @@ -1511,6 +1511,28 @@ def copy(self): return copy.deepcopy(self) + def get_formatted_string(self, out_format: str = "text", **kwargs) -> str: + """Return string representation of specified format of table in current state. + + Arguments: + out_format - resulting table format + kwargs - passed through to function that performs formatting + """ + if out_format == "text": + return self.get_string(**kwargs) + if out_format == "html": + return self.get_html_string(**kwargs) + if out_format == "json": + return self.get_json_string(**kwargs) + if out_format == "csv": + return self.get_csv_string(**kwargs) + if out_format == "latex": + return self.get_latex_string(**kwargs) + raise ValueError( + f"Invalid format {out_format}. " + "Must be one of: text, html, json, csv, or latex" + ) + ############################## # MISC PRIVATE METHODS # ############################## diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/tests/test_prettytable.py new/prettytable-3.8.0/tests/test_prettytable.py --- old/prettytable-3.7.0/tests/test_prettytable.py 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/tests/test_prettytable.py 2020-02-02 01:00:00.000000000 +0100 @@ -2095,3 +2095,50 @@ </table> """.strip() # noqa: E501 ) + + +class TestGeneralOutput: + def test_text(self): + t = helper_table() + assert t.get_formatted_string("text") == t.get_string() + # test with default arg, too + assert t.get_formatted_string() == t.get_string() + # args passed through + assert t.get_formatted_string(border=False) == t.get_string(border=False) + + def test_csv(self): + t = helper_table() + assert t.get_formatted_string("csv") == t.get_csv_string() + # args passed through + assert t.get_formatted_string("csv", border=False) == t.get_csv_string( + border=False + ) + + def test_json(self): + t = helper_table() + assert t.get_formatted_string("json") == t.get_json_string() + # args passed through + assert t.get_formatted_string("json", border=False) == t.get_json_string( + border=False + ) + + def test_html(self): + t = helper_table() + assert t.get_formatted_string("html") == t.get_html_string() + # args passed through + assert t.get_formatted_string("html", border=False) == t.get_html_string( + border=False + ) + + def test_latex(self): + t = helper_table() + assert t.get_formatted_string("latex") == t.get_latex_string() + # args passed through + assert t.get_formatted_string("latex", border=False) == t.get_latex_string( + border=False + ) + + def test_invalid(self): + t = helper_table() + with pytest.raises(ValueError): + t.get_formatted_string("pdf") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prettytable-3.7.0/tox.ini new/prettytable-3.8.0/tox.ini --- old/prettytable-3.7.0/tox.ini 2020-02-02 01:00:00.000000000 +0100 +++ new/prettytable-3.8.0/tox.ini 2020-02-02 01:00:00.000000000 +0100 @@ -1,13 +1,14 @@ [tox] -envlist = +requires = + tox>=4.2 +env_list = lint - py{py3, 312, 311, 310, 39, 38, 37} -isolated_build = true + py{py3, 312, 311, 310, 39, 38} [testenv] extras = tests -passenv = +pass_env = FORCE_COLOR commands = {envpython} -m pytest \ @@ -20,7 +21,7 @@ skip_install = true deps = pre-commit -passenv = +pass_env = PRE_COMMIT_COLOR commands = pre-commit run --all-files --show-diff-on-failure
