From db016f2cc4d94d1380d3c34ae738bbdebbaffdc5 Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Fri, 5 Apr 2024 14:06:28 +0100 Subject: [PATCH 1/5] Fix codecov --- .codecov.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index fab7dc3..0203f36 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -3,9 +3,11 @@ coverage: project: python: target: 95% - flags: python + flags: + - python patch: python: target: 90% - flags: python + flags: + - python From e6e35f1716ef5fc0616476876fe8152be14b8d7d Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Fri, 5 Apr 2024 15:25:13 +0100 Subject: [PATCH 2/5] Fix hypothesis warnings --- python/tests/test_file_format.py | 8 +++++++- python/tests/test_storage.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/python/tests/test_file_format.py b/python/tests/test_file_format.py index 4072d87..9301dc0 100644 --- a/python/tests/test_file_format.py +++ b/python/tests/test_file_format.py @@ -15,9 +15,15 @@ import kastore.store as store # Set the deadline to None to avoid weird behaviour on CI. -hypothesis.settings.register_profile("kastore_defaults", deadline=None) +hypothesis.settings.register_profile( + "kastore_defaults", + deadline=None, + # Supress warnings resultsing from inheritance + suppress_health_check=(hypothesis.HealthCheck.differing_executors,), +) hypothesis.settings.load_profile("kastore_defaults") + # Exclude any 'other' unicode categories: # http://www.unicode.org/reports/tr44/#General_Category_Values key_alphabet = hst.characters(blacklist_categories=("C",)) diff --git a/python/tests/test_storage.py b/python/tests/test_storage.py index fdd621f..19e2028 100644 --- a/python/tests/test_storage.py +++ b/python/tests/test_storage.py @@ -12,8 +12,14 @@ import kastore as kas + # Set the deadline to None to avoid weird behaviour on CI. -hypothesis.settings.register_profile("kastore_defaults", deadline=None) +hypothesis.settings.register_profile( + "kastore_defaults", + deadline=None, + # Supress warnings resultsing from inheritance + suppress_health_check=(hypothesis.HealthCheck.differing_executors,), +) hypothesis.settings.load_profile("kastore_defaults") # Exclude any 'other' unicode categories: From 0b55d81231b3eee911e4ec18787cc20bfef6bc16 Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Fri, 5 Apr 2024 15:41:00 +0100 Subject: [PATCH 3/5] Require Py3.8, update pre-commit --- .circleci/config.yml | 2 +- .github/workflows/tests.yml | 2 +- .github/workflows/wheels.yml | 20 ++------------------ .pre-commit-config.yaml | 14 +++++++------- python/CHANGELOG.rst | 7 +++++++ python/kastore/cli.py | 6 +++--- python/kastore/exceptions.py | 7 ++++--- python/kastore/store.py | 16 +++++++++------- python/make_standard_files.py | 7 ++++--- python/setup.cfg | 3 +-- python/stress_lowlevel.py | 10 ++++++---- python/tests/test_cli.py | 7 ++++--- python/tests/test_errors.py | 7 ++++--- python/tests/test_file_format.py | 7 ++++--- python/tests/test_fileobj.py | 7 ++++--- python/tests/test_interface.py | 7 ++++--- python/tests/test_lowlevel.py | 8 +++++--- python/tests/test_standard_files.py | 7 ++++--- python/tests/test_storage.py | 8 +++++--- 19 files changed, 79 insertions(+), 73 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0575214..1c409fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: jobs: build: docker: - - image: cimg/python:3.7 + - image: cimg/python:3.8 steps: - checkout - run: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef62bb0..2a860d2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python: [ 3.7, 3.11 ] + python: [ 3.8, 3.11 ] os: [ macos-latest, ubuntu-latest, windows-latest ] defaults: run: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index dd758b3..c088055 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -15,7 +15,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python: [3.7, 3.8, 3.9, "3.10", 3.11] + python: [3.8, 3.9, "3.10", 3.11] wordsize: [64] steps: - name: Checkout @@ -58,7 +58,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python: [3.7, 3.8, 3.9, "3.10", 3.11] + python: [3.8, 3.9, "3.10", 3.11] steps: - name: Checkout uses: actions/checkout@v2 @@ -180,22 +180,6 @@ jobs: pip install -r python/requirements/CI/tests/requirements.txt python -m pytest -v python - - name: Set up Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Run tests (3.7) - run: | - python -VV - # We install in this odd way to make sure we get both deps and a local kastore - pip install kastore --only-binary kastore -f python/dist/wheelhouse - pip uninstall -y kastore - pip install -v kastore --only-binary kastore -f python/dist/wheelhouse --no-index - python -c "import kastore" - pip install -r python/requirements/CI/tests/requirements.txt - python -m pytest -v python - - name: Upload Wheels uses: actions/upload-artifact@v2 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa57d6e..3c32b14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-merge-conflict - id: debug-statements @@ -13,29 +13,29 @@ repos: - id: clang-format verbose: true - repo: https://github.com/asottile/reorder_python_imports - rev: v3.9.0 + rev: v3.12.0 hooks: - id: reorder-python-imports args: [--application-directories=python, --unclassifiable-application-module=_kastore] - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.15.2 hooks: - id: pyupgrade - args: [--py3-plus, --py37-plus] + args: [--py3-plus, --py38-plus] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.3.0 hooks: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 args: [--config=python/.flake8] additional_dependencies: ["flake8-bugbear==20.1.4", "flake8-builtins==1.5.2"] - repo: https://github.com/asottile/blacken-docs - rev: 1.13.0 + rev: 1.16.0 hooks: - id: blacken-docs additional_dependencies: [black==23.3.0] diff --git a/python/CHANGELOG.rst b/python/CHANGELOG.rst index 7bd9ae8..0c9fa48 100644 --- a/python/CHANGELOG.rst +++ b/python/CHANGELOG.rst @@ -1,3 +1,10 @@ +-------------------- +[0.3.X] - 202X-XX-XX +-------------------- + +kastore now requires Python 3.8 or later. + + -------------------- [0.3.2] - 2022-07-12 -------------------- diff --git a/python/kastore/cli.py b/python/kastore/cli.py index 0a842f5..a1c48af 100644 --- a/python/kastore/cli.py +++ b/python/kastore/cli.py @@ -1,6 +1,3 @@ -""" -The CLI for kastore. Provides utilities for examining kastore files. -""" import argparse import logging import os @@ -10,6 +7,9 @@ import kastore +""" +The CLI for kastore. Provides utilities for examining kastore files. +""" logger = logging.getLogger(__name__) diff --git a/python/kastore/exceptions.py b/python/kastore/exceptions.py index b0da6d7..bd4cb8e 100644 --- a/python/kastore/exceptions.py +++ b/python/kastore/exceptions.py @@ -1,11 +1,12 @@ -""" -Exception definitions for kastore. -""" from _kastore import FileFormatError from _kastore import KastoreException from _kastore import VersionTooNewError from _kastore import VersionTooOldError +""" +Exception definitions for kastore. +""" + # Some exceptions are defined in the low-level module. In particular, the # superclass of all exceptions for kastore is defined here. We define the # docstrings here to avoid difficulties with compiling C code on diff --git a/python/kastore/store.py b/python/kastore/store.py index b312fb1..fe09e2f 100644 --- a/python/kastore/store.py +++ b/python/kastore/store.py @@ -1,3 +1,12 @@ +import logging +import os +import struct +from collections.abc import Mapping + +import numpy as np + +import kastore.exceptions as exceptions + """ The Python engine for kastore. @@ -14,14 +23,7 @@ + 8 byte bounaries. +===================================+ """ -import logging -import os -import struct -from collections.abc import Mapping - -import numpy as np -import kastore.exceptions as exceptions logger = logging.getLogger(__name__) diff --git a/python/make_standard_files.py b/python/make_standard_files.py index cce9c22..fbbe757 100644 --- a/python/make_standard_files.py +++ b/python/make_standard_files.py @@ -1,6 +1,3 @@ -""" -Makes the files in the test-data directory. -""" import os.path import struct import tempfile @@ -10,6 +7,10 @@ import kastore as kas import kastore.store as store +""" +Makes the files in the test-data directory. +""" + class MalformedFilesBuilder: """ diff --git a/python/setup.cfg b/python/setup.cfg index 701e6f7..73e2279 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -19,7 +19,6 @@ classifiers = Topic :: Scientific/Engineering :: Bio-Informatics License :: OSI Approved :: MIT License Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -36,7 +35,7 @@ platforms = [options] packages = kastore -python_requires = >=3.7 +python_requires = >=3.8 include_package_data = True install_requires = numpy>=1.7 diff --git a/python/stress_lowlevel.py b/python/stress_lowlevel.py index 92b9195..b1019ab 100644 --- a/python/stress_lowlevel.py +++ b/python/stress_lowlevel.py @@ -1,7 +1,3 @@ -""" -Code to stress the low-level API as much as possible to expose -any memory leaks or error handling issues. -""" import argparse import os import random @@ -16,6 +12,12 @@ import tests.test_storage as test_storage +""" +Code to stress the low-level API as much as possible to expose +any memory leaks or error handling issues. +""" + + def main(): modules = { "errors": test_errors, diff --git a/python/tests/test_cli.py b/python/tests/test_cli.py index 5130f67..c15f3c9 100644 --- a/python/tests/test_cli.py +++ b/python/tests/test_cli.py @@ -1,6 +1,3 @@ -""" -Test cases for the kastore CLI. -""" import io import logging import os @@ -16,6 +13,10 @@ import kastore.__main__ as main import kastore.cli as cli +""" +Test cases for the kastore CLI. +""" + def capture_output(func, *args, **kwargs): """ diff --git a/python/tests/test_errors.py b/python/tests/test_errors.py index 90951c9..59a0ea9 100644 --- a/python/tests/test_errors.py +++ b/python/tests/test_errors.py @@ -1,6 +1,3 @@ -""" -Tests for error conditions. -""" import os import platform import struct @@ -12,6 +9,10 @@ import kastore as kas import kastore.store as store +""" +Tests for error conditions. +""" + IS_WINDOWS = platform.system() == "Windows" diff --git a/python/tests/test_file_format.py b/python/tests/test_file_format.py index 9301dc0..df6dc44 100644 --- a/python/tests/test_file_format.py +++ b/python/tests/test_file_format.py @@ -1,6 +1,3 @@ -""" -Tests checking that the file format is as it should be. -""" import os import pathlib import struct @@ -14,6 +11,10 @@ import kastore as kas import kastore.store as store +""" +Tests checking that the file format is as it should be. +""" + # Set the deadline to None to avoid weird behaviour on CI. hypothesis.settings.register_profile( "kastore_defaults", diff --git a/python/tests/test_fileobj.py b/python/tests/test_fileobj.py index 7860bcb..ee1c4e1 100644 --- a/python/tests/test_fileobj.py +++ b/python/tests/test_fileobj.py @@ -1,6 +1,3 @@ -""" -Tests for load()ing and dump()ing with file-like objects. -""" import multiprocessing import os import pathlib @@ -17,6 +14,10 @@ import kastore as kas +""" +Tests for load()ing and dump()ing with file-like objects. +""" + IS_WINDOWS = platform.system() == "Windows" diff --git a/python/tests/test_interface.py b/python/tests/test_interface.py index a0e608f..5c6b4e3 100644 --- a/python/tests/test_interface.py +++ b/python/tests/test_interface.py @@ -1,6 +1,3 @@ -""" -Basic tests for the information API. -""" import io import os import pathlib @@ -12,6 +9,10 @@ import kastore as kas import kastore.exceptions as exceptions +""" +Basic tests for the information API. +""" + class InterfaceTest(unittest.TestCase): """ diff --git a/python/tests/test_lowlevel.py b/python/tests/test_lowlevel.py index da6bd84..d454f14 100644 --- a/python/tests/test_lowlevel.py +++ b/python/tests/test_lowlevel.py @@ -1,6 +1,3 @@ -""" -Tests for the low-level C interface -""" import os import platform import tempfile @@ -10,6 +7,11 @@ import _kastore +""" +Tests for the low-level C interface +""" + + IS_WINDOWS = platform.system() == "Windows" diff --git a/python/tests/test_standard_files.py b/python/tests/test_standard_files.py index 45206bb..5b750bf 100644 --- a/python/tests/test_standard_files.py +++ b/python/tests/test_standard_files.py @@ -1,6 +1,3 @@ -""" -Tests reading in the standard test files. -""" import os.path import unittest @@ -8,6 +5,10 @@ import kastore as kas +""" +Tests reading in the standard test files. +""" + class StandardFilesMixin: """ diff --git a/python/tests/test_storage.py b/python/tests/test_storage.py index 19e2028..022defe 100644 --- a/python/tests/test_storage.py +++ b/python/tests/test_storage.py @@ -1,6 +1,3 @@ -""" -Basic tests for the storage integrity of the data. -""" import os import tempfile import unittest @@ -13,6 +10,11 @@ import kastore as kas +""" +Basic tests for the storage integrity of the data. +""" + + # Set the deadline to None to avoid weird behaviour on CI. hypothesis.settings.register_profile( "kastore_defaults", From 0d8d22a0ef700be211a8a279251714da825c875b Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Fri, 5 Apr 2024 16:18:42 +0100 Subject: [PATCH 4/5] Fix docs build --- docs/conf.py | 2 +- python/requirements/development.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 0f821f6..dca3b31 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -76,7 +76,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/python/requirements/development.txt b/python/requirements/development.txt index 9519b1b..54f5211 100644 --- a/python/requirements/development.txt +++ b/python/requirements/development.txt @@ -1,4 +1,5 @@ attrs +breathe==4.35.0 coverage flake8 hypothesis @@ -9,5 +10,6 @@ numpy mock pre-commit breathe +Sphinx==5.3.0 sphinx_rtd_theme sphinx-issues From 4b0ee050a9f980a1f163d905edd3377d8aa2f2f4 Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Fri, 5 Apr 2024 16:29:53 +0100 Subject: [PATCH 5/5] Update mergify --- .mergify.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index 4ec47ac..a31212e 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -4,11 +4,11 @@ queue_rules: - "#approved-reviews-by>=1" - "#changes-requested-reviews-by=0" - status-success=Lint - - status-success=Python (3.7, macos-latest) + - status-success=Python (3.8, macos-latest) - status-success=Python (3.11, macos-latest) - - status-success=Python (3.7, ubuntu-latest) + - status-success=Python (3.8, ubuntu-latest) - status-success=Python (3.11, ubuntu-latest) - - status-success=Python (3.7, windows-latest) + - status-success=Python (3.8, windows-latest) - status-success=Python (3.11, windows-latest) - "status-success=ci/circleci: build" @@ -21,11 +21,11 @@ pull_request_rules: - base=main - label=AUTOMERGE-REQUESTED - status-success=Lint - - status-success=Python (3.7, macos-latest) + - status-success=Python (3.8, macos-latest) - status-success=Python (3.11, macos-latest) - - status-success=Python (3.7, ubuntu-latest) + - status-success=Python (3.8, ubuntu-latest) - status-success=Python (3.11, ubuntu-latest) - - status-success=Python (3.7, windows-latest) + - status-success=Python (3.8, windows-latest) - status-success=Python (3.11, windows-latest) - "status-success=ci/circleci: build" actions: