unsloth/studio/backend/utils/paths
Daniel Han 78a3587427
Keep path_utils off PEP 604, which the 3.9 floor gate rejects (#9335)
* Keep path_utils off PEP 604, which the 3.9 floor gate rejects

`Core` has been failing on main at 'python floor compatibility (HARD GATE)',
all three HF/TRL cells:

  36 studio files now evaluate PEP 604 unions on the floor, up from 35

The 36th is studio/backend/utils/paths/path_utils.py, from #8919. That change is
right; it just added

  subject_key: Callable[[str], object] | None = None

to a module with no `from __future__ import annotations`, so the annotation is
evaluated at import and `X | None` is a TypeError on the declared 3.9 floor.

Uses Optional[...], which the module already imports, rather than adding the
future import. Five other modules import this one, and deferring every
annotation in it is a wider change than the one union needs -- the ratchet's own
docstring warns that converting a file wants Studio booted, because FastAPI
resolves annotations when it builds endpoints.

Verified on main: offenders back to 35 against a debt of 35, the whole
test_python39_compatibility.py suite passes (8), and the AppleDouble guards the
original change added still pass (9).

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-19 20:58:36 -07:00
..
__init__.py Studio: never pick a macOS AppleDouble sidecar as a GGUF (#8919) 2026-08-19 15:51:16 -03:00
external_media.py Studio: add configurable model download location (#7274) 2026-07-23 01:34:38 -07:00
path_utils.py Keep path_utils off PEP 604, which the 3.9 floor gate rejects (#9335) 2026-08-19 20:58:36 -07:00
scan_folder_health.py Studio: say when a scan folder cannot be read instead of showing no models (#9053) 2026-08-19 06:10:58 -07:00
sensitive.py Fix Studio custom folders on Linux external drives (#6799) 2026-07-03 19:10:04 +01:00
storage_roots.py Studio: never pick a macOS AppleDouble sidecar as a GGUF (#8919) 2026-08-19 15:51:16 -03:00