From b6888d7870ed01742976a278bc08915c837e49a3 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Wed, 18 Nov 2026 14:45:29 -0800 Subject: [PATCH 1/2] Support bibtexparser 2.x Use parse_file and entry keys when the v2 API is available, while retaining the v1 loader path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- comment_spell_check/utils/bibtex_loader.py | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/comment_spell_check/utils/bibtex_loader.py b/comment_spell_check/utils/bibtex_loader.py index 3373f78..ed3d5f9 100644 --- a/comment_spell_check/utils/bibtex_loader.py +++ b/comment_spell_check/utils/bibtex_loader.py @@ -28,12 +28,17 @@ def add_bibtex(spell: spellchecker.SpellChecker, filename: str): word_list = [] - with open(filename, "rt", encoding="utf-8") as biblatex_file: - bib_database = bibtexparser.load(biblatex_file) - - for k in bib_database.get_entry_dict().keys(): - words = split_bibtex_name(k) - word_list.extend(words) - - logger.info("Words: %s", word_list) - spell.word_frequency.load_words(word_list) + if hasattr(bibtexparser, "parse_file"): + bib_database = bibtexparser.parse_file(filename) + entry_keys = (entry.key for entry in bib_database.entries) + else: + with open(filename, "rt", encoding="utf-8") as biblatex_file: + bib_database = bibtexparser.load(biblatex_file) + entry_keys = bib_database.get_entry_dict() + + for key in entry_keys: + words = split_bibtex_name(key) + word_list.extend(words) + + logger.info("Words: %s", word_list) + spell.word_frequency.load_words(word_list) From 8ecbb1f1464038e29ac05d34a5767f2c6ed92c93 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Wed, 18 Nov 2026 16:01:22 -0800 Subject: [PATCH 2/2] Raise minimum Python version to 3.12 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 4 ++-- .github/workflows/python-app.yml | 8 +++---- conda-env.txt | 41 ++++++-------------------------- pyproject.toml | 3 ++- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cc13b6c..865a394 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,10 +22,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: Build package run: | python -m pip install twine build diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f55ee52..2dfa207 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -17,10 +17,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: "3.12" - name: set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v3 @@ -40,10 +40,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.12" cache: 'pip' - name: Install dependencies run: | diff --git a/conda-env.txt b/conda-env.txt index 761114b..25518cd 100644 --- a/conda-env.txt +++ b/conda-env.txt @@ -1,34 +1,7 @@ -# This file may be used to create an environment using: -# $ conda create --name --file -# platform: osx-64 -@EXPLICIT -https://conda.anaconda.org/conda-forge/osx-64/ca-certificates-2019.9.11-hecc5488_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/jpeg-9b-he5867d9_2.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libcxxabi-4.0.1-hcfea43d_1.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/xz-5.2.4-h1de35cc_4.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/zlib-1.2.11-h1de35cc_3.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libcxx-4.0.1-hcfea43d_1.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libpng-1.6.37-ha441bb4_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/openssl-1.1.1c-h01d97ff_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/tk-8.6.8-ha441bb4_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/zstd-1.3.7-h5bba6e5_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libffi-3.2.1-h475c297_4.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libtiff-4.0.10-hcb84e12_2.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/llvm-openmp-8.0.1-h770b8ee_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/ncurses-6.1-h0a44026_1.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/libedit-3.1.20181209-hb402a30_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/libgfortran-4.0.0-2.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/readline-7.0-h1de35cc_5.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/libopenblas-0.3.7-h4bb4525_1.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/sqlite-3.29.0-ha441bb4_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/libblas-3.8.0-12_openblas.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/python-3.7.4-h359304d_1.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/certifi-2019.9.11-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/libcblas-3.8.0-12_openblas.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/liblapack-3.8.0-12_openblas.tar.bz2 -https://conda.anaconda.org/simpleitk/label/dev/osx-64/simpleitk-1.2rc1-py37h0a44026_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/numpy-1.17.2-py37h6b0580a_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/setuptools-41.0.1-py37_0.tar.bz2 -https://conda.anaconda.org/conda-forge/osx-64/itk-5.0.1-py37_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/wheel-0.33.4-py37_0.tar.bz2 -https://repo.anaconda.com/pkgs/main/osx-64/pip-19.2.2-py37_0.tar.bz2 +# Create the environment with: +# conda create --name --file --override-channels \ +# --channel conda-forge --platform osx-64 +# Then run this in the activated environment: +# python -m pip install itk SimpleITK +python=3.12 +pip diff --git a/pyproject.toml b/pyproject.toml index 51ade0b..6bba9ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,9 +10,10 @@ authors = [ description = "A script to automatically spell checks comments of a codebase." readme = "README.md" license = {file = "LICENSE"} -requires-python = ">=3.8" +requires-python = ">=3.12" classifiers = [ "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ]