Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/giampaolo/psutil:
  fix ruff errs
  skip flaky test on netbsd
  giampaolo#2408: fix some tests which were still failing due to the old name
  giampaolo#2408: ignore old "connections" name into as_dict()
  Rename `Process.connections()` to `Process.net_connections()` (giampaolo#2408)
  Remove disk_partitions() `maxfile` and `maxpath` fields (giampaolo#2405)
  Speedup process iter (don't check for PID reuse) (giampaolo#2404)
  • Loading branch information
ddelange committed May 16, 2024
2 parents 4845910 + 3c518a3 commit 436580f
Show file tree
Hide file tree
Showing 35 changed files with 302 additions and 272 deletions.
27 changes: 26 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
*Bug tracker at https://github.com/giampaolo/psutil/issues*

5.9.9 (IN DEVELOPMENT)
6.0.0 (IN DEVELOPMENT)
======================

**Enhancements**

- 2109_: ``maxfile`` and ``maxpath`` fields were removed from the namedtuple
returned by `disk_partitions()`_. Reason: on network filesystems (NFS) this
can potentially take a very long time to complete.
- 2366_, [Windows]: log debug message when using slower process APIs.
- 2375_, [macOS]: provide arm64 wheels. (patch by Matthieu Darbois)
- 2396_: `process_iter()`_ no longer pre-emptively checks whether PIDs have
been reused. This makes `process_iter()`_ around 20x times faster.
- 2396_: a new ``psutil.process_iter.cache_clear()`` API can be used the clear
`process_iter()`_ internal cache.
- 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.

**Bug fixes**

Expand All @@ -20,6 +30,20 @@
- 2362_, [macOS]: can't compile on macOS 10.11. (patch by Ryan Schmidt)
- 2365_, [macOS]: can't compile on macOS < 10.9. (patch by Ryan Schmidt)

**Porting notes**

Version 6.0.0 introduces some changes which affect backward compatibility:

- 2109_: the namedtuple returned by `disk_partitions()`_' no longer has
``maxfile`` and ``maxpath`` fields.
- 2396_: `process_iter()`_ no longer pre-emptively checks whether PIDs have
been reused. If you want to check for PID reusage you are supposed to use
`Process.is_running()`_ against the yielded `Process`_ instances. That will
also automatically remove reused PIDs from `process_iter()`_ internal cache.
- 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.

5.9.8
=====

Expand Down Expand Up @@ -2626,6 +2650,7 @@ In most cases accessing the old names will work but it will cause a
.. _`Process.memory_maps()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_maps
.. _`Process.memory_percent()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_percent
.. _`Process.name()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.name
.. _`Process.net_connections()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.net_connections
.. _`Process.nice()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.nice
.. _`Process.num_ctx_switches()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.num_ctx_switches
.. _`Process.num_fds()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.num_fds
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ test-contracts: ## APIs sanity tests.
${MAKE} build
$(PYTHON_ENV_VARS) $(PYTHON) $(TSCRIPT) $(ARGS) psutil/tests/test_contracts.py

test-connections: ## Test net_connections() and Process.connections().
test-connections: ## Test psutil.net_connections() and Process.net_connections().
${MAKE} build
$(PYTHON_ENV_VARS) $(PYTHON) $(TSCRIPT) $(ARGS) psutil/tests/test_connections.py

Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ Disks
.. code-block:: python
>>> psutil.disk_partitions()
[sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid', maxfile=255, maxpath=4096),
sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', opts='rw', maxfile=255, maxpath=4096)]
[sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'),
sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', opts='rw')]
>>>
>>> psutil.disk_usage('/')
sdiskusage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)
Expand Down Expand Up @@ -403,7 +403,7 @@ Process management
[popenfile(path='/home/giampaolo/monit.py', fd=3, position=0, mode='r', flags=32768),
popenfile(path='/var/log/monit.log', fd=4, position=235542, mode='a', flags=33793)]
>>>
>>> p.connections(kind='tcp')
>>> p.net_connections(kind='tcp')
[pconn(fd=115, family=<AddressFamily.AF_INET: 2>, type=<SocketType.SOCK_STREAM: 1>, laddr=addr(ip='10.0.0.1', port=48776), raddr=addr(ip='93.186.135.91', port=80), status='ESTABLISHED'),
pconn(fd=117, family=<AddressFamily.AF_INET: 2>, type=<SocketType.SOCK_STREAM: 1>, laddr=addr(ip='10.0.0.1', port=43761), raddr=addr(ip='72.14.234.100', port=80), status='CLOSING')]
>>>
Expand Down
12 changes: 4 additions & 8 deletions docs/DEVNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ FEATURES
Example:
```
df -a -> psutil.disk_partitions
lsof -> psutil.Process.open_files() and psutil.Process.open_connections()
lsof -> psutil.Process.open_files() and psutil.Process.net_connections()
killall-> (actual script)
tty -> psutil.Process.terminal()
who -> psutil.users()
Expand Down Expand Up @@ -113,13 +113,9 @@ REJECTED IDEAS
INCONSISTENCIES
===============

- disk_partitions(all=False) should have been "perdisk=False" instead:
* disk_io_counters(perdisk=False)
* net_io_counters(pernic=False)
* cpu_times_percent(percpu=False)
* cpu_times(percpu=False)
* cpu_freq(percpu=False)
- PROCFS_PATH should have been set_procfs_path()
- PROCFS_PATH should have been set_procfs_path().
- `virtual_memory()` should have been `memory_virtual()`.
- `swap_memory()` should have been `memory_swap()`.

RESOURCES
=========
Expand Down
Loading

0 comments on commit 436580f

Please sign in to comment.