app-runtime
This project provides cross-platform tools for handling the context of a Python application, including getting system, user and application info.
Example
from runtime.application import (
get_main_module_name, get_application_path, hook_terminate,
is_interactive, is_python_shell, single_instance,
SingleInstanceException, TerminateException
)
from runtime.user import get_username, is_elevated
hook_terminate()
username = get_username()
module = get_main_module_name()
app_path = get_application_path()
interactive = is_interactive()
is_shell = is_python_shell()
def output(line: str):
if interactive:
print(line)
try:
with single_instance():
try:
output(f"Hello {'admin ' if is_elevated() else ''}{username}, this is {module} located in {app_path}")
output(f"I can tell that you're{' not' if not is_shell else ''} running this script in a python shell")
except TerminateException:
output(f"Bye {username}")
except:
output("An unexpected error ocurred")
except SingleInstanceException:
output("Another instance of this application is already running!")
Full documentation
Metadata
Release files for app-runtime 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| app_runtime-0.0.1.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| app_runtime-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.8 kB
Release files / app_runtime-0.0.1.tar.gz
| Download URL | app_runtime-0.0.1.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92911268e6e07573f90b2b7f42285356404033d659aa156292eb79f40f76a135
|
|
BLAKE2b-256 checksum How to use checksums |
6741349b7cc3ac32edea72733def7d980a2ed8f6f48f947d3216e704b1596123
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2025.
Transparency logRelease files / app_runtime-0.0.1-py3-none-any.whl
| Download URL | app_runtime-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2a49500d72ac89d6bbe257b20c705b01da8c7bd960e4ae6d23eeb6e943c38db
|
|
BLAKE2b-256 checksum How to use checksums |
d2e828a8aa40c0c49bf55c88c2fcded2f0e1502350cba85f2c06f044365b7b22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2025.
Transparency log