Skip to content

Commit

Permalink
Merge branch 'main' into reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Feb 16, 2024
2 parents 01dc799 + eaaa3ed commit 852b5f8
Show file tree
Hide file tree
Showing 58 changed files with 184 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

- uses: tlambert03/setup-qt-libs@v1.6
- uses: tlambert03/setup-qt-libs@v1.7

- name: Install dependencies
run: |
python -m pip install -e .
python -m pip install pytest 'pydantic<2' attrs pytest-cov pyqt6
- name: Test
uses: aganders3/headless-gui@v1
uses: aganders3/headless-gui@v2
with:
run: pytest tests/test_ui_field.py -v --color=yes --cov=magicgui --cov-report=xml

Expand All @@ -72,11 +72,11 @@ jobs:
with:
dependency-repo: ${{ matrix.package }}
dependency-ref: ${{ matrix.package-version }}
dependency-extras: ${{ matrix.package-extras || 'testing' }}
host-extras: 'testing'
dependency-extras: ${{ matrix.package-extras || 'testing' }}
host-extras: "testing"
qt: pyqt5
python-version: "3.10"
post-install-cmd: 'python -m pip install pytest-pretty'
post-install-cmd: "python -m pip install pytest-pretty"
pytest-args: ${{ matrix.pytest-args }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ repos:


- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix"]

- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.16
hooks:
- id: validate-pyproject

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
files: "^src/"
Expand Down
35 changes: 30 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [v0.8.1](https://github.com/pyapp-kit/magicgui/tree/v0.8.1) (2023-12-06)

[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.8.0...v0.8.1)

**Implemented enhancements:**

- feat: add `Table.delete_row` method [\#610](https://github.com/pyapp-kit/magicgui/pull/610) ([tlambert03](https://github.com/tlambert03))
- feat: add toolbar widget [\#597](https://github.com/pyapp-kit/magicgui/pull/597) ([tlambert03](https://github.com/tlambert03))

**Fixed bugs:**

- Ensure QImage is ARGB32 before converting to numpy [\#618](https://github.com/pyapp-kit/magicgui/pull/618) ([aganders3](https://github.com/aganders3))
- fix: allow future annotations in ipywidgets backend [\#609](https://github.com/pyapp-kit/magicgui/pull/609) ([tlambert03](https://github.com/tlambert03))
- Make kwargs of container-like widgets consistent [\#606](https://github.com/pyapp-kit/magicgui/pull/606) ([hanjinliu](https://github.com/hanjinliu))

**Documentation:**

- docs: unpin pyside6 when building docs [\#614](https://github.com/pyapp-kit/magicgui/pull/614) ([tlambert03](https://github.com/tlambert03))

**Merged pull requests:**

- ci\(dependabot\): bump tlambert03/setup-qt-libs from 1.5 to 1.6 [\#615](https://github.com/pyapp-kit/magicgui/pull/615) ([dependabot[bot]](https://github.com/apps/dependabot))
- chore!: remove older deprecations [\#607](https://github.com/pyapp-kit/magicgui/pull/607) ([tlambert03](https://github.com/tlambert03))

## [v0.8.0](https://github.com/pyapp-kit/magicgui/tree/v0.8.0) (2023-10-20)

[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.7.3...v0.8.0)
Expand Down Expand Up @@ -32,6 +56,7 @@

**Merged pull requests:**

- chore: changelog v0.8.0 [\#605](https://github.com/pyapp-kit/magicgui/pull/605) ([tlambert03](https://github.com/tlambert03))
- style: use `Unpack` for better kwargs typing [\#599](https://github.com/pyapp-kit/magicgui/pull/599) ([tlambert03](https://github.com/tlambert03))
- chore: remove setup.py [\#595](https://github.com/pyapp-kit/magicgui/pull/595) ([tlambert03](https://github.com/tlambert03))
- ci\(dependabot\): bump actions/checkout from 3 to 4 [\#578](https://github.com/pyapp-kit/magicgui/pull/578) ([dependabot[bot]](https://github.com/apps/dependabot))
Expand Down Expand Up @@ -548,7 +573,7 @@

## [v0.2.9](https://github.com/pyapp-kit/magicgui/tree/v0.2.9) (2021-04-05)

[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.8...v0.2.9)
[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.8rc0...v0.2.9)

**Implemented enhancements:**

Expand All @@ -574,13 +599,13 @@

- \[pre-commit.ci\] pre-commit autoupdate [\#212](https://github.com/pyapp-kit/magicgui/pull/212) ([pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci))

## [v0.2.8](https://github.com/pyapp-kit/magicgui/tree/v0.2.8) (2021-03-24)
## [v0.2.8rc0](https://github.com/pyapp-kit/magicgui/tree/v0.2.8rc0) (2021-03-24)

[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.8rc0...v0.2.8)
[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.8...v0.2.8rc0)

## [v0.2.8rc0](https://github.com/pyapp-kit/magicgui/tree/v0.2.8rc0) (2021-03-24)
## [v0.2.8](https://github.com/pyapp-kit/magicgui/tree/v0.2.8) (2021-03-24)

[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.7...v0.2.8rc0)
[Full Changelog](https://github.com/pyapp-kit/magicgui/compare/v0.2.7...v0.2.8)

**Implemented enhancements:**

Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This example demonstrates handling callable functions with magicgui.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/chaining.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This example demonstrates chaining multiple functions together.
"""

from magicgui import magicgui, widgets


Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/hotdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Demo app to upload an image and classify if it's an hotdog or not.
"""

import pathlib
from enum import Enum

Expand Down
1 change: 1 addition & 0 deletions docs/examples/applications/pint_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from and to different units.
https://pint.readthedocs.io/en/stable/
"""

from pint import Quantity

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/basic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A basic example using magicgui.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/basic_widgets_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This code demonstrates a few of the widget types that magicgui can create
based on the parameter types in your function.
"""

import datetime
from enum import Enum
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/change_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
An example showing how to create custom text labels for your widgets.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Choices for dropdowns can be provided in a few different ways.
"""

from enum import Enum

from magicgui import magicgui, widgets
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/file_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A file dialog widget example.
"""

from pathlib import Path
from typing import Sequence

Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/log_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A logarithmic scale range slider widget.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A password login field widget.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Optional user input using a dropdown selection widget.
"""

from typing import Optional

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/range_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A double ended range slider widget.
"""

from typing import Tuple

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A selection widget allowing multiple selections by the user.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/examples/demo_widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Demonstrating a few ways to input tables.
"""

import numpy as np

from magicgui.widgets import Table
Expand Down
1 change: 1 addition & 0 deletions docs/examples/matplotlib/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Simple waveform generator widget, with plotting.
"""

from dataclasses import dataclass, field
from enum import Enum
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions docs/examples/napari/napari_combine_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
This example shows how to use just that widget in the context
of a larger custom QWidget.
"""

import napari
from qtpy.QtWidgets import QVBoxLayout, QWidget

Expand Down
1 change: 1 addition & 0 deletions docs/examples/napari/napari_forward_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
a *string* representation of the type (rather than the type itself). This is called a
"forward reference": https://www.python.org/dev/peps/pep-0484/#forward-references
"""

# Note: if you'd like to avoid circular imports, or just want to avoid having your
# linter yell at you for an undefined type annotation, you can place the import
# inside of an `if typing.TYPE_CHECKING` conditional. This is not evaluated at runtime,
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A simple progress bar demo with magicgui.
"""

from time import sleep

from magicgui import magicgui
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress_indeterminate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
of unknown time.
"""

import time

from superqt.utils import thread_worker
Expand Down
1 change: 1 addition & 0 deletions docs/examples/progress_bars/progress_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Example of a progress bar being updated manually.
"""

from magicgui import magicgui
from magicgui.widgets import ProgressBar

Expand Down
1 change: 1 addition & 0 deletions docs/examples/under_the_hood/class_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
in which the instance will always be provided as the first argument (i.e. "self") when
the FunctionGui or method is called.
"""

from magicgui import event_loop, magicgui
from magicgui.widgets import Container

Expand Down
1 change: 1 addition & 0 deletions docs/examples/under_the_hood/self_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Widgets created with magicgui can reference themselves, and use the widget API.
"""

from magicgui import magicgui


Expand Down
1 change: 1 addition & 0 deletions docs/scripts/_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""https://www.mkdocs.org/dev-guide/plugins/#events ."""

from __future__ import annotations

import importlib.abc
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""magicgui is a utility for generating a GUI from a python function."""

from importlib.metadata import PackageNotFoundError, version

try:
Expand Down
8 changes: 4 additions & 4 deletions src/magicgui/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


@overload
def debounce(function: Callable[P, T]) -> Callable[P, T | None]:
...
def debounce(function: Callable[P, T]) -> Callable[P, T | None]: ...


@overload
def debounce(*, wait: float = 0.2) -> Callable[[Callable[P, T]], Callable[P, T | None]]:
...
def debounce(
*, wait: float = 0.2
) -> Callable[[Callable[P, T]], Callable[P, T | None]]: ...


def debounce(function: Callable[P, T] | None = None, wait: float = 0.2) -> Callable:
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/application.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Magicgui application object, wrapping a backend application."""

from __future__ import annotations

import signal
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Backend modules implementing applications and widgets."""

from __future__ import annotations

BACKENDS: dict[str, tuple[str, str]] = {
Expand Down
4 changes: 2 additions & 2 deletions src/magicgui/backends/_qtpy/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def _signals_blocked(obj: QtW.QWidget) -> Iterator[None]:


class EventFilter(QObject):
parentChanged = Signal()
parentChanged = Signal(QObject)
valueChanged = Signal(object)
paletteChanged = Signal()

def eventFilter(self, obj: QObject, event: QEvent) -> bool:
if event.type() == QEvent.Type.ParentChange:
self.parentChanged.emit()
self.parentChanged.emit(obj.parent())
if event.type() == QEvent.Type.PaletteChange:
self.paletteChanged.emit()
return False
Expand Down
1 change: 1 addition & 0 deletions src/magicgui/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Note: these are not guaranteed to be stable. Names and parameters may change or be
removed in future releases. Use at your own risk.
"""

from .schema._guiclass import button, guiclass, is_guiclass

__all__ = ["guiclass", "button", "is_guiclass"]
Loading

0 comments on commit 852b5f8

Please sign in to comment.