[Python-modules-commits] [python-psutil] 01/16: Import python-psutil_4.1.0.orig.tar.gz
Sandro Tosi
morph at moszumanska.debian.org
Sun Apr 10 19:44:15 UTC 2016
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository python-psutil.
commit 2c309ebac47893e498f97c81dde0e61ce8f7c4a5
Author: Sandro Tosi <morph at debian.org>
Date: Sun Apr 10 00:33:56 2016 +0100
Import python-psutil_4.1.0.orig.tar.gz
---
.ci/travis/install.sh | 37 +-
.ci/travis/run.sh | 12 +-
.coveragerc | 18 +-
.travis.yml | 27 +-
CREDITS | 28 +
DEVGUIDE.rst | 144 ++
DEVNOTES.rst | 10 -
HISTORY.rst | 68 +
IDEAS | 151 ++
INSTALL.rst | 144 +-
MANIFEST.in | 9 +-
Makefile | 18 +-
PKG-INFO | 43 +-
README.rst | 38 +-
TODO | 171 --
appveyor.yml | 27 +-
docs/index.rst | 468 +++--
make.bat | 62 +-
psutil.egg-info/PKG-INFO | 43 +-
psutil.egg-info/SOURCES.txt | 57 +-
psutil/__init__.py | 235 ++-
psutil/_common.py | 85 +-
psutil/_psbsd.py | 81 +-
psutil/_pslinux.py | 297 ++-
psutil/_psosx.py | 38 +-
psutil/_psposix.py | 2 +-
psutil/_pssunos.py | 73 +-
psutil/_psutil_bsd.c | 68 +-
psutil/_psutil_linux.c | 22 +-
psutil/_psutil_osx.c | 203 +-
psutil/_psutil_osx.h | 2 +
psutil/_psutil_posix.c | 2 +-
psutil/_psutil_sunos.c | 69 +-
psutil/_psutil_windows.c | 507 +++--
psutil/_psutil_windows.h | 2 +
psutil/_pswindows.py | 69 +-
psutil/arch/bsd/freebsd.c | 56 +-
psutil/arch/bsd/freebsd.h | 1 +
psutil/arch/bsd/netbsd.c | 46 +-
psutil/arch/bsd/netbsd.h | 1 +
psutil/arch/bsd/openbsd.c | 50 +-
psutil/arch/bsd/openbsd.h | 1 +
psutil/arch/osx/process_info.c | 122 ++
psutil/arch/osx/process_info.h | 1 +
psutil/arch/windows/ntextapi.h | 111 ++
psutil/arch/windows/process_info.c | 628 ++++++-
psutil/arch/windows/process_info.h | 3 +-
psutil/tests/README.rst | 19 +
psutil/tests/__init__.py | 603 ++++++
psutil/tests/runner.py | 25 +
test/_bsd.py => psutil/tests/test_bsd.py | 137 +-
test/_linux.py => psutil/tests/test_linux.py | 994 +++++++---
{test => psutil/tests}/test_memory_leaks.py | 65 +-
psutil/tests/test_misc.py | 437 +++++
test/_osx.py => psutil/tests/test_osx.py | 40 +-
test/_posix.py => psutil/tests/test_posix.py | 203 +-
.../test_psutil.py => psutil/tests/test_process.py | 1948 ++++----------------
test/_sunos.py => psutil/tests/test_sunos.py | 19 +-
psutil/tests/test_system.py | 692 +++++++
test/_windows.py => psutil/tests/test_windows.py | 134 +-
{examples => scripts}/disk_usage.py | 2 +-
{examples => scripts}/free.py | 2 +-
{examples => scripts}/ifconfig.py | 2 +-
{examples => scripts}/iotop.py | 2 +-
{examples => scripts}/killall.py | 0
{examples => scripts}/meminfo.py | 2 +-
{examples => scripts}/netstat.py | 2 +-
{examples => scripts}/nettop.py | 2 +-
{examples => scripts}/pidof.py | 0
{examples => scripts}/pmap.py | 2 +-
examples/process_detail.py => scripts/procinfo.py | 12 +-
scripts/procsmem.py | 101 +
{examples => scripts}/ps.py | 2 +-
{examples => scripts}/pstree.py | 2 +-
{examples => scripts}/top.py | 6 +-
{examples => scripts}/who.py | 2 +-
setup.py | 30 +-
test/README.rst | 21 -
tox.ini | 4 +-
79 files changed, 6594 insertions(+), 3268 deletions(-)
diff --git a/.ci/travis/install.sh b/.ci/travis/install.sh
index 23d9ce0..5735b7a 100755
--- a/.ci/travis/install.sh
+++ b/.ci/travis/install.sh
@@ -3,6 +3,9 @@
set -e
set -x
+uname -a
+python -c "import sys; print(sys.version)"
+
if [[ "$(uname -s)" == 'Darwin' ]]; then
brew update || brew update
brew outdated pyenv || brew upgrade pyenv
@@ -13,22 +16,22 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
fi
case "${PYVER}" in
- py26)
- pyenv install 2.6.9
- pyenv virtualenv 2.6.9 psutil
- ;;
+ # py26)
+ # pyenv install 2.6.9
+ # pyenv virtualenv 2.6.9 psutil
+ # ;;
py27)
pyenv install 2.7.10
pyenv virtualenv 2.7.10 psutil
- ;;
- py32)
- pyenv install 3.2.6
- pyenv virtualenv 3.2.6 psutil
- ;;
- py33)
- pyenv install 3.3.6
- pyenv virtualenv 3.3.6 psutil
;;
+ # py32)
+ # pyenv install 3.2.6
+ # pyenv virtualenv 3.2.6 psutil
+ # ;;
+ # py33)
+ # pyenv install 3.3.6
+ # pyenv virtualenv 3.3.6 psutil
+ # ;;
py34)
pyenv install 3.4.3
pyenv virtualenv 3.4.3 psutil
@@ -38,14 +41,14 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
pyenv activate psutil
fi
-if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]] || [[ $PYVER == 'py26' ]]; then
+if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]] || [[ $PYVER == 'py26' ]]; then
pip install -U ipaddress unittest2 mock==1.0.1
-elif [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] || [[ $PYVER == 'py27' ]]; then
+elif [[ $TRAVIS_PYTHON_VERSION == '2.7' ]] || [[ $PYVER == 'py27' ]]; then
pip install -U ipaddress mock
-elif [[ $TRAVIS_PYTHON_VERSION == '3.2' ]] || [[ $PYVER == 'py32' ]]; then
+elif [[ $TRAVIS_PYTHON_VERSION == '3.2' ]] || [[ $PYVER == 'py32' ]]; then
pip install -U ipaddress mock
-elif [[ $TRAVIS_PYTHON_VERSION == '3.3' ]] || [[ $PYVER == 'py33' ]]; then
+elif [[ $TRAVIS_PYTHON_VERSION == '3.3' ]] || [[ $PYVER == 'py33' ]]; then
pip install -U ipaddress
fi
-pip install coverage coveralls flake8 pep8
\ No newline at end of file
+pip install coverage coveralls flake8 pep8 setuptools
diff --git a/.ci/travis/run.sh b/.ci/travis/run.sh
index 41167aa..4269f30 100755
--- a/.ci/travis/run.sh
+++ b/.ci/travis/run.sh
@@ -11,8 +11,14 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then
fi
python setup.py build
-python setup.py install
-coverage run test/test_psutil.py --include="psutil/*" --omit="test/*,*setup*"
-python test/test_memory_leaks.py
+python setup.py develop
+
+if [[ "$(uname -s)" != 'Darwin' ]]; then
+ coverage run psutil/tests/runner.py --include="psutil/*" --omit="test/*,*setup*"
+else
+ python psutil/tests/runner.py
+fi
+
+python psutil/tests/test_memory_leaks.py
flake8
pep8
diff --git a/.coveragerc b/.coveragerc
index f023909..6b6309b 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -4,12 +4,13 @@ include =
*psutil*
omit =
- test/*
- *setup*
- *_compat.py*
+ psutil/tests/*
+ setup.py
+ psutil/_compat.py
exclude_lines =
pragma: no cover
+ if PY3:
if __name__ == .__main__.:
if sys.platform.startswith
if _WINDOWS:
@@ -17,5 +18,16 @@ exclude_lines =
if enum is not None:
if enum is None:
if has_enums:
+ if LITTLE_ENDIAN:
enum.IntEnum
except ImportError:
+ raise NotImplementedError
+ if WINDOWS
+ if OSX
+ if BSD
+ if FREEBSD
+ if OPENBSD
+ if NETBSD
+ if SUNOS
+ if LINUX
+ if ppid_map is None:
diff --git a/.travis.yml b/.travis.yml
index 6ec09d3..17206c5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,26 +1,39 @@
sudo: false
language: python
+cache: pip
matrix:
include:
- python: 2.6
- python: 2.7
- python: 3.3
- python: 3.4
- - language: generic
- os: osx
- env: PYVER=py26
+ - python: 3.5
+ - "pypy"
+ # XXX - commented because OSX builds are deadly slow
+ # - language: generic
+ # os: osx
+ # env: PYVER=py26
- language: generic
os: osx
env: PYVER=py27
- - language: generic
- os: osx
- env: PYVER=py33
+ # XXX - commented because OSX builds are deadly slow
+ # - language: generic
+ # os: osx
+ # env: PYVER=py33
- language: generic
os: osx
env: PYVER=py34
+ # XXX - not supported yet
+ # - language: generic
+ # os: osx
+ # env: PYVER=py35
install:
- ./.ci/travis/install.sh
script:
- ./.ci/travis/run.sh
after_success:
- - coveralls # upload reports to coveralls.io
+ # upload reports to coveralls.io
+ - |
+ if [ "$(uname -s)" != 'Darwin' ]; then
+ coveralls
+ fi
diff --git a/CREDITS b/CREDITS
index c5e5be9..2d46e44 100644
--- a/CREDITS
+++ b/CREDITS
@@ -354,3 +354,31 @@ I: 688
N: Syohei YOSHIDA
W: https://github.com/syohex
I: 730
+
+N: Frank Benkstein
+W: https://github.com/fbenkstein
+I: 732, 733
+
+N: Visa Hankala
+E: visa at openbsd.org
+I: 741
+
+N: Sebastian-Gabriel Brestin
+C: Romania
+E: sebastianbrestin at gmail.com
+I: 704
+
+N: Timmy Konick
+W: https://github.com/tijko
+I: 751
+
+N: mpderbec
+W: https://github.com/mpderbec
+I: 660
+
+N: Mozilla Foundation
+D: sample code for process USS memory.
+
+N: wxwright
+W: https://github.com/wxwright
+I: 776
diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst
new file mode 100644
index 0000000..6807413
--- /dev/null
+++ b/DEVGUIDE.rst
@@ -0,0 +1,144 @@
+=====
+Setup
+=====
+
+If you plan on hacking on psutil this is what you're supposed to do first:
+
+- clone the GIT repository::
+
+ $ git clone git at github.com:giampaolo/psutil.git
+
+- install system deps (see `install instructions <https://github.com/giampaolo/psutil/blob/master/INSTALL.rst>`__).
+
+- install development deps; these are useful for running tests (e.g. mock,
+ unittest2), building doc (e.g. sphinx), running linters (flake8), etc. ::
+
+ $ make setup-dev-env
+
+- bear in mind that ``make`` (see `Makefile <https://github.com/giampaolo/psutil/blob/master/Makefile>`_)
+ is the designated tool to run tests, build etc. and that it is also available
+ on Windows (see `make.bat <https://github.com/giampaolo/psutil/blob/master/make.bat>`_).
+- (UNIX only) run ``make install-git-hooks``: this will reject your commit
+ if python code is not PEP8 compliant.
+- run ``make test`` to run tests.
+
+============
+Coding style
+============
+
+- python code strictly follows `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_
+ styling guides and this is enforced by ``make install-git-hooks``.
+- C code strictly follows `PEP 7 <https://www.python.org/dev/peps/pep-0007/>`_
+ styling guides.
+
+========
+Makefile
+========
+
+Some useful make commands::
+
+ $ make install # install
+ $ make test # run all tests
+ $ make test-memleaks # run memory leak tests
+ $ make coverage # run test coverage
+ $ make flake8 # run PEP8 linter
+
+====================
+Adding a new feature
+====================
+
+Usually the files involved when adding a new functionality are:
+
+.. code-block:: plain
+
+ psutil/__init__.py # main psutil namespace
+ psutil/_ps{platform}.py # python platform wrapper
+ psutil/_psutil_{platform}.c # C platform extension
+ psutil/_psutil_{platform}.h # C header file
+ psutil/tests/test_process|system.py # main test suite
+ psutil/tests/test_{platform}.py # platform specific test suite
+
+Typical process occurring when adding a new functionality (API):
+
+- define the new function in ``psutil/__init__.py``.
+- write the platform specific implementation in ``psutil/_ps{platform}.py``
+ (e.g. ``psutil/_pslinux.py``).
+- if the change requires C, write the C implementation in
+ ``psutil/_psutil_{platform}.c`` (e.g. ``psutil/_psutil_linux.c``).
+- write a generic test in ``psutil/tests/test_system.py`` or
+ ``psutil/tests/test_process.py``.
+- if possible, write a cross platform test in
+ ``psutil/tests/test_{platform}.py`` (e.g. ``test_linux.py``).
+- update doc in ``doc/index.py``.
+- update ``HISTORY.rst``.
+- update ``README.rst`` (if necessary).
+- make a pull request.
+
+======================
+Continuous integration
+======================
+
+All of the services listed below are automatically run on ``git push``.
+
+Unit tests
+----------
+
+Tests are automatically run for every GIT push on **Linux**, **OSX** and
+**Windows** by using:
+
+- `Travis <https://travis-ci.org/giampaolo/psutil>`_ (Linux, OSX)
+- `Appveyor <https://ci.appveyor.com/project/giampaolo/psutil>`_ (Windows)
+
+Test files controlling these are
+`.travis.yml <https://github.com/giampaolo/psutil/blob/master/.travis.yml>`_
+and
+`appveyor.yml <https://github.com/giampaolo/psutil/blob/master/appveyor.yml>`_.
+Both services run psutil test suite against all supported python version
+(2.6 - 3.5).
+Two icons in the home page (README) always show the build status:
+
+.. image:: https://api.travis-ci.org/giampaolo/psutil.png?branch=master
+ :target: https://travis-ci.org/giampaolo/psutil
+ :alt: Linux tests (Travis)
+
+.. image:: https://ci.appveyor.com/api/projects/status/qdwvw7v1t915ywr5/branch/master?svg=true
+ :target: https://ci.appveyor.com/project/giampaolo/psutil
+ :alt: Windows tests (Appveyor)
+
+OSX, FreeBSD and Solaris are currently tested manually (sigh!).
+
+Test coverage
+-------------
+
+Test coverage is provided by `coveralls.io <https://coveralls.io/github/giampaolo/psutil>`_,
+it is controlled via `.travis.yml <https://github.com/giampaolo/psutil/blob/master/.travis.yml>`_
+and it is updated on every git push.
+An icon in the home page (README) always shows the last coverage percentage:
+
+.. image:: https://coveralls.io/repos/giampaolo/psutil/badge.svg?branch=master&service=github
+ :target: https://coveralls.io/github/giampaolo/psutil?branch=master
+ :alt: Test coverage (coverall.io)
+
+=============
+Documentation
+=============
+
+- doc source code is written in a single file: `/docs/index.rst <https://raw.githubusercontent.com/giampaolo/psutil/master/docs/index.rst>`_.
+- it uses `RsT syntax <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_
+ and it's built with `sphinx <http://sphinx-doc.org/>`_.
+- doc can be built with ``make setup-dev-env; cd docs; make html``.
+- public is hosted on http://pythonhosted.org/psutil/.
+- it is uploaded on every new release with ``make upload-doc``.
+
+=======================
+Releasing a new version
+=======================
+
+These are note for myself (Giampaolo):
+
+- make sure all tests pass and all builds are green.
+- upload source tarball on PYPI with ``make upload-src``.
+- upload exe and wheel files for windows on PYPI with ``make upload-all``.
+- upload updated doc on http://pythonhosted.org/psutil with ``make upload-doc``.
+- GIT tag the new release with ``make git-tag-release``.
+- post on psutil and python-announce mailing lists, twitter, g+, blog.
diff --git a/DEVNOTES.rst b/DEVNOTES.rst
deleted file mode 100644
index 2dbdd92..0000000
--- a/DEVNOTES.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-NetBSD
-======
-
-Setup
------
-
-- $ PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/7.0/All"
- $ export PKG_PATH
- $ pkg_add -v pkgin
- $ pkgin install git python27 screen wget gcc
diff --git a/HISTORY.rst b/HISTORY.rst
index d715fb0..84187a1 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,5 +1,72 @@
Bug tracker at https://github.com/giampaolo/psutil/issues
+4.1.0 - 2016-03-12
+==================
+
+**Enhancements**
+
+- #777: [Linux] Process.open_files() on Linux return 3 new fields: position,
+ mode and flags.
+- #779: Process.cpu_times() returns two new fields, 'children_user' and
+ 'children_system' (always set to 0 on OSX and Windows).
+- #789: [Windows] psutil.cpu_times() return two new fields: "interrupt" and
+ "dpc". Same for psutil.cpu_times_percent().
+- #792: new psutil.cpu_stats() function returning number of CPU ctx switches
+ interrupts, soft interrupts and syscalls.
+
+**Bug fixes**
+
+- #774: [FreeBSD] net_io_counters() dropout is no longer set to 0 if the kernel
+ provides it.
+- #776: [Linux] Process.cpu_affinity() may erroneously raise NoSuchProcess.
+ (patch by wxwright)
+- #780: [OSX] psutil does not compile with some gcc versions.
+- #786: net_if_addrs() may report incomplete MAC addresses.
+- #788: [NetBSD] virtual_memory()'s buffers and shared values were set to 0.
+- #790: [OSX] psutil won't compile on OSX 10.4.
+
+
+4.0.0 - 2016-02-17
+==================
+
+**Enhancements**
+
+- #523: [Linux, FreeBSD] disk_io_counters() return a new "busy_time" field.
+- #660: [Windows] make.bat is smarter in finding alternative VS install
+ locations. (patch by mpderbec)
+- #732: Process.environ(). (patch by Frank Benkstein)
+- #753: [Linux, OSX, Windows] Process USS and PSS (Linux) "real" memory stats.
+ (patch by Eric Rahm)
+- #755: Process.memory_percent() "memtype" parameter.
+- #758: tests now live in psutil namespace.
+- #760: expose OS constants (psutil.LINUX, psutil.OSX, etc.)
+- #756: [Linux] disk_io_counters() return 2 new fields: read_merged_count and
+ write_merged_count.
+- #762: new scripts/procsmem.py script.
+
+**Bug fixes**
+
+- #685: [Linux] virtual_memory() provides wrong results on systems with a lot
+ of physical memory.
+- #704: [Solaris] psutil does not compile on Solaris sparc.
+- #734: on Python 3 invalid UTF-8 data is not correctly handled for process
+ name(), cwd(), exe(), cmdline() and open_files() methods resulting in
+ UnicodeDecodeError exceptions. 'surrogateescape' error handler is now
+ used as a workaround for replacing the corrupted data.
+- #737: [Windows] when the bitness of psutil and the target process was
+ different cmdline() and cwd() could return a wrong result or incorrectly
+ report an AccessDenied error.
+- #741: [OpenBSD] psutil does not compile on mips64.
+- #751: [Linux] fixed call to Py_DECREF on possible Null object.
+- #754: [Linux] cmdline() can be wrong in case of zombie process.
+- #759: [Linux] Process.memory_maps() may return paths ending with " (deleted)"
+- #761: [Windows] psutil.boot_time() wraps to 0 after 49 days.
+- #764: [NetBSD] fix compilation on NetBSD-6.x.
+- #766: [Linux] net_connections() can't handle malformed /proc/net/unix file.
+- #767: [Linux] disk_io_counters() may raise ValueError on 2.6 kernels and it's
+ broken on 2.4 kernels.
+- #770: [NetBSD] disk_io_counters() metrics didn't update.
+
3.4.2 - 2016-01-20
==================
@@ -11,6 +78,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
**Bug fixes**
+- #724: [FreeBSD] psutil.virtual_memory().total is incorrect.
- #730: [FreeBSD] psutil.virtual_memory() crashes.
diff --git a/IDEAS b/IDEAS
new file mode 100644
index 0000000..33178a7
--- /dev/null
+++ b/IDEAS
@@ -0,0 +1,151 @@
+TODO
+====
+
+A collection of ideas and notes about stuff to implement in future versions.
+"#NNN" occurrences refer to bug tracker issues at:
+https://github.com/giampaolo/psutil/issues
+
+PLATFORMS
+=========
+
+- #355 (patch): Android
+- #605 (branch): AIX
+- #276: GNU/Hurd
+- DragonFlyBSD
+- HP-UX
+
+FEATURES
+========
+
+- (UNIX) process root (different from cwd)
+
+- #782: (UNIX) process num of signals received.
+
+- (Linux) locked files via /proc/locks:
+ https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-proc-locks.html
+
+- #371: CPU temperature (apparently OSX and Linux only; on Linux it requires
+ lm-sensors lib).
+
+- #269: NIC rx/tx queue. This should probably go into net_if_stats().
+ Figure out on what platforms this is supported:
+ Linux: yes
+ Others: ?
+
+- Process.threads(): thread names; patch for OSX available at:
+ https://code.google.com/p/plcrashreporter/issues/detail?id=65
+ Sample code:
+ https://github.com/janmojzis/pstree/blob/master/proc_kvm.c
+
+- Asynchronous psutil.Popen (see http://bugs.python.org/issue1191964)
+
+- (Windows) fall back on using WMIC for Process methods returning AccessDenied
+
+- #613: thread names.
+
+- #604: emulate os.getloadavg() on Windows
+
+- scripts/taskmgr-gui.py (using tk).
+
+- system-wide number of open file descriptors:
+ - https://jira.hyperic.com/browse/SIGAR-30
+ - http://www.netadmintools.com/part295.html
+
+- Number of system threads.
+ - Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684824(v=vs.85).aspx
+
+- #357: what CPU a process is on.
+
+- Doc / wiki which compares similarities between UNIX cli tools and psutil.
+ Example:
+ ```
+ df -a -> psutil.disk_partitions
+ lsof -> psutil.Process.open_files() and psutil.Process.open_connections()
+ killall-> (actual script)
+ tty -> psutil.Process.terminal()
+ who -> psutil.users()
+ ```
+
+- psutil.proc_tree() something which obtains a {pid:ppid, ...} dict for
+ all running processes in one shot. This can be factored out from
+ Process.children() and exposed as a first class function.
+ PROS: on Windows we can take advantage of _psutil_windows.ppid_map()
+ which is faster than iterating over all pids and calling ppid().
+ CONS: scripts/pstree.py shows this can be easily done in the user code
+ so maybe it's not worth the addition.
+
+- advanced cmdline interface exposing the whole API and providing different
+ kind of outputs (e.g. pprinted, colorized, json).
+
+- [Linux]: process cgroups (http://en.wikipedia.org/wiki/Cgroups). They look
+ similar to prlimit() in terms of functionality but uglier (they should allow
+ limiting per-process network IO resources though, which is great). Needs
+ further reading.
+
+- Python 3.3. exposed different sched.h functions:
+ http://docs.python.org/dev/whatsnew/3.3.html#os
+ http://bugs.python.org/issue12655
+ http://docs.python.org/dev/library/os.html#interface-to-the-scheduler
+ It might be worth to take a look and figure out whether we can include some
+ of those in psutil.
+ Also, we can probably reimplement wait_pid() on POSIX which is currently
+ implemented as a busy-loop.
+
+- Certain systems provide CPU times about process children. On those systems
+ Process.cpu_times() might return a (user, system, user_children,
+ system_children) ntuple.
+ - Linux: /proc/{PID}/stat
+ - Solaris: pr_cutime and pr_cstime
+ - FreeBSD: none
+ - OSX: none
+ - Windows: none
+
+- ...also, os.times() provides 'elapsed' times as well.
+
+- ...also Linux provides guest_time and cguest_time.
+
+- Enrich exception classes hierarchy on Python >= 3.3 / post PEP-3151 so that:
+ - NoSuchProcess inherits from ProcessLookupError
+ - AccessDenied inherits from PermissionError
+ - TimeoutExpired inherits from TimeoutError (debatable)
+ See: http://docs.python.org/3/library/exceptions.html#os-exceptions
+
+- Process.threads() might grow an extra "id" parameter so that it can be
+ used as such:
+ ```
+ >>> p = psutil.Process(os.getpid())
+ >>> p.threads(id=psutil.current_thread_id())
+ thread(id=2539, user_time=0.03, system_time=0.02)
+ >>>
+ ```
+ Note: this leads to questions such as "should we have a custom NoSuchThread
+ exception? Also see issue #418.
+ Note #2: this would work with os.getpid() only.
+ psutil.current_thread_id() might be desirable as per issue #418 though.
+
+- should psutil.TimeoutExpired exception have a 'msg' kwarg similar to
+ NoSuchProcess and AccessDenied? Not that we need it, but currently we
+ cannot raise a TimeoutExpired exception with a specific error string.
+
+- process_iter() might grow an "attrs" parameter similar to Process.as_dict()
+ invoke the necessary methods and include the results into a "cache"
+ attribute attached to the returned Process instances so that one can avoid
+ catching NSP and AccessDenied:
+ for p in process_iter(attrs=['cpu_percent']):
+ print(p.cache['cpu_percent'])
+ This also leads questions as whether we should introduce a sorting order.
+
+- round Process.memory_percent() result?
+
+- #550: number of threads per core.
+
+- Have psutil.Process().cpu_affinity([]) be an alias for "all CPUs"?
+
+
+RESOURCES
+=========
+
+- sigar: https://github.com/hyperic/sigar (Java)
+- zabbix: https://zabbix.org/wiki/Get_Zabbix
+- libstatgrab: http://www.i-scream.org/libstatgrab/
+- top: http://www.unixtop.org/
diff --git a/INSTALL.rst b/INSTALL.rst
index fdbc4d6..d2cb022 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -1,116 +1,90 @@
-============================
-Installing using pip on UNIX
-============================
+*Note: pip is the easiest way to install psutil.
+It is shipped by default with Python 2.7.9+ and 3.4+. If you're using an
+older Python version* `install pip <https://pip.pypa.io/en/latest/installing/>`__
+*first.*
-The easiest way to install psutil on UNIX is by using pip (but first you might
-need to install python header files; see later).
-First install pip::
+Linux
+=====
- $ wget https://bootstrap.pypa.io/get-pip.py
- $ python get-pip.py
-
-...then run::
+Ubuntu / Debian::
+ $ sudo apt-get install gcc python-dev
$ pip install psutil
-You may need to install gcc and python header files first (see later).
-
+RedHat::
-=====================
-Installing on Windows
-=====================
+ $ sudo yum install gcc python-devel
+ $ pip install psutil
-Just get the right installer for your Python version and architecture from:
-https://pypi.python.org/pypi/psutil/#downloads
-Since wheels installers are also available you may also use pip.
+OSX
+===
+Install `XcodeTools <https://developer.apple.com/downloads/?name=Xcode>`__
+first, then:
-========================================
-Compiling on Windows using Visual Studio
-========================================
+::
-In order to compile psutil on Windows you'll need Visual Studio (Mingw32 is
-no longer supported). You must have the same version of Visual Studio used to
-compile your installation of Python, that is::
+ $ pip install psutil
-* Python 2.6: VS 2008 (download it from `here <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_)
-* Python 2.7: VS 2008 (download it from `here <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_)
-* Python 3.3, 3.4: VS 2010 (you can download it from `MS website <http://www.visualstudio.com/downloads/download-visual-studio-vs#d-2010-express>`_)
-* Python 3.5: `VS 2015 UP <http://www.visualstudio.com/en-au/news/vs2015-preview-vs>`_
+Windows
+=======
-...then run::
+The easiest way to install psutil on Windows is to just use the pre-compiled
+exe/wheel installers on
+`PYPI <https://pypi.python.org/pypi/psutil/#downloads>`__ via pip::
- setup.py build
+ $ C:\Python27\python.exe -m pip install psutil
-...or::
+If you want to compile psutil from sources you'll need **Visual Studio**
+(Mingw32 is no longer supported):
- make.bat build
+* Python 2.6, 2.7: `VS-2008 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`__
+* Python 3.3, 3.4: `VS-2010 <http://www.visualstudio.com/downloads/download-visual-studio-vs#d-2010-express>`__
+* Python 3.5+: `VS-2015 <http://www.visualstudio.com/en-au/news/vs2015-preview-vs>`__
Compiling 64 bit versions of Python 2.6 and 2.7 with VS 2008 requires
-Windows SDK and .NET Framework 3.5 SP1 to be installed first.
-Once you have those run vcvars64.bat, then compile:
-http://stackoverflow.com/questions/11072521/
-
-===================
-Installing on Linux
-===================
-
-gcc is required and so the python headers. They can easily be installed by
-using the distro package manager. For example, on Debian and Ubuntu::
-
- $ sudo apt-get install gcc python-dev
-
-...on Redhat and CentOS::
-
- $ sudo yum install gcc python-devel
-
-Once done, you can build/install psutil with::
-
- $ python setup.py install
-
-
-==================
-Installing on OS X
-==================
-
-OS X installation from source will require gcc which you can obtain as part of
-the 'XcodeTools' installer from Apple. Then you can run the standard distutils
-commands.
-To build only::
+`Windows SDK and .NET Framework 3.5 SP1 <https://www.microsoft.com/en-us/download/details.aspx?id=3138>`__.
+Once installed run vcvars64.bat, then you can finally compile (see
+`here <http://stackoverflow.com/questions/11072521/>`__).
+To compile / install psutil from sources on Windows run::
- $ python setup.py build
+ $ make.bat build
+ $ make.bat install
-To install and build::
+FreeBSD
+=======
- $ python setup.py install
+::
+ $ pkg install python gcc
+ $ python -m pip install psutil
-=====================
-Installing on FreeBSD
-=====================
+OpenBSD
+=======
-The same compiler used to install Python must be present on the system in order
-to build modules using distutils. Assuming it is installed, you can build using
-the standard distutils commands.
+::
-Build only::
+ $ export PKG_PATH=http://ftp.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`
+ $ pkg_add -v python gcc
+ $ python -m pip install psutil
- $ python setup.py build
+NetBSD
+======
-Install and build::
+::
- $ python setup.py install
+ $ export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
+ $ pkg_add -v pkgin
+ $ pkgin install python gcc
+ $ python -m pip install psutil
+Solaris
+=======
-========
-Makefile
-========
+XXX
-A makefile is available for both UNIX and Windows (make.bat). It provides
-some automations for the tasks described above and might be preferred over
-using setup.py. With it you can::
+Dev Guide
+=========
- $ make install # just install (in --user mode)
- $ make uninstall # uninstall (needs pip)
- $ make test # run tests
- $ make clean # remove installation files
+If you plan on hacking on psutil you may want to take a look at the
+`dev guide <https://github.com/giampaolo/psutil/blob/master/DEVGUIDE.rst>`__.
diff --git a/MANIFEST.in b/MANIFEST.in
index bddf43d..6728031 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,8 +4,9 @@ include .gitignore
include .travis.yml
include appveyor.yml
include CREDITS
-include DEVNOTES.rst
+include DEVGUIDE.rst
include HISTORY.rst
+include IDEAS
include INSTALL.rst
include LICENSE
include make.bat
@@ -13,11 +14,9 @@ include Makefile
include MANIFEST.in
include README.rst
include setup.py
-include TODO
include tox.ini
recursive-exclude docs/_build *
recursive-include .ci *
recursive-include docs *
-recursive-include examples *.py
-recursive-include psutil *.py *.c *.h
-recursive-include test *.py README*
+recursive-include psutil *.py *.c *.h README*
+recursive-include scripts *.py
diff --git a/Makefile b/Makefile
index 153a077..3e6995d 100644
--- a/Makefile
+++ b/Makefile
@@ -4,14 +4,14 @@
# You can set these variables from the command line.
PYTHON = python
-TSCRIPT = test/test_psutil.py
+TSCRIPT = psutil/tests/runner.py
all: test
clean:
rm -f `find . -type f -name \*.py[co]`
rm -f `find . -type f -name \*.so`
- rm -f `find . -type f -name .\*~`
+ rm -f `find . -type f -name \*.~`
rm -f `find . -type f -name \*.orig`
rm -f `find . -type f -name \*.bak`
rm -f `find . -type f -name \*.rej`
@@ -57,7 +57,7 @@ setup-dev-env: install-git-hooks
unittest2 \
install: build
- $(PYTHON) setup.py install --user
+ $(PYTHON) setup.py develop --user
uninstall:
cd ..; $(PYTHON) -m pip uninstall -y -v psutil
@@ -66,19 +66,23 @@ test: install
$(PYTHON) $(TSCRIPT)
test-process: install
- $(PYTHON) -m unittest -v test.test_psutil.TestProcess
+ $(PYTHON) -m unittest -v psutil.tests.test_process
test-system: install
- $(PYTHON) -m unittest -v test.test_psutil.TestSystemAPIs
+ $(PYTHON) -m unittest -v psutil.tests.test_system
test-memleaks: install
- $(PYTHON) test/test_memory_leaks.py
+ $(PYTHON) psutil/tests/test_memory_leaks.py
# Run a specific test by name; e.g. "make test-by-name disk_" will run
# all test methods containing "disk_" in their name.
# Requires "pip install nose".
test-by-name: install
- @$(PYTHON) -m nose test/test_psutil.py test/_* --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
+ @$(PYTHON) -m nose psutil/tests/*.py --nocapture -v -m $(filter-out $@,$(MAKECMDGOALS))
+
+# Run specific platform tests only.
+test-platform: install
+ $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS") if getattr(psutil, x)][0])'`.py
# Same as above but for test_memory_leaks.py script.
test-memleaks-by-name: install
diff --git a/PKG-INFO b/PKG-INFO
index 422f7c0..97e909d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: psutil
-Version: 3.4.2
+Version: 4.1.0
Summary: psutil is a cross-platform library for retrieving information onrunning processes and system utilization (CPU, memory, disks, network)in Python.
Home-page: https://github.com/giampaolo/psutil
Author: Giampaolo Rodola
@@ -39,8 +39,8 @@ Description: .. image:: https://img.shields.io/pypi/dm/psutil.svg
===========
- `Home page <https://github.com/giampaolo/psutil>`_
+ - `Install <https://github.com/giampaolo/psutil/blob/master/INSTALL.rst>`_
- `Documentation <http://pythonhosted.org/psutil/>`_
- - `Installation <https://github.com/giampaolo/psutil/blob/master/INSTALL.rst>`_
- `Download <https://pypi.python.org/pypi?:action=display&name=psutil#downloads>`_
- `Forum <http://groups.google.com/group/psutil/topics>`_
... 12744 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-psutil.git
More information about the Python-modules-commits
mailing list