Skip to content

Commit

Permalink
Merge pull request #441 from impact27/disable_appnap
Browse files Browse the repository at this point in the history
PR: Disable AppNap
  • Loading branch information
blink1073 authored Oct 13, 2019
2 parents 92513c3 + 212776f commit d0ef2e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 0 additions & 6 deletions ipykernel/eventloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@ def loop_wx(kernel):

import wx

if _use_appnope() and kernel._darwin_app_nap:
# we don't hook up App Nap contexts for Wx,
# just disable it outright.
from appnope import nope
nope()

# Wx uses milliseconds
poll_interval = int(1000 * kernel._poll_interval)

Expand Down
6 changes: 6 additions & 0 deletions ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .comm import CommManager
from .kernelbase import Kernel as KernelBase
from .zmqshell import ZMQInteractiveShell
from .eventloops import _use_appnope

try:
from IPython.core.interactiveshell import _asyncio_runner
Expand Down Expand Up @@ -79,6 +80,11 @@ def __init__(self, **kwargs):
for msg_type in comm_msg_types:
self.shell_handlers[msg_type] = getattr(self.comm_manager, msg_type)

if _use_appnope() and self._darwin_app_nap:
# Disable app-nap as the kernel is not a gui but can have guis
import appnope
appnope.nope()

help_links = List([
{
'text': "Python Reference",
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def run(self):
'traitlets>=4.1.0',
'jupyter_client',
'tornado>=4.2',
'appnope;platform_system=="Darwin"',
],
extras_require={
'test': [
Expand Down

0 comments on commit d0ef2e4

Please sign in to comment.