Skip to content

Commit 6f02a14

Browse files
chore(deps): update from template
1 parent 8d56b5d commit 6f02a14

9 files changed

Lines changed: 36 additions & 17 deletions

File tree

.copier-answers.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: v0.17.0
1+
_commit: v0.17.3
22
_src_path: gh:helmut-hoffer-von-ankershoffen/oe-python-template
33
attestations_enabled: true
44
author_email: helmuthva@gmail.com
@@ -28,3 +28,4 @@ streamlit_project_key: oe-python-template-example
2828
uptime_badge_snippet: '[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v1/monitor/1vzoq.svg)](https://helmut-hoffer-von-ankershoffen.betteruptime.com/)'
2929
vercel_badge_snippet: '[![Vercel Deploy](https://deploy-badge.vercel.app/vercel/oe-python-template-example?root=api%2Fv1%2Fhealthz)](https://oe-python-template-example.vercel.app/api/v1/hello/world)'
3030
vercel_function_enabled: true
31+

.vscode/settings.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@
3636
"**/dist_vercel/.vercel/**",
3737
],
3838
"python.analysis.ignore": [
39-
"**/typing.py"
39+
"dist/**",
40+
"dist_vercel/**",
41+
"template/**",
42+
"**/typing.py",
43+
"**/bottle.py",
44+
"**/bottle.py",
45+
"tests/**",
4046
],
4147
"python.testing.autoTestDiscoverOnSaveEnabled": true,
4248
"python.testing.unittestEnabled": false,
@@ -54,8 +60,8 @@
5460
},
5561
"github.copilot.advanced": {},
5662
"github.copilot.chat.editor.temporalContext.enabled": true,
57-
"github.copilot.chat.edits.codesearch.enabled": true,
5863
"github.copilot.chat.edits.temporalContext.enabled": true,
64+
"github.copilot.chat.codesearch.enabled": true,
5965
"github.copilot.chat.codeGeneration.instructions": [
6066
{
6167
"file": "CODE_STYLE.md"

ATTRIBUTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12189,7 +12189,7 @@ License: LGPL-2.1-or-later
1218912189

1219012190
```
1219112191

12192-
## oe-python-template-example (0.4.21) - MIT License
12192+
## oe-python-template-example (0.5.0) - MIT License
1219312193

1219412194
🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
1219512195

CLI_REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ oe-python-template-example [OPTIONS] COMMAND [ARGS]...
1414
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
1515
* `--help`: Show this message and exit.
1616

17-
🧠 OE Python Template Example v0.4.21 - built with love in Berlin 🐻
17+
🧠 OE Python Template Example v0.5.0 - built with love in Berlin 🐻
1818

1919
**Commands**:
2020

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ clean:
5555
rm -rf .pytest_cache
5656
rm -rf .ruff_cache
5757
rm -rf .venv
58-
rm -rf dist
58+
rm -rf dist && mkdir -p dist && touch dist/.keep
59+
rm -rf dist_vercel/wheels && mkdir -p dist_vercel/wheels && touch dist_vercel/wheels/.keep
5960
rm -rf .coverage
60-
make -C docs clean
6161
rm -rf reports && mkdir -p reports && touch reports/.keep
62+
uv run make -C docs clean
6263

6364
## Build Docker image
6465
docker_build:

src/oe_python_template_example/system/_gui.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@
77
class PageBuilder(BasePageBuilder):
88
@staticmethod
99
def register_pages() -> None:
10-
from nicegui import ui # noqa: PLC0415
10+
from nicegui import run, ui # noqa: PLC0415
1111

1212
@ui.page("/info")
13-
def page_info() -> None:
13+
async def page_info() -> None:
1414
"""Homepage of GUI."""
1515
ui.label(f"{__project_name__} v{__version__}").mark("LABEL_VERSION")
16-
ui.json_editor({
17-
"content": {"json": Service().info(True, True)},
16+
spinner = ui.spinner("dots", size="lg", color="red")
17+
properties = {
18+
"content": {"json": "Loading ..."},
1819
"readOnly": True,
19-
}).mark("JSON_EDITOR_INFO")
20+
}
21+
editor = ui.json_editor(properties).mark("JSON_EDITOR_INFO")
2022
ui.link("Home", "/").mark("LINK_HOME")
23+
info = await run.cpu_bound(Service().info, True, True)
24+
properties["content"] = {"json": info}
25+
editor.update()
26+
spinner.delete()

src/oe_python_template_example/system/_service.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131

3232
log = get_logger(__name__)
3333

34+
# Note: There is multiple measurements and network calls
35+
MEASURE_INTERVAL_SECONDS = 5
36+
NETWORK_TIMEOUT = 5
37+
3438

3539
class RuntimeDict(TypedDict, total=False):
3640
"""Type for runtime information dictionary."""
@@ -103,7 +107,7 @@ def is_token_valid(self, token: str) -> bool:
103107
return token == self._settings.token.get_secret_value()
104108

105109
@staticmethod
106-
def _get_public_ipv4(timeout: int = 5) -> str | None:
110+
def _get_public_ipv4(timeout: int = NETWORK_TIMEOUT) -> str | None:
107111
"""Get the public IPv4 address of the system.
108112
109113
Args:
@@ -157,8 +161,8 @@ def info(include_environ: bool = False, filter_secrets: bool = True) -> dict[str
157161
bootdatetime = boottime()
158162
vmem = psutil.virtual_memory()
159163
swap = psutil.swap_memory()
160-
cpu_percent = psutil.cpu_percent(interval=2)
161-
cpu_times_percent = psutil.cpu_times_percent(interval=2)
164+
cpu_percent = psutil.cpu_percent(interval=MEASURE_INTERVAL_SECONDS)
165+
cpu_times_percent = psutil.cpu_times_percent(interval=MEASURE_INTERVAL_SECONDS)
162166

163167
rtn: InfoDict = {
164168
"package": {

src/oe_python_template_example/utils/_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def add_drives_toggle(self) -> None:
163163
self.drives_toggle = ui.toggle(drives, value=drives[0], on_change=self.update_drive)
164164

165165
def update_drive(self) -> None:
166-
self.path = Path(self.drives_toggle.value).expanduser()
166+
self.path = Path(str(self.drives_toggle.value)).expanduser()
167167
self.update_grid()
168168

169169
def update_grid(self) -> None:

src/oe_python_template_example/utils/_process.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from pathlib import Path
44

5-
import psutil
65
from pydantic import BaseModel
76

87

@@ -28,6 +27,8 @@ def get_process_info() -> ProcessInfo:
2827
Returns:
2928
ProcessInfo: Object containing process information.
3029
"""
30+
import psutil # noqa: PLC0415
31+
3132
current_process = psutil.Process()
3233
parent = current_process.parent()
3334

0 commit comments

Comments
 (0)