Skip to content

Commit

Permalink
chore: Apply changes from repo-review (manzt#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored May 4, 2024
1 parent 4acb9ec commit 1f0dc50
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ updates:
directory: "/"
schedule:
interval: "monthly"
groups:
actions:
patterns:
- "*"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
groups:
actions:
patterns:
- "*"

# Maintain dependencies for Composer
- package-ecosystem: "pip"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
LintPython:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
if: github.repository == 'manzt/anywidget'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Release:
# prevents this action from running on forks
Expand Down
11 changes: 7 additions & 4 deletions anywidget/_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def __get__(
# when IPython accesses _repr_mimebundle_ on an object, it catches
# exceptions and swallows them. We want to make sure that the user
# knows that something went wrong, so we'll print the exception here.
warnings.warn(f"Error in Anywidget repr:\n{e}")
warnings.warn(f"Error in Anywidget repr:\n{e}", stacklevel=1)
raise

with contextlib.suppress(AttributeError, ValueError):
Expand Down Expand Up @@ -308,7 +308,8 @@ def __init__(
warnings.warn(
f"Anywidget: {obj} is not weakrefable, so it will not be garbage "
"collected until the view is closed. Please consider adding "
"`__slots__ = ('__weakref__',)` to your class definition."
"`__slots__ = ('__weakref__',)` to your class definition.",
stacklevel=2,
)

self._comm = _comm_for(obj)
Expand Down Expand Up @@ -436,7 +437,7 @@ def sync_object_with_view(
raise RuntimeError("Cannot sync a deleted object")

if self._disconnectors:
warnings.warn("Refusing to re-sync a synced object.")
warnings.warn("Refusing to re-sync a synced object.", stacklevel=2)
return

# each of these _connect_* functions receives the python object, and the
Expand All @@ -453,7 +454,9 @@ def sync_object_with_view(
else:
warnings.warn(
f"Could not find a notifier on {obj} (e.g. psygnal, traitlets). "
"Changes to the python object will not be reflected in the JS view."
f"Changes to the python object will not be reflected in the JS "
f"view.",
stacklevel=2,
)

def unsync_object_with_view(self) -> None:
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = { text = "MIT" }
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.7"
dependencies = [
dependencies = [
"ipywidgets>=7.6.0",
"importlib-metadata; python_version < '3.8'",
"typing-extensions>=4.2.0",
Expand Down Expand Up @@ -93,7 +93,6 @@ test = "pytest . --cov anywidget --cov-report term-missing"
# https://github.com/charliermarsh/ruff
[tool.ruff]
line-length = 88
target-version = "py38"
src = ["anywidget", "tests"]
exclude = ["packages"]

Expand All @@ -109,7 +108,7 @@ extend-select = [
# using this instead of tool.ruff.pydocstyle.convention until overrides
# are supported: https://github.com/charliermarsh/ruff/issues/2606
# specifically, we'd like to INCLUDE D417, which is not in the numpy convention
extend-ignore = [
ignore = [
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
Expand Down Expand Up @@ -139,6 +138,9 @@ filterwarnings = [
"ignore:Jupyter is migrating its paths:DeprecationWarning",
"ignore:Deprecated in traitlets 4.1, use the instance .metadata:DeprecationWarning",
]
log_cli_level = "INFO"
xfail_strict = true
addopts = ["-ra", "--strict-markers", "--strict-config"]

# https://coverage.readthedocs.io/en/6.4/config.html
[tool.coverage.report]
Expand Down

0 comments on commit 1f0dc50

Please sign in to comment.