Git Product home page Git Product logo

spyder-memory-profiler's People

Contributors

blink1073 avatar cmeeren avatar divenex avatar ghisvail avatar goanpeca avatar jitseniesen avatar nodd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spyder-memory-profiler's Issues

Spyder 5 compatibility

Running conda install spyder-line-profiler=0.2.1 -c spyder-ide with Spyder 5.0.0 installed returns

The following specifications were found to be incompatible with a past
explicit spec that is not an explicit spec in this operation (spyder):

  - spyder-line-profiler=0.2.1 -> spyder[version='>=4,<5']

Is spyder-line-profiler compatible with Spyder 5?

EDIT: sorry, posted in the wrong place.

Tests fail on 32-bit platforms

See the logs for i386 and armhf. Both fail with the following error message:

============================= test session starts ==============================
platform linux -- Python 3.6.2, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
PyQt5 5.7 -- Qt runtime 5.7.1 -- Qt compiled 5.7.1
rootdir: /build/spyder-memory-profiler-0.1.0, inifile:
plugins: xvfb-1.0.0, qt-2.1.2
collected 1 item

spyder_memory_profiler/widgets/tests/test_memoryprofiler.py F

=================================== FAILURES ===================================
_______________________ test_profile_and_display_results _______________________

qtbot = <pytestqt.qtbot.QtBot object at 0xae453930>
tmpdir = local('/tmp/pytest-of-pbuilder1/pytest-0/test_profile_and_display_resul0')
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0xae50bcd0>

    def test_profile_and_display_results(qtbot, tmpdir, monkeypatch):
        """Run profiler on simple script and check that results are okay."""
        os.chdir(tmpdir.strpath)
        testfilename = tmpdir.join('test_foo.py').strpath
    
        with open(testfilename, 'w') as f:
            f.write(TEST_SCRIPT)
    
        MockQMessageBox = Mock()
        monkeypatch.setattr('spyder_memory_profiler.widgets.memoryprofiler.QMessageBox',
                            MockQMessageBox)
    
        widget = MemoryProfilerWidget(None)
        qtbot.addWidget(widget)
        with qtbot.waitSignal(widget.sig_finished, timeout=10000, raising=True):
            widget.analyze(testfilename)
    
        MockQMessageBox.assert_not_called()
        dt = widget.datatree
        assert dt.topLevelItemCount() == 1  # number of functions profiled
    
        top = dt.topLevelItem(0)
        assert top.data(0, Qt.DisplayRole).startswith('foo ')
        assert top.childCount() == 6
        for i in range(6):
            assert top.child(i).data(0, Qt.DisplayRole) == i + 1  # line no
    
        # column 2 has increment (in Mib); displayed as 'xxx MiB' so need to strip
        # last 4 characters
>       assert float(top.child(2).data(2, Qt.DisplayRole)[:-4]) >= 7  # increment (MiB)
E       AssertionError: assert 3.863 >= 7
E        +  where 3.863 = float('3.863')

/build/spyder-memory-profiler-0.1.0/.pybuild/pythonX.Y_3.6/build/spyder_memory_profiler/widgets/tests/test_memoryprofiler.py:66: AssertionError
----------------------------- Captured Qt messages -----------------------------
None:None:0:
    QtWarningMsg: "QColor::setAlphaF": invalid value -0.998925
----------------------------- Captured stderr call -----------------------------

Update to qtpy

ERROR: 3rd party plugin import failed for `spyder_memory_profiler`
Traceback (most recent call last):
  File "/data/prog/spyder.git/spyderlib/otherplugins.py", line 73, in _import_plugin
    module = _import_module_from_path(module_name, plugin_path)
  File "/data/prog/spyder.git/spyderlib/otherplugins.py", line 107, in _import_module_from_path
    module = spec.loader.load_module(module_name)
  File "<frozen importlib._bootstrap_external>", line 385, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 806, in load_module
  File "<frozen importlib._bootstrap_external>", line 665, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 626, in _exec
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/data/prog/spyder.memory_profiler.git/spyder_memory_profiler/__init__.py", line 6, in <module>
    from .memoryprofiler import MemoryProfiler
  File "/data/prog/spyder.memory_profiler.git/spyder_memory_profiler/memoryprofiler.py", line 12, in <module>
    from spyderlib.qt.QtCore import SIGNAL, Qt
ImportError: No module named 'spyderlib.qt.QtCore'

Spyder 5 compatibility?

After installing spyder-memory-profiler, nothing about the Run menu changes indicating that the plugin is loaded. Entering debug mode, I see the following error

[DEBUG] [spyder.otherplugins] -> plugin: 'spyder_memory_profiler' load failed with `cannot import name 'get_icon' from 'spyder.utils.qthelpers' (/home/USER/miniconda3/envs/spyder-env/lib/
python3.9/site-packages/spyder/utils/qthelpers.py)`

