Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot]a4296af1806f
diff --git a/studio/backend/run.py b/studio/backend/run.pyindex 460dc8ccb83..3a9712670fc 100644--- a/studio/backend/run.py+++ b/studio/backend/run.py@@ -2189,9 +2189,7 @@ def _terminal_password_gate(# now would move first seeding earlier, open the SQLite file sooner and give a# read-only or locked home a new place to fail, none of which a container# operator asked for. Tunnel launches are unaffected: they always came here.- if not tunnel_will_start and not (- _stream_isatty(sys.stdin) and _stream_isatty(sys.stderr)- ):+ if not tunnel_will_start and not (_stream_isatty(sys.stdin) and _stream_isatty(sys.stderr)):return True, Falsefrom auth import hashing as _auth_hashingdiff --git a/studio/backend/tests/test_password_prompt_backstop.py b/studio/backend/tests/test_password_prompt_backstop.pyindex 459556b4bb7..2265c6f5e56 100644--- a/studio/backend/tests/test_password_prompt_backstop.py+++ b/studio/backend/tests/test_password_prompt_backstop.py@@ -438,7 +438,7 @@ def test_a_headless_raw_bind_is_byte_for_byte_unchanged(monkeypatch):def test_a_headless_raw_bind_does_not_open_auth_storage(monkeypatch):- """"Unchanged" has to mean it does not touch the database either.+ """ "Unchanged" has to mean it does not touch the database either.Before this gate learned about non-tunnel exposure, a headless raw bindreturned at `if not tunnel_will_start` without importing auth storage. If it@@ -456,12 +456,11 @@ def test_a_headless_raw_bind_does_not_open_auth_storage(monkeypatch):)from auth import storage as _storage+monkeypatch.setattr(_storage, "ensure_default_admin", _boom)monkeypatch.setattr(_storage, "requires_password_change", _boom)- assert run._terminal_password_gate(- tunnel_will_start = False, **_RAW_BIND_KWARGS- ) == (True, False)+ assert run._terminal_password_gate(tunnel_will_start = False, **_RAW_BIND_KWARGS) == (True, False)def test_refusing_the_prompt_on_a_raw_bind_still_launches(monkeypatch):@@ -477,16 +476,16 @@ def test_refusing_the_prompt_on_a_raw_bind_still_launches(monkeypatch):_patch_seeded_admin(monkeypatch, requires_change = True)from auth import terminal_prompt+monkeypatch.setattr(- terminal_prompt, "prompt_for_password_change",- lambda **_kw: False, # Ctrl+C / EOF+ terminal_prompt,+ "prompt_for_password_change",+ lambda **_kw: False, # Ctrl+C / EOF)# proceed = True, and the bootstrap credential keeps being injected exactly# as it was before this prompt existed.- assert run._terminal_password_gate(- tunnel_will_start = False, **_RAW_BIND_KWARGS- ) == (True, False)+ assert run._terminal_password_gate(tunnel_will_start = False, **_RAW_BIND_KWARGS) == (True, False)def test_refusing_the_prompt_on_a_tunnel_still_aborts(monkeypatch):@@ -495,13 +494,10 @@ def test_refusing_the_prompt_on_a_tunnel_still_aborts(monkeypatch):_patch_seeded_admin(monkeypatch, requires_change = True)from auth import terminal_prompt- monkeypatch.setattr(- terminal_prompt, "prompt_for_password_change", lambda **_kw: False- )- assert run._terminal_password_gate(- tunnel_will_start = True, **_GATE_KWARGS- ) == (False, False)+ monkeypatch.setattr(terminal_prompt, "prompt_for_password_change", lambda **_kw: False)++ assert run._terminal_password_gate(tunnel_will_start = True, **_GATE_KWARGS) == (False, False)def test_a_raw_bind_with_a_terminal_reaches_the_prompt(monkeypatch):diff --git a/studio/backend/tests/test_wildcard_prompt_compatibility.py b/studio/backend/tests/test_wildcard_prompt_compatibility.pyindex e878a516305..9ce0cd3cb7a 100644--- a/studio/backend/tests/test_wildcard_prompt_compatibility.py+++ b/studio/backend/tests/test_wildcard_prompt_compatibility.py@@ -54,8 +54,12 @@ def test_the_windows_getch_path_decodes_a_password(monkeypatch):class _Out:encoding = "utf-8"- def write(self, s): out.append(s)- def flush(self): pass++ def write(self, s):+ out.append(s)++ def flush(self):+ passassert terminal_prompt._read_password("pw: ", out = _Out()) == "pw1"# The arrow key is swallowed, not masked, so exactly one star per character.@@ -63,8 +67,11 @@ def test_the_windows_getch_path_decodes_a_password(monkeypatch):class _NullCtx:- def __enter__(self): return self- def __exit__(self, *exc): return False+ def __enter__(self):+ return self++ def __exit__(self, *exc):+ return Falsedef test_a_stream_with_no_fileno_is_not_interactive():@@ -74,9 +81,13 @@ def test_a_stream_with_no_fileno_is_not_interactive():helpers treat a broken stream as non-interactive, so such a launch takes theheadless path rather than crashing."""+class _Broken:- def isatty(self): raise ValueError("I/O operation on closed file")- def fileno(self): raise OSError("no console")+ def isatty(self):+ raise ValueError("I/O operation on closed file")++ def fileno(self):+ raise OSError("no console")import run as run_mod@@ -87,10 +98,16 @@ def test_a_stream_with_no_fileno_is_not_interactive():@pytest.mark.parametrize("stdin_tty,stderr_tty", [(True, False), (False, True), (False, False)])def test_a_split_terminal_never_prompts(stdin_tty, stderr_tty):"""Masked echo needs stderr; reading needs stdin. Half a terminal is none."""- assert terminal_prompt.should_prompt_password_change(- tunnel_will_start = False, bind_is_exposed = True, requires_change = True,- stdin_isatty = stdin_tty, stderr_isatty = stderr_tty,- ) is False+ assert (+ terminal_prompt.should_prompt_password_change(+ tunnel_will_start = False,+ bind_is_exposed = True,+ requires_change = True,+ stdin_isatty = stdin_tty,+ stderr_isatty = stderr_tty,+ )+ is False+ )# ── old installs ─────────────────────────────────────────────────────@@ -102,14 +119,24 @@ def test_an_old_caller_that_omits_bind_is_exposed_behaves_as_before():A studio venv can hold an older backend than the CLI that launched it, so acaller predating this change must keep tunnel-only semantics."""- assert terminal_prompt.should_prompt_password_change(- tunnel_will_start = False, requires_change = True,- stdin_isatty = True, stderr_isatty = True,- ) is False- assert terminal_prompt.should_prompt_password_change(- tunnel_will_start = True, requires_change = True,- stdin_isatty = True, stderr_isatty = True,- ) is True+ assert (+ terminal_prompt.should_prompt_password_change(+ tunnel_will_start = False,+ requires_change = True,+ stdin_isatty = True,+ stderr_isatty = True,+ )+ is False+ )+ assert (+ terminal_prompt.should_prompt_password_change(+ tunnel_will_start = True,+ requires_change = True,+ stdin_isatty = True,+ stderr_isatty = True,+ )+ is True+ )def test_the_prompt_signature_stays_keyword_compatible():@@ -142,10 +169,13 @@ def test_the_password_gate_imports_no_gpu_or_torch_module():)out = subprocess.run([sys.executable, "-c", probe],- capture_output = True, text = True, timeout = 300,- cwd = str(_BACKEND), env = {**os.environ, "PYTHONPATH": str(_BACKEND)},+ capture_output = True,+ text = True,+ timeout = 300,+ cwd = str(_BACKEND),+ env = {**os.environ, "PYTHONPATH": str(_BACKEND)},)assert out.returncode == 0, out.stderr- assert out.stdout.strip() == "", (- f"the password gate pulled in hardware modules: {out.stdout.strip()}"- )+ assert (+ out.stdout.strip() == ""+ ), f"the password gate pulled in hardware modules: {out.stdout.strip()}"diff --git a/unsloth_cli/tests/test_studio_password_prompt.py b/unsloth_cli/tests/test_studio_password_prompt.pyindex 62d58182965..e6f562d6b63 100644--- a/unsloth_cli/tests/test_studio_password_prompt.py+++ b/unsloth_cli/tests/test_studio_password_prompt.py@@ -1774,13 +1774,25 @@ def test_studio_default_password_applies_on_headless_wildcard_no_tunnel(monkeypa_EXPOSURE_HOSTS = [# wildcard spellings- "0.0.0.0", "::", "::0", "0:0:0:0:0:0:0:0", "0", "::ffff:0.0.0.0",+ "0.0.0.0",+ "::",+ "::0",+ "0:0:0:0:0:0:0:0",+ "0",+ "::ffff:0.0.0.0",# loopback aliases- "127.0.0.1", "localhost", "::1",+ "127.0.0.1",+ "localhost",+ "::1",# concrete external addresses and names- "192.168.1.50", "10.0.0.5", "172.16.4.9", "example.com", "myhost.local",+ "192.168.1.50",+ "10.0.0.5",+ "172.16.4.9",+ "example.com",+ "myhost.local",# odd spellings- "[::]", "0.0.0.0.0",+ "[::]",+ "0.0.0.0.0",]