Skip to content

Commit 86df38e

Browse files
committed
Doc: show sidebar icons in seealso:: sections
1 parent 992cefe commit 86df38e

7 files changed

Lines changed: 101 additions & 31 deletions

File tree

docs/_static/css/admonitions.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ div.seealso a.reference:hover {
5858
color: var(--adm-seealso-hover);
5959
}
6060

61+
/* Same page icon as the sidebar */
62+
div.seealso ul {
63+
list-style: none;
64+
padding-left: 0;
65+
}
66+
67+
div.seealso a.reference.internal::before,
68+
div.seealso a.extlink-src[href*="/scripts/"]::before {
69+
font-family: var(--doc-icon-font, var(--fa-family-classic));
70+
font-weight: var(--doc-icon-weight, 900);
71+
display: inline-block;
72+
width: 1.3em;
73+
margin-right: 0.3em;
74+
font-size: 0.85em;
75+
text-align: center;
76+
content: var(--doc-icon, "\f0f6");
77+
}
78+
6179
div.admonition a {
6280
text-decoration: none;
6381
}

docs/_static/css/doc-icons.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* Left sidebar menu icons. Also shared with search results. */
1+
/* Left sidebar menu icons. Also shared with search results and
2+
see-also links. */
23

34
/* Documentation */
45
a[href*="install/"],
@@ -25,6 +26,11 @@ body[data-page="faq"] .left-sidebar a.current {
2526
--doc-icon: "\3f";
2627
}
2728

29+
div.seealso a[href*="faq/"] {
30+
--doc-icon: "\f059";
31+
--doc-icon-weight: 400;
32+
}
33+
2834
a[href*="performance/"],
2935
ul.search > li:has(> a[href*="performance/"]),
3036
body[data-page="performance"] .left-sidebar a.current {
@@ -128,3 +134,9 @@ ul.search > li:has(> a[href*="genindex/"]),
128134
body[data-page="genindex"] .left-sidebar a.current {
129135
--doc-icon: "\f15d";
130136
}
137+
138+
a.extlink-src[href*="/scripts/"] {
139+
--doc-icon: ">_";
140+
--doc-icon-font: var(--font-mono);
141+
--doc-icon-weight: 600;
142+
}

docs/_static/css/versions.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
font-weight: 900;
4646
font-size: 0.7em;
4747
opacity: 0.9;
48-
transform: rotate(180deg);
48+
transform: rotate(180deg) translateY(1px);
4949
transition: transform 0.15s;
5050
}
5151

5252
.topbar-versions[open] > summary::after {
53-
transform: rotate(0deg);
53+
transform: rotate(0deg) translateY(1px);
5454
}
5555

5656
.topbar-versions-menu {

docs/_static/fonts/README.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ only), then trimmed of unused OpenType features with pyftsubset:
2121

2222
pyftsubset FONT.woff2 --unicodes='*' --layout-features='kern,liga,tnum' \
2323
--no-hinting --flavor=woff2 --output-file=FONT.woff2
24+
25+
The fa-*-subset.woff2 files contain only the glyphs the theme uses. To
26+
add one, take the full font from the FontAwesome web release and re-run
27+
pyftsubset with the current codepoints (read them from the shipped
28+
subset with fontTools' getBestCmap()) plus the new one:
29+
30+
pyftsubset fa-solid-900.woff2 --unicodes=U+F002,...,U+FNEW \
31+
--no-hinting --flavor=woff2 --output-file=fa-solid-subset.woff2
156 Bytes
Binary file not shown.
120 Bytes
Binary file not shown.

docs/api.rst

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ CPU
123123
[5.6, 1.0]
124124
>>>
125125
126-
.. seealso:: :ref:`faq_cpu_percent`
126+
.. seealso::
127+
- :ref:`faq_cpu_percent`
127128

128129
.. versionchanged:: 5.9.6
129130
the function is now thread safe.
@@ -135,7 +136,8 @@ CPU
135136
in :func:`cpu_percent`. On Linux, :field:`guest` and :field:`guest_nice`
136137
percentages are not accounted in :field:`user` and :field:`user_nice`.
137138

138-
.. seealso:: :ref:`faq_cpu_percent`
139+
.. seealso::
140+
- :ref:`faq_cpu_percent`
139141

140142
.. versionchanged:: 5.9.6
141143
function is now thread safe.
@@ -170,7 +172,8 @@ CPU
170172
>>> len(psutil.Process().cpu_affinity())
171173
1
172174
173-
.. seealso:: :ref:`faq_cpu_count`
175+
.. seealso::
176+
- :ref:`faq_cpu_count`
174177

175178
.. function:: cpu_stats()
176179

@@ -475,7 +478,8 @@ Disks
475478
[sdiskpart(device='/dev/sda3', mountpoint='/', fstype='ext4', opts='rw,errors=remount-ro'),
476479
sdiskpart(device='/dev/sda7', mountpoint='/home', fstype='ext4', opts='rw')]
477480
478-
.. seealso:: :src:`scripts/disk_usage.py`.
481+
.. seealso::
482+
- :src:`scripts/disk_usage.py`
479483

480484
.. versionchanged:: 5.7.4
481485
added :field:`maxfile` and :field:`maxpath` fields.
@@ -505,7 +509,8 @@ Disks
505509
:field:`percent` may appear ~5% higher than expected. All values match the
506510
``df`` command line utility.
507511

508-
.. seealso:: :src:`scripts/disk_usage.py`.
512+
.. seealso::
513+
- :src:`scripts/disk_usage.py`
509514

510515
.. function:: disk_io_counters(perdisk=False, nowrap=True)
511516

@@ -603,7 +608,9 @@ Network
603608
{'lo': snetio(bytes_sent=547971, bytes_recv=547971, packets_sent=5075, packets_recv=5075, errin=0, errout=0, dropin=0, dropout=0),
604609
'wlan0': snetio(bytes_sent=13921765, bytes_recv=62162574, packets_sent=79097, packets_recv=89648, errin=0, errout=0, dropin=0, dropout=0)}
605610
606-
.. seealso:: :src:`scripts/nettop.py` and :src:`scripts/ifconfig.py`.
611+
.. seealso::
612+
- :src:`scripts/nettop.py`
613+
- :src:`scripts/ifconfig.py`
607614

608615
.. function:: net_connections(kind="inet")
609616

@@ -720,7 +727,9 @@ Network
720727
snicaddr(family=<AddressFamily.AF_LINK: 17>, address='c4:85:08:45:06:41', netmask=None, broadcast='ff:ff:ff:ff:ff:ff', ptp=None)]}
721728
>>>
722729
723-
.. seealso:: :src:`scripts/nettop.py` and :src:`scripts/ifconfig.py`.
730+
.. seealso::
731+
- :src:`scripts/nettop.py`
732+
- :src:`scripts/ifconfig.py`
724733

725734
.. versionchanged:: 7.0.0
726735
Windows: added support for :field:`broadcast` field, which is no longer
@@ -745,7 +754,9 @@ Network
745754
{'eth0': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_FULL: 2>, speed=100, mtu=1500, flags='up,broadcast,running,multicast'),
746755
'lo': snicstats(isup=True, duplex=<NicDuplex.NIC_DUPLEX_UNKNOWN: 0>, speed=0, mtu=65536, flags='up,loopback,running')}
747756
748-
.. seealso:: :src:`scripts/nettop.py` and :src:`scripts/ifconfig.py`.
757+
.. seealso::
758+
- :src:`scripts/nettop.py`
759+
- :src:`scripts/ifconfig.py`
749760

750761
.. versionchanged:: 5.7.3
751762
UNIX: :field:`isup` also reflects whether the :term:`NIC` is running.
@@ -784,7 +795,9 @@ Sensors
784795
shwtemp(label='Core 2', current=45.0, high=100.0, critical=100.0),
785796
shwtemp(label='Core 3', current=47.0, high=100.0, critical=100.0)]}
786797
787-
.. seealso:: :src:`scripts/temperatures.py` and :src:`scripts/sensors.py`.
798+
.. seealso::
799+
- :src:`scripts/temperatures.py`
800+
- :src:`scripts/sensors.py`
788801

789802
.. availability:: Linux, FreeBSD
790803

@@ -802,7 +815,9 @@ Sensors
802815
>>> psutil.sensors_fans()
803816
{'asus': [sfan(label='cpu_fan', current=3200)]}
804817
805-
.. seealso:: :src:`scripts/fans.py` and :src:`scripts/sensors.py`.
818+
.. seealso::
819+
- :src:`scripts/fans.py`
820+
- :src:`scripts/sensors.py`
806821

807822
.. availability:: Linux
808823

@@ -834,7 +849,9 @@ Sensors
834849
>>> print("charge = %s%%, time left = %s" % (battery.percent, secs2hours(battery.secsleft)))
835850
charge = 93%, time left = 4:37:08
836851
837-
.. seealso:: :src:`scripts/battery.py` and :src:`scripts/sensors.py`.
852+
.. seealso::
853+
- :src:`scripts/battery.py`
854+
- :src:`scripts/sensors.py`
838855

839856
.. availability:: Linux, Windows, macOS, FreeBSD
840857

@@ -960,7 +977,8 @@ Functions
960977
:func:`process_iter` call will overwrite or clear any previously
961978
pre-fetched values. Do not rely on cached values from a prior iteration.
962979

963-
.. seealso:: :ref:`perf-process-iter`
980+
.. seealso::
981+
- :ref:`perf-process-iter`
964982

965983
.. versionchanged:: 6.0.0
966984

@@ -982,7 +1000,8 @@ Functions
9821000
Check whether the given PID exists in the current process list. This is
9831001
faster than doing ``pid in psutil.pids()``, and should be preferred.
9841002

985-
.. seealso:: :ref:`faq_pid_exists_vs_isrunning`
1003+
.. seealso::
1004+
- :ref:`faq_pid_exists_vs_isrunning`
9861005

9871006
.. function:: wait_procs(procs, timeout=None, callback=None)
9881007

@@ -1032,7 +1051,8 @@ Exceptions
10321051
attribute is set only if :meth:`Process.name` was called before the process
10331052
disappeared.
10341053

1035-
.. seealso:: :ref:`faq_no_such_process`
1054+
.. seealso::
1055+
- :ref:`faq_no_such_process`
10361056

10371057
.. exception:: ZombieProcess(pid, name=None, ppid=None, msg=None)
10381058

@@ -1044,15 +1064,17 @@ Exceptions
10441064
If you do not need to detect zombies, you can ignore this exception and just
10451065
catch :exc:`NoSuchProcess`.
10461066

1047-
.. seealso:: :ref:`faq_zombie_process`
1067+
.. seealso::
1068+
- :ref:`faq_zombie_process`
10481069

10491070
.. exception:: AccessDenied(pid=None, name=None, msg=None)
10501071

10511072
Raised by :class:`Process` methods when an action is denied due to
10521073
insufficient privileges. *name* is set if :meth:`Process.name` was called
10531074
before the exception was raised.
10541075

1055-
.. seealso:: :ref:`faq_access_denied`
1076+
.. seealso::
1077+
- :ref:`faq_access_denied`
10561078

10571079
.. exception:: TimeoutExpired(seconds, pid=None, name=None, msg=None)
10581080

@@ -1127,7 +1149,8 @@ Process class
11271149
``p.name()`` instead of ``p.info['name']``) or :func:`process_iter` +
11281150
:meth:`Process.as_dict` if you need a dict structure.
11291151

1130-
.. seealso:: :ref:`migration guide <migration-8.0>`.
1152+
.. seealso::
1153+
- :ref:`migration guide <migration-8.0>`
11311154

11321155
.. deprecated:: 8.0.0
11331156

@@ -1165,7 +1188,8 @@ Process class
11651188
The process name. On Windows the return value is cached after first call.
11661189
Not on POSIX because the process name may change.
11671190

1168-
.. seealso:: how to :ref:`find a process by name <recipe_find_process_by_name>`.
1191+
.. seealso::
1192+
- :ref:`Find process by name recipe <recipe_find_process_by_name>`
11691193

11701194
.. method:: exe()
11711195

@@ -1407,7 +1431,8 @@ Process class
14071431
>>> p.rlimit(psutil.RLIMIT_FSIZE) # get current limits of ...
14081432
(1024, 1024)
14091433
1410-
.. seealso:: :src:`scripts/procinfo.py`.
1434+
.. seealso::
1435+
- :src:`scripts/procinfo.py`
14111436