Looking at git diffs, it seems that spyder/utils/qthelpers.py has changed since spyder 4.x. This is the only other error I found in the debug log, but that doesn't mean the rest of the code is compatible with spyder 5 either.

I'm happy to help with implementing this change or attempting to update the package in general, but I don't know anything about spyder plug-ins. If anyone could point me in the right direction of where to start, I'd attempt a fix. Thanks.

Release conda package

I am trying to build a conda package. Up to now I use conda-forge for this, following more or less the procedure described in https://github.com/spyder-ide/spyder-unittest/wiki/Release . This worked well before, but this time the conda-forge package https://github.com/conda-forge/spyder-memory-profiler-feedstock , which I copied to the spyder-ide channel, does not want to be installed in a vanilla conda environment:

$ conda install -c spyder-ide spyder-memory-profiler=0.2.1
[...]
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - spyder-memory-profiler=0.2.1 -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0']

Your python: python=3.7

A Python 3.7 variant of the conda package does exist in the spyder-ide channel:

$ conda search -c spyder-ide spyder-memory-profiler --info
[...]
spyder-memory-profiler 0.2.1 py37hc8dfbb8_0
-------------------------------------------
file name   : spyder-memory-profiler-0.2.1-py37hc8dfbb8_0.tar.bz2
name        : spyder-memory-profiler
version     : 0.2.1
build       : py37hc8dfbb8_0
build number: 0
size        : 29 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/spyder-ide/linux-64/spyder-memory-profiler-0.2.1-py37hc8dfbb8_0.tar.bz2
md5         : bea8526a75cf90c77c72d1422be5ecbd
timestamp   : 2020-04-18 10:47:11 UTC
dependencies: 
  - memory_profiler
  - python >=3.7,<3.8.0a0
  - python_abi 3.7.* *_cp37m
  - spyder >=4,<5

Comparing with the previous conda package, the python_abi dependency is new, so I guess this is causing the problem. Any ideas what to do? @ccordoba12 @goanpeca

Failing tests

