diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index 4599f672..352f42ad 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -5,19 +5,19 @@ on: [push, pull_request] jobs: build-deb-package: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: build - uses: dawidd6/action-debian-package@v1.4.4 + uses: dawidd6/action-debian-package@v1.6.0 with: # Optional, relative to workspace directory source_directory: . # Optional, relative to workspace directory artifacts_directory: output # Optional, value from `debian/changelog` is used if not defined - os_distribution: jammy + os_distribution: noble # Optional, target architecture, defaults to amd64 cpu_architecture: amd64 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3964c807..254b2694 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - os: [macos-12, macos-13, ubuntu-20.04, ubuntu-22.04] + os: [macos-13, ubuntu-22.04, ubuntu-24.04] steps: - uses: actions/checkout@v4 @@ -35,8 +35,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update - sudo apt-get -y install -qq gettext gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-gtksource-4 gir1.2-pango-1.0 gir1.2-webkit2-4.0 python3 python3-enchant python3-gi python3-yaml - python3 -m pip install setuptools tox + sudo apt-get -y install -qq gettext gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-gtksource-4 gir1.2-pango-1.0 gir1.2-webkit2-4.1 python3 python3-enchant python3-gi python3-setuptools python3-yaml tox - name: Install dependencies (macOS) if: startsWith(matrix.os, 'macos') @@ -58,13 +57,14 @@ jobs: HOMEBREW_NO_INSTALL_UPGRADE: on - name: Check style - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: | - python3 -m tox -v -e style + tox -v -e style - name: Run tests - if: matrix.os == 'ubuntu-22.04' # pip on macOS needs --break-system-packages + if: matrix.os == 'ubuntu-24.04' # pip on macOS needs --break-system-packages run: | python3 -c "import gi" - python3 -m tox -v -e py - python3 -m pip install . + tox -v -e py + python3 -m venv .venv + ./.venv/bin/pip install . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9dd670e..e0c76593 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: check-yaml @@ -10,7 +10,7 @@ repos: # Static analysis for Python code - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.1.1 hooks: - id: flake8 # E203: whitespace before ':' (not compliant with PEP 8) @@ -21,21 +21,21 @@ repos: # Python code formatter - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.8.0 hooks: - id: black exclude: ^rednotebook/external/ # Imports sorter - repo: https://github.com/pycqa/isort - rev: 5.11.5 + rev: 5.13.2 hooks: - id: isort exclude: ^rednotebook/journal.py # Upgrades Python code to a target version - repo: https://github.com/asottile/pyupgrade - rev: v3.4.0 + rev: v3.17.0 hooks: - id: pyupgrade args: ['--py36-plus', '--exit-zero'] @@ -43,7 +43,7 @@ repos: # Finds unused Python code - repo: https://github.com/jendrikseipp/vulture - rev: v2.7 + rev: v2.12 hooks: - id: vulture exclude: ^rednotebook/external/ diff --git a/rednotebook/gui/categories.py b/rednotebook/gui/categories.py index 4410b947..c5654400 100644 --- a/rednotebook/gui/categories.py +++ b/rednotebook/gui/categories.py @@ -99,7 +99,7 @@ def add_category(self, category): self.categories.sort(key=utils.sort_asc) def node_on_top_level(self, iter): - if type(iter) != Gtk.TreeIter: + if isinstance(iter, Gtk.TreeIter): # iter is a path -> convert to iter iter = self.tree_store.get_iter(iter) assert self.tree_store.iter_is_valid(iter) diff --git a/rednotebook/gui/editor.py b/rednotebook/gui/editor.py index 51ae398f..8343dd62 100644 --- a/rednotebook/gui/editor.py +++ b/rednotebook/gui/editor.py @@ -103,7 +103,7 @@ def insert(self, text, iter=None, overwrite=False, undoing=False): if iter is None: self.day_text_buffer.insert_at_cursor(text) else: - if type(iter) == Gtk.TextMark: + if isinstance(iter, Gtk.TextMark): iter = self.day_text_buffer.get_iter_at_mark(iter) self.day_text_buffer.insert(iter, text)