Skip to content

Commit 2ef6512

Browse files
authored
Update doc pages appearance & README (#193)
Update docs ----------- * Start using new theme: sphinx-book-theme * customize the theme * Make the Quickstart page to be the docs landing page (this is a bit of a hack but anyway) * Flatten the docs structure Update readme ------------- * jeepney is still a required dependency
1 parent 96cfa23 commit 2ef6512

18 files changed

+169
-138
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
# ⏰😴 wakepy
55

6-
Cross-platform wakelock written in Python.
7-
- It has zero required python dependencies.
8-
- Python API for application and library developers, and a wakepy executable (CLI) for everyone.
9-
6+
Cross-platform wakelock / keep-awake / stay-awake written in Python.
107

118
## Supports
129
- Python: 3.7 to 3.12
@@ -15,7 +12,7 @@
1512
## What it can do?
1613

1714
Wakepy has two main modes:
18-
1. **`keep.running`**: keep your tasks & CPU running even if you lock your session and turn screenlock on; This mode prevents your system from going to sleep (*e.g.* for training machine learning models, video encoding, web scraping, ...)
15+
1. **`keep.running`**: keep your tasks & CPU running even if you lock your session and turn screenlock on; This mode prevents your system from going to sleep automatically (*e.g.* for training machine learning models, video encoding, web scraping, ...)
1916
2. **`keep.presenting`**: same as `keep.running` but keep also the screen awake and prevent automatic screen lock & screensaver (*e.g.* for showing a video, updating dashboard, monitoring apps, ...)
2017
<!-- end before docs link -->
2118

@@ -32,11 +29,12 @@ Wakepy has two main modes:
3229
### 👉 **[wakepy.readthedocs.io](http://wakepy.readthedocs.io)**
3330
<!-- start after docs link -->
3431
## ⚖️👑 Key selling points
35-
- Wakepy supports multiple operating systems and desktop environments
36-
- Wakepy has permissive MIT licence
37-
- It has a simple command line interface and a python API
38-
- Wakepy has zero required python dependencies
39-
- For using the D-Bus methods on Linux, one may use [jeepney](https://jeepney.readthedocs.io/) (optional)
32+
- Supports multiple operating systems and desktop environments
33+
- Simple command line interface and a python API
34+
- Permissive MIT licence
35+
- Low amount of python dependencies
36+
- For using the D-Bus methods on Linux: [jeepney](https://jeepney.readthedocs.io/)
37+
- Otherwise: None
4038

4139

4240
## Deprecation timeline (wakepy 0.7.0+)

docs/source/_templates/author.html

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{#
2+
Most of the contents of this file are copied from the sphinx-book-theme
3+
theme/sphinx_book_theme/components/sbt-sidebar-nav.html
4+
#}
5+
<nav class="bd-links bd-docs-nav" aria-label="Main">
6+
{# Custom addition: Add "User Guide:" title.
7+
This is not possible to add otherwise, as the list comes from
8+
generate_toctree_html (if not modifying generate_toctree_html)#}
9+
<p aria-level="2" class="caption" role="heading"><span class="caption-text">User Guide:</span></p>
10+
<div class="bd-toc-item navbar-nav active">
11+
{% if theme_home_page_in_toc == True %}
12+
{#- This mimics the pydata theme list style so we can append an extra item at the top #}
13+
<ul class="nav bd-sidenav bd-sidenav__home-link">
14+
<li class="toctree-l1{% if pagename == root_doc %} current active{% endif %}">
15+
<a class="reference internal" href="{{ pathto(root_doc) }}">
16+
{{ root_title }}
17+
</a>
18+
</li>
19+
</ul>
20+
{% endif -%}
21+
{# Ref:
22+
https://github.com/pydata/pydata-sphinx-theme/blob/ebf7f704879a1cdc6016d6111062103353ac7677/src/pydata_sphinx_theme/__init__.py#L302
23+
#}
24+
{{- generate_toctree_html(
25+
startdepth=0,
26+
kind="sidebar",
27+
maxdepth=theme_max_navbar_depth|int,
28+
collapse=theme_collapse_navbar|tobool,
29+
includehidden=True,
30+
titles_only=True,
31+
show_nav_level=theme_show_navbar_depth|int) }}
32+
</div>
33+
</nav>

docs/source/cli-api.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# CLI API
22

33
It is possibe to start wakepy from the command line either by running
4-
```
4+
5+
```{code-block} text
56
wakepy
67
```
8+
79
or
8-
```
10+
11+
```{code-block} text
912
python -m wakepy
1013
```
1114

1215
This starts wakepy in the *default mode* (`-k`), which corresponds to a call to `keep.running` with default arguments. The available options are:
1316

14-
```
17+
```{code-block} output
1518
wakepy [-h] [-k] [-p]
1619
1720
options:

docs/source/conf.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from wakepy import __version__
1010

1111
project = "wakepy"
12-
copyright = "2023, Niko Föhr"
12+
copyright = "2023–2024, Niko Föhr"
1313
author = "Niko Föhr"
1414

1515
# The full version, including alpha/beta/rc tags
@@ -82,19 +82,16 @@
8282
# The theme to use for HTML and HTML Help pages. See the documentation for
8383
# a list of builtin themes.
8484
#
85-
html_theme = "furo"
86-
85+
html_theme = "sphinx_book_theme"
86+
html_title = f"wakepy {__version__}"
8787
html_theme_options = {
88-
"footer_icons": [
89-
{
90-
"name": "GitHub",
91-
"url": "https://github.com/fohrloop/wakepy",
92-
"html": """
93-
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
94-
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path>
95-
</svg>
96-
""", # noqa E501
97-
"class": "",
98-
},
99-
],
88+
"repository_url": "https://github.com/fohrloop/wakepy",
89+
"use_repository_button": True,
90+
"use_download_button": False,
91+
"use_fullscreen_button": False,
92+
# Shows the landing page in the sidebar
93+
# See: https://sphinx-book-theme.readthedocs.io/en/stable/sections/sidebar-primary.html#add-the-home-page-to-your-table-of-contents
94+
"home_page_in_toc": True,
95+
"pygment_light_style": "friendly",
96+
"pygment_dark_style": "lightbulb",
10097
}

docs/source/index.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,114 @@
1-
```{include} ../../README.md
2-
:start-after: <!-- start before docs link -->
3-
:end-before: <!-- end before docs link -->
1+
# Quickstart
2+
3+
4+
## Requirements
5+
6+
Wakepy supports Windows, MacOS and Linux flavours which Desktop Environment that implements the `org.freedesktop.ScreenSaver` interface[^linux-support].
7+
8+
[^linux-support]: The Linux support is under active development. Target is to support at least GNOME, KDE, Xfce, Cinnamon, LXQt and MATE Desktop Environments.
9+
## Installing
10+
11+
To install wakepy from PyPI, run
12+
13+
```{code-block} text
14+
pip install wakepy
15+
```
16+
17+
```{note}
18+
On Linux will install also **[`jeepney`](https://jeepney.readthedocs.io/)** for DBus communication (if not installed). On other systems there are no python requirements.
19+
```
20+
21+
## Basic Usage
22+
23+
If you want to keep a long task running, but do not want to prevent screen from locking and/or blanking, you can use `keep.running` context manager. If you also want to prevent screen lock and screen blank, use `keep.presenting`:
24+
25+
26+
::::{tab-set}
27+
28+
:::{tab-item} No screen required
29+
30+
```{code-block} python
31+
from wakepy import keep
32+
33+
with keep.running():
34+
# Do something that takes a long time
35+
```
36+
37+
:::
38+
39+
:::{tab-item} Screen required
40+
41+
```{code-block} python
42+
from wakepy import keep
43+
44+
with keep.presenting():
45+
# Do something that takes a long time
446
```
5-
```{include} ../../README.md
6-
:start-after: <!-- start after docs link -->
7-
:end-before: <!-- end after docs link -->
47+
48+
:::
49+
50+
::::
51+
52+
53+
### Mode quick reference
54+
55+
56+
57+
| Wakepy mode | keep.running | keep.presenting |
58+
| ------------------------ | ------------ | --------------- |
59+
| Sleep is prevented | Yes | Yes |
60+
| Screenlock is prevented | No* | Yes |
61+
| Screensaver is prevented | No* | Yes |
62+
63+
64+
65+
```{note}
66+
The table above only considers the *automatic* actions (go to sleep, start screenlock, start screensaver), which are based on the *idle timer*; It is still possible to put system to sleep by selecting Suspend/Sleep from a menu, closing the laptop lid or pressing a power key, for example. It is also possible to manually lock the session/screen or start screensaver.
867
```
968

69+
70+
1071
## Links
1172
- GitHub: [github.com/fohrloop/wakepy](https://github.com/fohrloop/wakepy)
1273
- PyPI: [pypi.org/project/wakepy](https://pypi.org/project/wakepy/)
1374

14-
## Documentation TOC
1575
```{toctree}
16-
:caption: 'Contents:'
76+
:hidden:
1777
:maxdepth: 2
1878
:numbered: -1
1979
:titlesonly:
2080
21-
user-guide/index
81+
quickstart
82+
modes
2283
methods-reference
23-
technical-details/index
84+
2485
cli-api
2586
```
2687

2788
```{toctree}
89+
:hidden:
90+
:caption: 'Advanced Usage:'
91+
:maxdepth: 2
92+
:numbered: -1
93+
:titlesonly:
94+
95+
tests-and-ci
96+
```
97+
98+
99+
```{toctree}
100+
:hidden:
101+
:caption: 'Technical Details:'
102+
:maxdepth: 2
103+
:numbered: -1
104+
:titlesonly:
105+
106+
wakepy-mode-lifecycle
107+
test-manually
108+
```
109+
110+
```{toctree}
111+
:hidden:
28112
:caption: 'Development:'
29113
:maxdepth: 2
30114
:numbered: -1

0 commit comments

Comments
 (0)