Code Monkey home page Code Monkey logo

appnope's People

Contributors

dependabot[bot] avatar geohot avatar minrk avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

appnope's Issues

Bug in regex?

I'm getting a deprecation warning in (Windows) CI in a program depending on (macOS-based) appnope:

..\..\Users\appveyor\AppData\Local\pypoetry\Cache\virtualenvs\corrscope-2f2v7ZI7-py3.8\lib\site-packages\appnope\__init__.py:8
  C:\Users\appveyor\AppData\Local\pypoetry\Cache\virtualenvs\corrscope-2f2v7ZI7-py3.8\lib\site-packages\appnope\__init__.py:8: DeprecationWarning: invalid escape sequence \d
    return tuple(int(s) for s in re.findall("\d+", version_s))

In https://github.com/minrk/appnope/blob/main/appnope/__init__.py, did you mean to write r"\d+" rather than "\d+"?

ModuleNotFoundError: No module named 'appnope'

Appnope 0.1.1 import fails. I've installed in virtual env as follows

$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -U pip
(venv) $ pip install appnope
Collecting appnope
  Using cached appnope-0.1.1-py2.py3-none-any.whl (2.2 kB)
Installing collected packages: appnope
Successfully installed appnope-0.1.1
(venv) $ python
Python 3.7.7 (default, Mar 10 2020, 15:43:03) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import appnope
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'appnope'
>>> 
(venv) $ pip list
Package    Version
---------- -------
appnope    0.1.1
pip        20.3
setuptools 41.2.0

Are there files missing in site-packages?

(venv) $ ls -la venv/lib/python3.7/site-packages
total 8
drwxr-xr-x   3 kostas  staff    96B Dec  1 14:39 __pycache__
drwxr-xr-x   9 kostas  staff   288B Dec  1 14:39 appnope-0.1.1.dist-info
-rw-r--r--   1 kostas  staff   126B Dec  1 14:39 easy_install.py
drwxr-xr-x   7 kostas  staff   224B Dec  1 14:39 pip
drwxr-xr-x   9 kostas  staff   288B Dec  1 14:39 pip-20.3.dist-info
drwxr-xr-x   7 kostas  staff   224B Dec  1 14:39 pkg_resources
drwxr-xr-x  42 kostas  staff   1.3K Dec  1 14:39 setuptools
drwxr-xr-x  11 kostas  staff   352B Dec  1 14:39 setuptools-41.2.0.dist-info

No module named appnope

Since almost 2 years i figure out a problem when installing and using jupyter notebooks in a virtual environment on Mac. I always receive the following error when starting a notebook:

ModuleNotFoundError: No module named 'appnope'

I recognised that you already had the issue with appnope 0.1.1 and that going back to 0.1.0 fixed it. Unfortunately for me this problem also appears with appnope 0.1.2 and appnope 0.1.3.

I am currently using Python 3.9.15 on MacOS Venture 13.2. I also had this problem on Python 3.7 and older MacOS versions.

appnope crashes with segfault from subrocess

Steps:

  1. Add this code in a file:
from multiprocessing import Pool
import appnope

def f(x):
    appnope.nope()

if __name__ == '__main__':
    with Pool(5) as p:
        print(p.map(f, [1]))
  1. Run with ipython crash.py
  2. Crash with a segfault and prints:
objc[2560]: +[NSString initialize] may have been in progress in another thread when fork() was called.
objc[2560]: +[NSString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

AppNap not being disabled

I am importing and calling appnope at the top of my notebook as follows:

screen

However, I am still seeing overnight runs being napped. Running on OS X 10.9.4 and Python 2.7.6. Is there any way of diagnosing why this would be happening?

distutils Version classes are deprecated

Seen in ipython/ipykernel#902

../../miniconda/envs/ipykernel_env/lib/python3.8/site-packages/appnope/__init__.py:7: in <module>
    if sys.platform != "darwin" or V(platform.mac_ver()[0]) < V("10.9"):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'LooseVersion' object has no attribute 'vstring'") raised in repr()] LooseVersion object at 0x7faea458e7c0>
vstring = '10.16'

    def __init__ (self, vstring=None):
>       warnings.warn(
            "distutils Version classes are deprecated. "
            "Use packaging.version instead.",
            DeprecationWarning,
            stacklevel=2,
        )
E       DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

../../miniconda/envs/ipykernel_env/lib/python3.8/site-packages/setuptools/_distutils/version.py:53: DeprecationWarning

Regarding of Jupyter lab

Bug description

Expected behaviour

Actual behaviour

[I 20:36:06.448 LabApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/application.py", line 844, in launch_instance
app.initialize(argv)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in inner
return method(app, *args, **kwargs)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 582, in initialize
self.init_kernel()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 452, in init_kernel
user_ns=self.user_ns,
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/traitlets/config/configurable.py", line 537, in instance
inst = cls(*args, **kwargs)
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/ipykernel/ipkernel.py", line 86, in init
appnope.nope()
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 90, in nope
"Because Reasons"
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 60, in beginActivityWithOptions
NSProcessInfo = C('NSProcessInfo')
File "/Users/brandon/miniconda3/envs/ancestry/lib/python3.7/site-packages/appnope/_nope.py", line 38, in C
assert ret is not None, "Couldn't find Class %s" % classname
AssertionError: Couldn't find Class NSProcessInfo

How to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Your personal set up

  • OS:
  • Version: OS X 11.0.1

jupyter --version
jupyter core : 4.7.0
jupyter-notebook : 6.1.5
qtconsole : not installed
ipython : 5.8.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 2.2.9
nbconvert : 6.0.7
ipywidgets : not installed
nbformat : 5.0.8
traitlets : 5.0.5

Hi!

Could you check the issue please?
(I just found the appnode repository e.g here.)

[Help Wanted] AppNap issue still appears in Homebrew IPython 7.15.0

I recently encountered the IPython AppNap issue probably after upgrading my Mac from Mojave to Catalina. I observe very slow key response (freezes every ~1 sec) in an IPython session after using the ROOT package, which is a huge analysis library for particle physics. The issue was reported here a few days ago because I first thought that it was a ROOT issue.
https://sft.its.cern.ch/jira/browse/ROOT-10860

After discussing the ROOT developers, it was found that my issue was due to AppNap, and calling appnope.nope() in ~/.ipython/profile_default/startup/ipython_init.py resolved it. So, please first let me thank you very much.

What still puzzling me is that this issue does not appear universally. Would you tell me why I need to manually call appnope.nope() in the environments 1 and 2 ? Do you have any idea? If there is a reason, I would like to make a issue report in the Homebrew repo.

Environment 1 (Need appnope)

  • macOS 10.15.5
  • Homebrew
  • IPython 7.15.0 installed via pip3 (Homebrew)
  • Python 3.7.6 (Homebrew)
  • Not a clean Mac (my main environment)

Environment 2 (Need appnope)

  • macOS 10.15.5
  • Homebrew
  • IPython 7.15.0 installed via pip3 (Homebrew)
  • Python 3.7.6 and 3.7.7 (Homebrew)
  • Almost clean virtual machine

Environment 3 (OK)

  • macOS 10.15.5
  • Anaconda3-2020.02-MacOSX-x86_64
  • IPython 7.15.0
  • Python 3.8.3
  • The same machine as env. 1

Environment 4 (OK)

  • Mojave 10.14.6
  • Homebrew
  • IPython 7.4.0 (Homebrew's pip3)
  • Python 3.7.6 (Homebrew)
  • Not a clean Mac (my previous main machine)

Environment 5 (Need appnope)

  • macOS 10.15.5
  • IPython 7.15.0 installed via system pip3
  • Python 3.7.3 (System default)
  • Almost clean virtual machine

Environment 6 (Need appnope)

  • macOS 10.15.5
  • Python 3.8.3 (official installer)
  • IPython 7.15.0 installed via pip3 (official install)
  • Almost clean virtual machine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.