Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Documentation = "https://nspc911.github.io/rovr"
[project.scripts]
rovr = "rovr:main"

[project.optional-dependencies]
libuv = [
"uvloop>=0.22.1; sys_platform != 'win32'",
"winloop>=0.5.0; sys_platform == 'win32'",
]

[dependency-groups]
build = [
"zstandard>=0.25.0",
Expand Down
23 changes: 18 additions & 5 deletions src/rovr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,10 @@ def cli(
if dev or is_dev:
os.environ["TEXTUAL"] = "devtools,debug"
is_dev = True
pprint(" [bold bright_cyan]Development mode activated![/]")
pprint(
" [dim]Make sure to have [grey50]`textual console`[/] (or [grey50]`uvx --from textual-dev textual console`[/]) running![/]"
)
pprint(
" [dim] - Keep in mind that the console needs to be running [i]before[/] you start the app![/]"
" [bold bright_cyan]Development mode activated![/]\n",
" [dim]Make sure to have [/]textual console[dim] (or [/]uvx --from textual-dev textual console[dim]) running![/]\n",
" [dim] - Keep in mind that the console needs to be running [i]before[/] you start the app![/]",
)

if list_preview_themes:
Expand Down Expand Up @@ -387,6 +385,21 @@ def _get_version() -> list[str]:
if force_first_launch:
return

try:
import asyncio

if sys.platform == "win32":
import winloop as libuv # ty: ignore[unresolved-import]
else:
import uvloop as libuv # ty: ignore[unresolved-import]
asyncio.set_event_loop_policy(libuv.EventLoopPolicy())
if is_dev:
pprint(
f" [dim]Using [/]{'winloop' if sys.platform == 'win32' else 'uvloop'}[dim], performance may or may not be improved - do your own tests.[/]"
)
except ImportError:
pass

# start separate thread for platform to cache
platproc = Process(target=platform.system)
platproc.start()
Expand Down
17 changes: 15 additions & 2 deletions src/rovr/variables/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import platform
import sys
from dataclasses import dataclass
from datetime import datetime
from os import environ
Expand Down Expand Up @@ -144,4 +144,17 @@ def width(self) -> Literal[26, 70]:
]
)

os_type = platform.system()
match sys.platform:
case "win32":
os_type = "Windows"
case "darwin":
os_type = "Darwin"
case linux if linux.startswith("linux"):
os_type = "Linux"
case "android":
os_type = "Linux"
case _:
import platform

# sure okay, fuck you in particular freebsd user
os_type = platform.system()
43 changes: 43 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.