From f3ebddd53a5671637ee45bfdf82a4b1168917e6a Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:24:26 +0100 Subject: [PATCH 01/12] test on python 3.12, drop testing on python < 3.10 --- .github/workflows/test.yml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0df9b7e..3c52168 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', ] + python-version: [ '3.10', '3.11', '3.12' ] name: Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 diff --git a/setup.py b/setup.py index d4b6b84..b1d3ec1 100644 --- a/setup.py +++ b/setup.py @@ -41,10 +41,9 @@ def _get_description(): "License :: OSI Approved :: MIT License", "Programming Language :: Python", "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", ], project_urls={ "Documentation": "https://democracyclub.github.io/uk-election-ids/", From d107b9cf245587e8d8bfea8dbbc4d94c22e8927f Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:25:49 +0100 Subject: [PATCH 02/12] whitespace --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c52168..99ad23f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,14 +9,15 @@ jobs: name: Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: x64 + - name: Install run: pip install . + - name: Test run: python run_tests.py - - From dd2d822f44a132acc65425fd011d1354c6b0c97d Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:27:44 +0100 Subject: [PATCH 03/12] remove old build script (not used anymore) --- build.sh | 7 ------- 1 file changed, 7 deletions(-) delete mode 100755 build.sh diff --git a/build.sh b/build.sh deleted file mode 100755 index b0a0417..0000000 --- a/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -pip install "setuptools>=38.6.0" -pip install "twine>=1.11.0" -python setup.py sdist From 8ec5f708bcb71a749b0f1502bdb266dbbc827e6d Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:35:49 +0100 Subject: [PATCH 04/12] pin all dec packages, split docs and dev packages --- dev-requirements.txt | 2 -- setup.py | 14 ++++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 dev-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 68b252b..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -pre-commit==3.5.0 -ruff==0.3.7 diff --git a/setup.py b/setup.py index b1d3ec1..527bcfc 100644 --- a/setup.py +++ b/setup.py @@ -28,13 +28,15 @@ def _get_description(): long_description_content_type="text/markdown", extras_require={ "testing": ["coveralls"], + "docs": [ + "sphinx==7.1.2", + "sphinx_rtd_theme==2.0.0", + "ghp-import==2.1.0" + ], "development": [ - "sphinx", - "sphinx_rtd_theme", - "ghp-import", - "pydantic", - "black==23.3.0", - "ruff==0.0.261", + "pydantic==1.10.18", + "pre-commit==3.5.0", + "ruff==0.3.7", ], }, classifiers=[ From 4eea5253697a6cb443a0c31fc7195981c5d7ca65 Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:36:02 +0100 Subject: [PATCH 05/12] get schema tests running --- tests/data_schemas.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/data_schemas.py b/tests/data_schemas.py index 709ed12..f4914ed 100644 --- a/tests/data_schemas.py +++ b/tests/data_schemas.py @@ -39,12 +39,8 @@ def _recurse_defaults(d: dict): _recurse_defaults(values["defaults"]) return values - # import ipdb; ipdb.set_trace() - # return super().validate(value) - if __name__ == "__main__": - data = Path(__file__).parent / "voting_systems.json" + data = Path(__file__).parent.parent / "uk_election_ids" / "data" /"voting_systems.json" schema = VotingSystemSchema.parse_file(data) VotingSystemSchema.validate(schema) - # print(schema) From 84938fcb7f5e88f375ca607529e9fbde3c632640 Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:36:50 +0100 Subject: [PATCH 06/12] run schema tests in CI --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 99ad23f..aeee927 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,9 @@ jobs: architecture: x64 - name: Install - run: pip install . + run: pip install .[development] - name: Test - run: python run_tests.py + run: | + python run_tests.py + python tests/data_schemas.py From e8d9a59fa0fd124ba7596fd2cdc979ad1fdb1608 Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:45:06 +0100 Subject: [PATCH 07/12] run ruff in CI --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aeee927..d985987 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,11 @@ jobs: - name: Install run: pip install .[development] + - name: Lint + run: | + ruff format . --check + ruff check . + - name: Test run: | python run_tests.py From 45a3cf9d1692bcd02339410916a560a0e265f58c Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:45:38 +0100 Subject: [PATCH 08/12] ruff format --- setup.py | 2 +- tests/data_schemas.py | 7 ++++++- tests/test_slugger.py | 1 - uk_election_ids/parser.py | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 527bcfc..76ce6b4 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def _get_description(): "docs": [ "sphinx==7.1.2", "sphinx_rtd_theme==2.0.0", - "ghp-import==2.1.0" + "ghp-import==2.1.0", ], "development": [ "pydantic==1.10.18", diff --git a/tests/data_schemas.py b/tests/data_schemas.py index f4914ed..e62840e 100644 --- a/tests/data_schemas.py +++ b/tests/data_schemas.py @@ -41,6 +41,11 @@ def _recurse_defaults(d: dict): if __name__ == "__main__": - data = Path(__file__).parent.parent / "uk_election_ids" / "data" /"voting_systems.json" + data = ( + Path(__file__).parent.parent + / "uk_election_ids" + / "data" + / "voting_systems.json" + ) schema = VotingSystemSchema.parse_file(data) VotingSystemSchema.validate(schema) diff --git a/tests/test_slugger.py b/tests/test_slugger.py index 843ed9d..2ca7f30 100644 --- a/tests/test_slugger.py +++ b/tests/test_slugger.py @@ -6,7 +6,6 @@ class TestSlugify(TestCase): - """ For this particular use-case, we are primarily concerned with 1. Slugging characters that appear in names of places in the UK sensibly diff --git a/uk_election_ids/parser.py b/uk_election_ids/parser.py index 52ddb2d..95239a3 100644 --- a/uk_election_ids/parser.py +++ b/uk_election_ids/parser.py @@ -4,7 +4,6 @@ class DataPackageParser: - """ Parser which uses the data in datapackage.py to build a dict of IdSpec() objects which describe what sort of From c26604201e27ba221997bd2b9d19842b39ce3dcb Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:48:39 +0100 Subject: [PATCH 09/12] replace broken travis ci badge with github workflow badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd5869a..b32a172 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Create and validate Democracy Club Election Identifiers. --- -[![Build Status](https://travis-ci.org/DemocracyClub/uk-election-ids.svg?branch=master)](https://travis-ci.org/DemocracyClub/uk-election-ids) +[![Run tests](https://github.com/DemocracyClub/uk-election-ids/actions/workflows/test.yml/badge.svg)](https://github.com/DemocracyClub/uk-election-ids/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/DemocracyClub/uk-election-ids/badge.svg?branch=master)](https://coveralls.io/github/DemocracyClub/uk-election-ids?branch=master) ![PyPI Version](https://img.shields.io/pypi/v/uk-election-ids.svg) ![License](https://img.shields.io/pypi/l/uk-election-ids.svg) From 1cc2207899b6a3ea8253020bce3e33e3abf85b6c Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:49:03 +0100 Subject: [PATCH 10/12] remove coveralls badge we're not actually reporting coverage when we build any more so lets ditch this for now --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b32a172..afd9b70 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ Create and validate Democracy Club Election Identifiers. --- [![Run tests](https://github.com/DemocracyClub/uk-election-ids/actions/workflows/test.yml/badge.svg)](https://github.com/DemocracyClub/uk-election-ids/actions/workflows/test.yml) -[![Coverage Status](https://coveralls.io/repos/github/DemocracyClub/uk-election-ids/badge.svg?branch=master)](https://coveralls.io/github/DemocracyClub/uk-election-ids?branch=master) ![PyPI Version](https://img.shields.io/pypi/v/uk-election-ids.svg) ![License](https://img.shields.io/pypi/l/uk-election-ids.svg) ![Python Support](https://img.shields.io/pypi/pyversions/uk-election-ids.svg) From 4c725dcebd10eee9089c9a82c0313e3ed18a98e4 Mon Sep 17 00:00:00 2001 From: chris48s Date: Tue, 24 Sep 2024 10:49:49 +0100 Subject: [PATCH 11/12] remove black badge we don't use black anymore --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index afd9b70..0007245 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Create and validate Democracy Club Election Identifiers. ![PyPI Version](https://img.shields.io/pypi/v/uk-election-ids.svg) ![License](https://img.shields.io/pypi/l/uk-election-ids.svg) ![Python Support](https://img.shields.io/pypi/pyversions/uk-election-ids.svg) -![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg) * Installation: `pip install uk-election-ids` * [Documentation](https://democracyclub.github.io/uk-election-ids/) From 146d9dad81b7fcc1dcc8ae5c87f42f8af42367c0 Mon Sep 17 00:00:00 2001 From: chris48s Date: Wed, 25 Sep 2024 14:13:46 +0100 Subject: [PATCH 12/12] remove old .tavis.yml --- .travis.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5f4b7f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -dist: xenial -language: python -python: - - '3.4' - - '3.5' - - '3.6' - - '3.7' - - '3.8' -matrix: - include: - - python: '3.8' - env: BLACK=1 -install: - - pip install --upgrade pip - - pip install -e .[testing] -script: - - coverage run --source=uk_election_ids ./run_tests.py - - sh -c "if [ '$BLACK' = '1' ]; then pip install black ; fi" - - sh -c "if [ '$BLACK' = '1' ]; then black --check . ; fi" -after_success: - - coveralls