From 2d5c8f34d5e0833e0982c5fcebd3b839d2671b50 Mon Sep 17 00:00:00 2001 From: James B Date: Fri, 13 Sep 2024 15:17:05 +0100 Subject: [PATCH] python versions: Drop 3.7 & 3.8. Use 3.12 as working version. --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- .readthedocs.yaml | 2 +- CHANGELOG.md | 5 +++++ examples/help/create-template/expected.txt | 2 +- examples/help/flatten/expected.txt | 2 +- examples/help/unflatten/expected.txt | 6 +++--- flattentool/tests/test_docs.py | 6 +++--- flattentool/tests/test_json_input.py | 23 ++++------------------ setup.py | 1 + 10 files changed, 21 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2c79a2f..a086c0d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ jobs: - name: Setup python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: 3.12 architecture: x64 - uses: actions/cache@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d111d6..afc8581 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: [ '3.9', '3.10', '3.11', '3.12'] jsonref-version: ["==0.3", ">1"] steps: - uses: actions/checkout@v2 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 475ea97..655c6fd 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.12" # Build documentation in the docs/ directory with Sphinx sphinx: diff --git a/CHANGELOG.md b/CHANGELOG.md index 20bc107..18742d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Avoid deprecation warning from the ijson package. https://github.com/OpenDataServices/flatten-tool/pull/458 +### Removed + +- We no longer support Python 3.7 - security support has ended +- We no longer support Python 3.8 - security support ends 31 Oct 2024 + ## [0.26.0] - 2024-08-22 ### Fixed diff --git a/examples/help/create-template/expected.txt b/examples/help/create-template/expected.txt index 8cad1d8..8b2c468 100644 --- a/examples/help/create-template/expected.txt +++ b/examples/help/create-template/expected.txt @@ -7,7 +7,7 @@ usage: flatten-tool create-template [-h] -s SCHEMA [-f {csv,ods,xlsx,all}] [--line-terminator LINE_TERMINATOR] [--convert-wkt] -optional arguments: +options: -h, --help show this help message and exit -s SCHEMA, --schema SCHEMA Path to the schema file you want to use to create the diff --git a/examples/help/flatten/expected.txt b/examples/help/flatten/expected.txt index 44dae80..758da1c 100644 --- a/examples/help/flatten/expected.txt +++ b/examples/help/flatten/expected.txt @@ -16,7 +16,7 @@ usage: flatten-tool flatten [-h] [-s SCHEMA] [-f {csv,ods,xlsx,all}] [--xml] positional arguments: input_name Name of the input JSON file. -optional arguments: +options: -h, --help show this help message and exit -s SCHEMA, --schema SCHEMA Path to a relevant schema. diff --git a/examples/help/unflatten/expected.txt b/examples/help/unflatten/expected.txt index c3e3a84..06782b0 100644 --- a/examples/help/unflatten/expected.txt +++ b/examples/help/unflatten/expected.txt @@ -10,7 +10,7 @@ usage: flatten-tool unflatten [-h] -f {csv,ods,xlsx} [--xml] [--metatab-schema METATAB_SCHEMA] [--metatab-only] [--metatab-vertical-orientation] - [--xml-schema [XML_SCHEMA [XML_SCHEMA ...]]] + [--xml-schema [XML_SCHEMA ...]] [--default-configuration DEFAULT_CONFIGURATION] [--root-is-list] [--disable-local-refs] [--xml-comment XML_COMMENT] [--convert-wkt] @@ -19,7 +19,7 @@ usage: flatten-tool unflatten [-h] -f {csv,ods,xlsx} [--xml] positional arguments: input_name Name of the input file or directory. -optional arguments: +options: -h, --help show this help message and exit -f {csv,ods,xlsx}, --input-format {csv,ods,xlsx} File format of input file or directory. @@ -65,7 +65,7 @@ optional arguments: --metatab-vertical-orientation Read metatab so that headings are in the first column and data is read vertically. Only for XLSX not CSV - --xml-schema [XML_SCHEMA [XML_SCHEMA ...]] + --xml-schema [XML_SCHEMA ...] Path to one or more XML schemas (used for sorting) --default-configuration DEFAULT_CONFIGURATION Comma separated list of default parsing commands for diff --git a/flattentool/tests/test_docs.py b/flattentool/tests/test_docs.py index f44cbe8..5c8cac3 100644 --- a/flattentool/tests/test_docs.py +++ b/flattentool/tests/test_docs.py @@ -17,9 +17,9 @@ def _get_examples_in_docs_data(): examples_in_docs_data_geo = [] for root, dirs, files in os.walk("examples"): for filename in files: - if root.startswith("examples/help/") and sys.version_info[:2] != (3, 8): + if root.startswith("examples/help/") and sys.version_info[:2] != (3, 12): # Different versions of python produce differently formatted help output. - # We only test in one version, Python 3.8. + # We only test in one version, Python 3.12. # (Same as we lint code with, so dev's can have one virtual env) continue if "cmd.txt" in filename: @@ -154,7 +154,7 @@ def _test_example_in_doc_worker(root, filename): def test_expected_number_of_examples_in_docs_data(): expected = 68 # See _get_examples_in_docs_data() - if sys.version_info[:2] != (3, 8): + if sys.version_info[:2] != (3, 12): expected -= 3 # number of help tests assert len(examples_in_docs_data) + len(examples_in_docs_data_geo) == expected diff --git a/flattentool/tests/test_json_input.py b/flattentool/tests/test_json_input.py index acfbf15..a2f3c20 100644 --- a/flattentool/tests/test_json_input.py +++ b/flattentool/tests/test_json_input.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import os -import sys from collections import OrderedDict from decimal import Decimal @@ -990,24 +989,10 @@ def test_parse_bad_geojson(recwarn): str(w.message) == "Invalid GeoJSON: TypeError(\"'int' object is not iterable\")" ) w = recwarn.pop(UserWarning) - # There are different warning messages for Python versions before 3.8. This - # is because an old version of numpy is installed (the last compatible with - # these versions of Python), which has different messages. - if sys.version_info < (3, 8): - assert ( - str(w.message) - == "Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray." - ) - w = recwarn.pop(UserWarning) - assert ( - str(w.message) - == "Invalid GeoJSON: ValueError('linestrings: Input operand 0 does not have enough dimensions (has 1, gufunc core with signature (i, d)->() requires 2)')" - ) - else: - assert ( - str(w.message) - == "Invalid GeoJSON: ValueError('setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.')" - ) + assert ( + str(w.message) + == "Invalid GeoJSON: ValueError('setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.')" + ) assert len(recwarn.list) == 0 diff --git a/setup.py b/setup.py index d988807..89fd151 100644 --- a/setup.py +++ b/setup.py @@ -59,4 +59,5 @@ def run(self): }, package_data={"flattentool": ["locale/*/*/*.mo", "locale/*/*/*.po"]}, setup_requires=["babel"], + python_requires=">=3.9.0", )