When running the testsuite from version 0.1.2 on openSUSE/Tumbleweed (this time Python 2.7.16) I get it failing (complete build log:

[   37s] Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.NqO9nA
[   37s] + umask 022
[   37s] + cd /home/abuild/rpmbuild/BUILD
[   37s] + cd spyder_memory_profiler-0.1.2
[   37s] + export QT_HASH_SEED=0
[   37s] + QT_HASH_SEED=0
[   37s] + export DISPLAY=:98
[   37s] + DISPLAY=:98
[   37s] + export PYTHONDONTWRITEBYTECODE=1
[   37s] + PYTHONDONTWRITEBYTECODE=1
[   37s] + trap 'kill 18329 || true' EXIT
[   37s] + sleep 10
[   37s] + Xvfb :98
[   48s] ++ '[' -f _current_flavor ']'
[   48s] ++ cat _current_flavor
[   48s] + python_flavor=python3
[   48s] + '[' -z python3 ']'
[   48s] + '[' python3 '!=' python2 ']'
[   48s] + '[' -d build ']'
[   48s] + mv build _build.python3
[   48s] + '[' -d _build.python2 ']'
[   48s] + mv _build.python2 build
[   48s] + echo python2
[   48s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-spyder-memory-profiler-0.1.2-0.x86_64/usr/lib/python2.7/site-packages
[   48s] + py.test-2.7 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v spyder_memory_profiler
[   48s] ============================= test session starts ==============================
[   48s] platform linux2 -- Python 2.7.16, pytest-3.10.1, py-1.8.0, pluggy-0.9.0 -- /usr/bin/python2
[   48s] cachedir: .pytest_cache
[   48s] PyQt5 5.12 -- Qt runtime 5.12.2 -- Qt compiled 5.12.2
[   48s] rootdir: /home/abuild/rpmbuild/BUILD/spyder_memory_profiler-0.1.2, inifile:
[   48s] plugins: qt-3.2.2
[   49s] collecting ... collected 1 item
[   49s] 
[   50s] spyder_memory_profiler/widgets/tests/test_memoryprofiler.py::test_profile_and_display_results FAILED [100%]
[   50s] 
[   50s] =================================== FAILURES ===================================
[   50s] _______________________ test_profile_and_display_results _______________________
[   50s] 
[   50s] qtbot = <pytestqt.qtbot.QtBot object at 0x7fcd95fc2b50>
[   50s] tmpdir = local('/tmp/pytest-of-abuild/pytest-0/test_profile_and_display_resul0')
[   50s] monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fcd95fc2f10>
[   50s] 
[   50s]     @pytest.mark.qt_log_level_fail('WARNING')
[   50s]     def test_profile_and_display_results(qtbot, tmpdir, monkeypatch):
[   50s]         """
[   50s]         Run profiler on simple script and check that results are okay.
[   50s]     
[   50s]         This is a fairly simple integration test which checks that the plugin works
[   50s]         on a basic level.
[   50s]         """
[   50s]         os.chdir(tmpdir.strpath)
[   50s]         testfilename = tmpdir.join('test_foo.py').strpath
[   50s]     
[   50s]         with open(testfilename, 'w') as f:
[   50s]             f.write(TEST_SCRIPT)
[   50s]     
[   50s]         MockQMessageBox = Mock()
[   50s]         monkeypatch.setattr('spyder_memory_profiler.widgets.memoryprofiler.QMessageBox',
[   50s]                             MockQMessageBox)
[   50s]     
[   50s]         widget = MemoryProfilerWidget(None)
[   50s]         qtbot.addWidget(widget)
[   50s]         with qtbot.waitSignal(widget.sig_finished, timeout=10000, raising=True):
[   50s]             widget.analyze(testfilename)
[   50s]     
[   50s]         MockQMessageBox.assert_not_called()
[   50s]         dt = widget.datatree
[   50s]         assert dt.topLevelItemCount() == 1  # number of functions profiled
[   50s]     
[   50s]         top = dt.topLevelItem(0)
[   50s]         assert top.data(0, Qt.DisplayRole).startswith('foo ')
[   50s]         assert top.childCount() == 6
[   50s]         for i in range(6):
[   50s]             assert top.child(i).data(0, Qt.DisplayRole) == i + 1  # line no
[   50s]     
[   50s]         # Column 2 has increment (in MiB); displayed as 'xxx MiB' so need to strip
[   50s]         # last 4 characters. To make the test robust, we only check the sign
[   50s]         assert float(top.child(2).data(2, Qt.DisplayRole)[:-4]) > 0
[   50s]         assert float(top.child(3).data(2, Qt.DisplayRole)[:-4]) > 0
[   50s] >       assert float(top.child(4).data(2, Qt.DisplayRole)[:-4]) < 0
[   50s] E       AssertionError: assert 0.0 < 0
[   50s] E        +  where 0.0 = float('0.000')
[   50s] 
[   50s] /home/abuild/rpmbuild/BUILD/spyder_memory_profiler-0.1.2/spyder_memory_profiler/widgets/tests/test_memoryprofiler.py:78: AssertionError
[   50s] =============================== warnings summary ===============================
[   50s] /usr/lib/python2.7/site-packages/nbconvert/exporters/exporter_locator.py:28
[   50s]   /usr/lib/python2.7/site-packages/nbconvert/exporters/exporter_locator.py:28: DeprecationWarning: `nbconvert.exporters.exporter_locator` is deprecated in favor of `nbconvert.exporters.base` since nbconvert 5.0.
[   50s]     DeprecationWarning)
[   50s] 
[   50s] -- Docs: https://docs.pytest.org/en/latest/warnings.html
[   50s] ===================== 1 failed, 1 warnings in 2.10 seconds =====================
[   50s] + kill 18329
[   50s] error: Bad exit status from /var/tmp/rpm-tmp.NqO9nA (%check)

However, when I exclude the test test_profile_and_display_results it sitll fails:

[   64s] Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.ZK4YpG
[   64s] + umask 022
[   64s] + cd /home/abuild/rpmbuild/BUILD
[   64s] + cd spyder_memory_profiler-0.1.2
[   64s] + export QT_HASH_SEED=0
[   64s] + QT_HASH_SEED=0
[   64s] + export DISPLAY=:98
[   64s] + DISPLAY=:98
[   64s] + export PYTHONDONTWRITEBYTECODE=1
[   64s] + PYTHONDONTWRITEBYTECODE=1
[   64s] + trap 'kill 30885 || true' EXIT
[   64s] + Xvfb :98
[   64s] + sleep 10
[   74s] ++ '[' -f _current_flavor ']'
[   74s] ++ cat _current_flavor
[   74s] + python_flavor=python3
[   74s] + '[' -z python3 ']'
[   74s] + '[' python3 '!=' python2 ']'
[   74s] + '[' -d build ']'
[   74s] + mv build _build.python3
[   74s] + '[' -d _build.python2 ']'
[   74s] + mv _build.python2 build
[   74s] + echo python2
[   74s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-spyder-memory-profiler-0.1.2-0.x86_64/usr/lib/python2.7/site-packages
[   74s] + py.test-2.7 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v -k 'not test_profile_and_display_results' spyder_memory_profiler
[   74s] ============================= test session starts ==============================
[   74s] platform linux2 -- Python 2.7.16, pytest-3.10.1, py-1.8.0, pluggy-0.9.0 -- /usr/bin/python2
[   74s] cachedir: .pytest_cache
[   74s] PyQt5 5.12 -- Qt runtime 5.12.2 -- Qt compiled 5.12.2
[   74s] rootdir: /home/abuild/rpmbuild/BUILD/spyder_memory_profiler-0.1.2, inifile:
[   74s] plugins: qt-3.2.2
[   76s] collecting ... collected 1 item / 1 deselected
[   76s] 
[   76s] =============================== warnings summary ===============================
[   76s] /usr/lib/python2.7/site-packages/nbconvert/exporters/exporter_locator.py:28
[   76s]   /usr/lib/python2.7/site-packages/nbconvert/exporters/exporter_locator.py:28: DeprecationWarning: `nbconvert.exporters.exporter_locator` is deprecated in favor of `nbconvert.exporters.base` since nbconvert 5.0.
[   76s]     DeprecationWarning)
[   76s] 
[   76s] -- Docs: https://docs.pytest.org/en/latest/warnings.html
[   76s] =================== 1 deselected, 1 warnings in 1.90 seconds ===================
[   76s] + kill 30885
[   76s] error: Bad exit status from /var/tmp/rpm-tmp.ZK4YpG (%check)

stop spyder-memory-profiler induces Spyder internal error

Description

What steps will reproduce the problem?

stop spyder-memory-profiler induces Spyder internal error

Traceback

  File "/home/sebastien/anaconda3/lib/python3.7/site-packages/spyder_memory_profiler/widgets/memoryprofiler.py", line 307, in finished
    self.show_data(justanalyzed=True)
  File "/home/sebastien/anaconda3/lib/python3.7/site-packages/spyder_memory_profiler/widgets/memoryprofiler.py", line 326, in show_data
    self.datatree.load_data(self.DATAPATH)
  File "/home/sebastien/anaconda3/lib/python3.7/site-packages/spyder_memory_profiler/widgets/memoryprofiler.py", line 387, in load_data
    with open(profdatafile, 'r') as fid:
FileNotFoundError: [Errno 2] Aucun fichier ou dossier de ce type: '/home/sebastien/.config/spyder-py3/memoryprofiler.results'
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}
WARNING:spyder.widgets.github.backend:Failed to send bug report on Github. response={'code': 401, 'json': {'message': 'Bad credentials', 'documentation_url': 'https://developer.github.com/v3'}}

Versions

  • Spyder version: 3.3.6
  • Python version: 3.7.3
  • Qt version: 5.12.4
  • PyQt5 version: 5.12.3
  • Operating System: Linux 4.15.0-54-generic

Dependencies

pyflakes >=0.6.0  :  2.1.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pygments >=2.0    :  2.4.2 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
rope >=0.9.4      :  0.14.0 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
psutil >=0.3      :  5.6.3 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.24.1 (OK)
numpy >=1.7       :  1.15.4 (OK)
sympy >=0.7.3     :  1.3 (OK)
cython >=0.21     :  0.29.2 (OK)
qtconsole >=4.2.0 :  4.5.1 (OK)
IPython >=4.0     :  7.6.1 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.3.1 (OK)

QColor::setAlphaF called with negative value

As reported on #14 from the py.test log, which I can reproduce:

----------------------------- Captured Qt messages -----------------------------
None:None:0:
    QtWarningMsg: "QColor::setAlphaF": invalid value -0.998925

start Profile memory usage

Description

What steps will reproduce the problem?

start Profile memory usage from the button inmpies a crash

Traceback

  File "/home/sebastien/anaconda3/lib/python3.7/site-packages/spyder_memory_profiler/widgets/memoryprofiler.py", line 229, in start
    self.process.setWorkingDirectory(wdir)
TypeError: setWorkingDirectory(self, str): argument 1 has unexpected type 'bool'

Versions

  • Spyder version: 3.3.6
  • Python version: 3.7.3
  • Qt version: 5.12.4
  • PyQt5 version: 5.12.3
  • Operating System: Linux 4.15.0-54-generic

Dependencies

pyflakes >=0.6.0  :  2.1.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pygments >=2.0    :  2.4.2 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
rope >=0.9.4      :  0.14.0 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
psutil >=0.3      :  5.6.3 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.24.1 (OK)
numpy >=1.7       :  1.15.4 (OK)
sympy >=0.7.3     :  1.3 (OK)
cython >=0.21     :  0.29.2 (OK)
qtconsole >=4.2.0 :  4.5.1 (OK)
IPython >=4.0     :  7.6.1 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
pylint >=0.25     :  2.3.1 (OK)

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.