14121437
.. availability:: Linux, FreeBSD
14131438

@@ -1585,7 +1610,8 @@ Process class
15851610
``psutil.cpu_percent(percpu=True)`` to observe the system workload
15861611
distributed across multiple CPUs.
15871612

1588-
.. seealso:: :src:`scripts/cpu_distribution.py`.
1613+
.. seealso::
1614+
- :src:`scripts/cpu_distribution.py`
15891615

15901616
.. availability:: Linux, FreeBSD, SunOS
15911617

@@ -1787,7 +1813,7 @@ Process class
17871813
pfootprint(uss=6545408, pss=6872064, swap=0, shared=4341760)
17881814
17891815
.. seealso::
1790-
- :src:`scripts/procsmem.py`.
1816+
- :src:`scripts/procsmem.py`
17911817
- :ref:`faq_memory_footprint`
17921818
- :doc:`/blog/2016/real-process-memory-in-python`
17931819

@@ -1891,7 +1917,8 @@ Process class
18911917
pmmap_grouped(path='/lib/x8664-linux-gnu/libc-2.15.so', rss=3821568, size=3842048, pss=3821568, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=3821568, referenced=3575808, anonymous=3821568, swap=0),
18921918
...]
18931919
1894-
.. seealso:: :src:`scripts/pmap.py`.
1920+
.. seealso::
1921+
- :src:`scripts/pmap.py`
18951922

18961923
.. availability:: Linux, Windows, FreeBSD, SunOS
18971924

@@ -1926,7 +1953,8 @@ Process class
19261953
is well illustrated by this
19271954
`unit test <https://github.com/giampaolo/psutil/blob/65a52341b55faaab41f68ebc4ed31f18f0929754/psutil/tests/test_process.py#L1064-L1075>`_.
19281955

1929-
.. seealso:: how to :ref:`kill a process tree <recipe_kill_proc_tree>`.
1956+
.. seealso::
1957+
- :ref:`Kill process tree recipe <recipe_kill_proc_tree>`
19301958

19311959
.. method:: page_faults()
19321960

@@ -2030,7 +2058,8 @@ Process class
20302058
``CTRL_BREAK_EVENT`` signals are supported, and ``SIGTERM`` is treated as
20312059
an alias for :meth:`kill`.
20322060

2033-
.. seealso:: how to :ref:`kill a process tree <recipe_kill_proc_tree>`
2061+
.. seealso::
2062+
- :ref:`Kill process tree recipe <recipe_kill_proc_tree>`
20342063

20352064
.. method:: suspend()
20362065

@@ -2053,7 +2082,8 @@ Process class
20532082
``os.kill(pid, signal.SIGTERM)``. On Windows this is an alias for
20542083
:meth:`kill`.
20552084

2056-
.. seealso:: how to :ref:`kill a process tree <recipe_kill_proc_tree>`.
2085+
.. seealso::
2086+
- :ref:`Kill process tree recipe <recipe_kill_proc_tree>`
20572087

20582088
.. method:: kill()
20592089

@@ -2062,7 +2092,8 @@ Process class
20622092
``os.kill(pid, signal.SIGKILL)``. On Windows this is done by using
20632093
`TerminateProcess`_.
20642094

2065-
.. seealso:: how to :ref:`kill a process tree <recipe_kill_proc_tree>`.
2095+
.. seealso::
2096+
- :ref:`Kill process tree recipe <recipe_kill_proc_tree>`
20662097

20672098
.. method:: wait(timeout=None)
20682099

@@ -2094,7 +2125,8 @@ Process class
20942125
>>> p.wait()
20952126
<NegSignal.SIGTERM: -15>
20962127
2097-
.. seealso:: :doc:`/blog/2026/event-driven-process-waiting`
2128+
.. seealso::
2129+
- :doc:`/blog/2026/event-driven-process-waiting`
20982130

20992131
.. note::
21002132

@@ -2182,7 +2214,7 @@ that Python's memory tracking misses.
21822214

21832215
.. seealso::
21842216

2185-
:doc:`/blog/2025/heap-introspection-apis`
2217+
- :doc:`/blog/2025/heap-introspection-apis`
21862218

21872219
.. tip::
21882220

0 commit comments

Comments
 (0)