universal-startfile
A cross-platform version of 'os.startfile' from the standard library.
What it is and what it does
universal-startfile is a thin cross-platform wrapper that mimics the behavior of Python's os.startfile function (which only works on Windows) on macOS and Linux. It lets you open a file or URL by invoking the operating system's default handler—the same action as double-clicking a file or clicking a link in a browser. The package has no runtime dependencies and installs as a pure Python wheel, making it lightweight and portable.
You import a single function, startfile, and pass it a file path or URL. The package handles the platform-specific logic internally, delegating to the appropriate system command (xdg-open on Linux, open on macOS, os.startfile on Windows). It's useful in desktop automation, file management utilities, or any script that needs to hand off a resource to the user's preferred application without knowing which one that is.
Use it for:
- Open a downloaded file in its default application from within a Python script or CLI tool.
- Launch a URL in the user's default browser without hardcoding browser names.
- Implement a cross-platform 'open with default app' feature in a desktop utility.
- Trigger file-manager or document-viewer actions from automation scripts on multiple OS platforms.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a cross-platform wrapper around os.startfile that opens files and URLs with their default system applications on Windows, macOS, and Linux.
Yes. The package solves a genuine cross-platform gap in the standard library with zero dependencies, active maintenance, and a permissive license. It is stable despite its Alpha classifier and has been in use since 2022. Install it if you need to open files or URLs with system defaults in a portable way.
Install
universal-startfile on PyPI
pip
pip install universal-startfileuv
uv add universal-startfilepoetry
poetry add universal-startfileInstalling universal-startfile
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits; marked Alpha but has been stable since first release in 2022.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install universal-startfile
from startfile import startfile
startfile("~/Downloads/example.png")
startfile("http://example.com")
Requires Python 3.9 or later.
Verify before relying
- Whether the package handles edge cases like non-existent files or malformed URLs gracefully.
- Performance characteristics when opening many files in rapid succession.
- Behavior on less common desktop environments (e.g., Wayland, headless systems).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 298 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 121,750/month — #11,972 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: universal_startfile-0.4-py3-none-any.whl
Keywords: files, startfile, utilities
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
clipboardProvides a simple interface to copy text to and…
permissive · top 15,000 on PyPI
Send2TrashSends files and directories to the platform's…
permissive · top 1,000 on PyPI
PyGetWindowPyGetWindow provides functions to query,…
permissive · top 5,000 on PyPI
pathtoolsProvides pattern matching and utility functions…
permissive · top 15,000 on PyPI
pyshortcutsCreates desktop and Start Menu shortcuts for…
permissive · top 15,000 on PyPI
pyperclipPyperclip provides simple cross-platform access…
permissive · top 1,000 on PyPI
notify_pySends cross-platform desktop notifications from…
permissive · top 15,000 on PyPI
hbreaderOpens and reads files, URLs, and text strings…
permissive · top 15,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
dmgbuilddmgbuild creates macOS disk images (.dmg files)…
permissive · top 15,000 on PyPI