Python 3.12+osfunction
os.path.isdevdrive
os.path — existence and type checks
Check whether a path is on a Dev Drive (a Windows feature; False elsewhere; 3.12+).
Syntax
os.path.isdevdrive(path)
A Dev Drive is a Windows volume tuned for source code, builds and package caches. The function serves tools deciding where to keep caches or temporary files. It arrived in Python 3.12 for Windows only; since 3.13 it is available everywhere and always returns False on systems without Dev Drives. It may raise for a path with no recognisable drive.
Examples
# Python 3.13+ (на Windows — 3.12+)
import os
print(os.path.isdevdrive('.')) # → False
print(os.path.isdevdrive('нет-такого-пути')) # → False (существование пути не проверяется, исключения нет)
build_dir = os.path.join(os.getcwd(), 'build')
print('быстрый Dev Drive' if os.path.isdevdrive(build_dir) else 'обычный диск') # → обычный диск (True бывает только на Windows-разделе Dev Drive)
print(os.path.isdevdrive('/')) # → False (на Linux/macOS функция возвращает False для любого пути)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy