shopen
shopen is a proper implementation of os.startfile to launch a target file/URL. Use it to launch the preferred system viewer for the user to view or edit a target file or URL.
"shopen" is short for shutil.open, the proposed builtin it's intended to be a reference implementation for.
Usage
Simply install as a dependency of your project and then use it to launch an opener for a file or URL:
import pathlib, shopen
shopen.open("https://zombo.com/") # Opens web browser
shopen.open(pathlib.Path("~/somefile.txt").expanduser()) # Opens file viewer
shopen.open(pathlib.Path("./somefile.toml"), "edit") # Opens editor
Why?
Python's standard library provides nice cross-platform utilites for lots of different purposes, but so far no simple file/URL opener that would work on all platforms.
On Windows there's os.startfile, but strangely that doesn't support any other platform.
The proposal python/cpython#47427 to implement it
as shutil.open was rejected for now. Python users keep asking
for a decent way to do it, but the only answer had been brittle copypasta… until now!
Ideally this can be added into stdlib after proving its usefulness and then only be needed as a polyfill for older versions of python.
Metadata
Release files for shopen 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shopen-0.2.2.tar.gz | 5.3 kB | Without provenance | Details for shopen-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shopen-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for shopen-0.2.2-py3-none-any.whl |
Total release size: 9.6 kB
Release files / shopen-0.2.2.tar.gz
| Download URL | shopen-0.2.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e702c57616768856a86cf39cb780470196b6d96a20caa2b2703ae0334235edd
|
|
BLAKE2b-256 checksum How to use checksums |
3d6e3bd9e1d801fce365962f3c9c71eed6154d9d97c7f73946cbce4371d2faff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / shopen-0.2.2-py3-none-any.whl
| Download URL | shopen-0.2.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d584291c76e64bda7f04ea168afb3314c2bfe194b5098f863d735753550ab373
|
|
BLAKE2b-256 checksum How to use checksums |
01fd634b8d5a76af735988e28462d71056abb3e5087233b1166b453f2b522d81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for shopen 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.