Hello community,
here is the log from the commit of package python-memory_profiler for
openSUSE:Factory checked in at 2018-02-19 13:01:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-memory_profiler (Old)
and /work/SRC/openSUSE:Factory/.python-memory_profiler.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-memory_profiler"
Mon Feb 19 13:01:57 2018 rev:2 rq:577772 version:0.52.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-memory_profiler/python-memory_profiler.changes
2018-02-14 09:27:32.720343642 +0100
+++
/work/SRC/openSUSE:Factory/.python-memory_profiler.new/python-memory_profiler.changes
2018-02-19 13:02:17.995194815 +0100
@@ -1,0 +2,6 @@
+Fri Feb 16 16:47:10 UTC 2018 - [email protected]
+
+- update to version 0.52.0:
+ * no upstream changelog available
+
+-------------------------------------------------------------------
Old:
----
memory_profiler-0.51.0.tar.gz
New:
----
memory_profiler-0.52.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-memory_profiler.spec ++++++
--- /var/tmp/diff_new_pack.v131uc/_old 2018-02-19 13:02:18.931161060 +0100
+++ /var/tmp/diff_new_pack.v131uc/_new 2018-02-19 13:02:18.935160916 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-memory_profiler
-Version: 0.51.0
+Version: 0.52.0
Release: 0
Summary: A module for monitoring memory usage of a python program
License: BSD-3-Clause
++++++ memory_profiler-0.51.0.tar.gz -> memory_profiler-0.52.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/memory_profiler-0.51.0/PKG-INFO
new/memory_profiler-0.52.0/PKG-INFO
--- old/memory_profiler-0.51.0/PKG-INFO 2018-01-06 20:35:37.000000000 +0100
+++ new/memory_profiler-0.52.0/PKG-INFO 2018-02-16 01:44:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: memory_profiler
-Version: 0.51.0
+Version: 0.52.0
Summary: A module for monitoring memory usage of a python program
Home-page: http://pypi.python.org/pypi/memory_profiler
Author: Fabian Pedregosa
@@ -425,7 +425,7 @@
`Benchy <https://github.com/python-recsys/benchy>`_
- `IPython memory usage
<https://github.com/ianozsvald/ipython_memory_usage_>`_
+ `IPython memory usage
<https://github.com/ianozsvald/ipython_memory_usage>`_
`PySpeedIT <https://github.com/peter1000/PySpeedIT>`_ (uses a reduced
version of memory_profiler)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/memory_profiler-0.51.0/README.rst
new/memory_profiler-0.52.0/README.rst
--- old/memory_profiler-0.51.0/README.rst 2017-11-24 00:14:01.000000000
+0100
+++ new/memory_profiler-0.52.0/README.rst 2018-01-19 22:09:23.000000000
+0100
@@ -416,7 +416,7 @@
`Benchy <https://github.com/python-recsys/benchy>`_
-`IPython memory usage <https://github.com/ianozsvald/ipython_memory_usage_>`_
+`IPython memory usage <https://github.com/ianozsvald/ipython_memory_usage>`_
`PySpeedIT <https://github.com/peter1000/PySpeedIT>`_ (uses a reduced version
of memory_profiler)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/memory_profiler-0.51.0/memory_profiler.egg-info/PKG-INFO
new/memory_profiler-0.52.0/memory_profiler.egg-info/PKG-INFO
--- old/memory_profiler-0.51.0/memory_profiler.egg-info/PKG-INFO
2018-01-06 20:35:36.000000000 +0100
+++ new/memory_profiler-0.52.0/memory_profiler.egg-info/PKG-INFO
2018-02-16 01:44:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: memory-profiler
-Version: 0.51.0
+Version: 0.52.0
Summary: A module for monitoring memory usage of a python program
Home-page: http://pypi.python.org/pypi/memory_profiler
Author: Fabian Pedregosa
@@ -425,7 +425,7 @@
`Benchy <https://github.com/python-recsys/benchy>`_
- `IPython memory usage
<https://github.com/ianozsvald/ipython_memory_usage_>`_
+ `IPython memory usage
<https://github.com/ianozsvald/ipython_memory_usage>`_
`PySpeedIT <https://github.com/peter1000/PySpeedIT>`_ (uses a reduced
version of memory_profiler)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/memory_profiler-0.51.0/memory_profiler.py
new/memory_profiler-0.52.0/memory_profiler.py
--- old/memory_profiler-0.51.0/memory_profiler.py 2018-01-06
20:34:53.000000000 +0100
+++ new/memory_profiler-0.52.0/memory_profiler.py 2018-02-16
01:43:37.000000000 +0100
@@ -3,7 +3,7 @@
# .. we'll use this to pass it to the child script ..
_CLEAN_GLOBALS = globals().copy()
-__version__ = '0.51.0'
+__version__ = '0.52.0'
_CMD_USAGE = "python -m memory_profiler script_file.py"
@@ -1113,20 +1113,17 @@
# globally defined (global variables is not enough
# for all cases, e.g. a script that imports another
# script where @profile is used)
-if PY2:
- def exec_with_profiler(filename, profiler, backend):
- builtins.__dict__['profile'] = profiler
- ns = dict(_CLEAN_GLOBALS, profile=profiler)
- choose_backend(backend)
+def exec_with_profiler(filename, profiler, backend, passed_args=[]):
+ from runpy import run_module
+ builtins.__dict__['profile'] = profiler
+ ns = dict(_CLEAN_GLOBALS, profile=profiler)
+ _backend = choose_backend(backend)
+ sys.argv = [filename] + passed_args
+ if PY2:
execfile(filename, ns, ns)
-else:
- def exec_with_profiler(filename, profiler, backend):
- _backend = choose_backend(backend)
+ else:
if _backend == 'tracemalloc' and has_tracemalloc:
tracemalloc.start()
- builtins.__dict__['profile'] = profiler
- # shadow the profile decorator defined above
- ns = dict(_CLEAN_GLOBALS, profile=profiler)
try:
with open(filename) as f:
exec(compile(f.read(), filename, 'exec'), ns, ns)
@@ -1135,6 +1132,24 @@
tracemalloc.stop()
+def run_module_with_profiler(module, profiler, backend, passed_args=[]):
+ from runpy import run_module
+ builtins.__dict__['profile'] = profiler
+ ns = dict(_CLEAN_GLOBALS, profile=profiler)
+ _backend = choose_backend(backend)
+ sys.argv = [module] + passed_args
+ if PY2:
+ run_module(module, run_name="__main__", init_globals=ns)
+ else:
+ if _backend == 'tracemalloc' and has_tracemalloc:
+ tracemalloc.start()
+ try:
+ run_module(module, run_name="__main__", init_globals=ns)
+ finally:
+ if has_tracemalloc and tracemalloc.is_tracing():
+ tracemalloc.stop()
+
+
class LogFile(object):
"""File-like object to log text using the `logging` module and the log
report can be customised."""
@@ -1168,7 +1183,7 @@
if __name__ == '__main__':
- from argparse import ArgumentParser
+ from argparse import ArgumentParser, REMAINDER
parser = ArgumentParser(usage=_CMD_USAGE)
parser.add_argument('--version', action='version', version=__version__)
@@ -1191,10 +1206,16 @@
choices=['tracemalloc', 'psutil', 'posix'], default='psutil',
help='backend using for getting memory info '
'(one of the {tracemalloc, psutil, posix})')
- parser.add_argument('script', help='script file run on memory_profiler')
+ parser.add_argument("program", nargs=REMAINDER,
+ help='python script or module followed by command line arguements to
run')
args = parser.parse_args()
- script_filename = _find_script(args.script)
+ if len(args.program) == 0:
+ print("A program to run must be provided. Use -h for help")
+ sys.exit(1)
+
+ target = args.program[0]
+ script_args = args.program[1:]
_backend = choose_backend(args.backend)
if args.timestamp:
prof = TimeStamper(_backend)
@@ -1202,7 +1223,11 @@
prof = LineProfiler(max_mem=args.max_mem, backend=_backend)
try:
- exec_with_profiler(script_filename, prof, args.backend)
+ if args.program[0].endswith('.py'):
+ script_filename = _find_script(args.program[0])
+ exec_with_profiler(script_filename, prof, args.backend,
script_args)
+ else:
+ run_module_with_profiler(target, prof, args.backend, script_args)
finally:
if args.out_filename is not None:
out_file = open(args.out_filename, "a")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/memory_profiler-0.51.0/mprof
new/memory_profiler-0.52.0/mprof
--- old/memory_profiler-0.51.0/mprof 2018-01-06 20:34:22.000000000 +0100
+++ new/memory_profiler-0.52.0/mprof 2018-02-16 01:41:27.000000000 +0100
@@ -10,7 +10,7 @@
import math
from collections import defaultdict
-from argparse import ArgumentParser, ArgumentError
+from argparse import ArgumentParser, ArgumentError, REMAINDER,
RawTextHelpFormatter
import memory_profiler as mp
@@ -175,7 +175,7 @@
def run_action():
import time, subprocess
- parser = ArgumentParser(usage="mprof run [options] program")
+ parser = ArgumentParser(usage="mprof run [options] program",
formatter_class=RawTextHelpFormatter)
parser.add_argument('--version', action='version', version=mp.__version__)
parser.add_argument("--python", dest="python", action="store_true",
help="""Activates extra features when the profiling
executable is a Python program (currently: function timestamping.)""")
@@ -186,8 +186,13 @@
parser.add_argument("--include-children", "-C", dest="include_children",
action="store_true",
help="""Monitors forked processes as well (sum up all
process memory)""")
parser.add_argument("--multiprocess", "-M", dest="multiprocess",
action="store_true",
- help="""Monitors forked processes creating individual
plots for each child""")
- parser.add_argument("program", nargs='*')
+ help="""Monitors forked processes creating individual
plots for each child (disables --python features)""")
+ parser.add_argument("program", nargs=REMAINDER,
+ help='Option 1: "<EXECUTABLE> <ARG1> <ARG2>..." -
profile executable\n'
+ 'Option 2: "<PYTHON_SCRIPT> <ARG1> <ARG2>..." -
profile python script\n'
+ 'Option 3: (--python flag present)
"<PYTHON_EXECUTABLE> <PYTHON_SCRIPT> <ARG1> <ARG2>..." - profile python script
with specified interpreter\n'
+ 'Option 4: (--python flag present)
"<PYTHON_MODULE> <ARG1> <ARG2>..." - profile python module\n'
+ )
args = parser.parse_args()
if len(args.program) == 0: