-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: provide APIs to deal with Windows services #795
Comments
Implemented and merged as of #803. |
This is great, thanks -- would you consider adding those methods? psutil has such a clean interface, it would be nice to use it for manipulating services too. |
Here's the reasons why I didn't expose those methods back then: Lines 424 to 440 in 229fcd9
|
Ok 👍 |
Rationale
People who want to deal with Windows services in Python are forced to rely either on pywin32 or WMI extensions but they're too low level (pywin32) and a bit confusing IMO. Some examples:
It would be nice if psutil could provide a compact API to deal with Windows services more easily.
API
I'm still not sure how to organize the API (classes? functions? namedtuple? etc.) yet, but roughly the underlying C extension module should expose these APIs:
list()
create(name, exe_path, start_type='auto', description=None, ...)
remove(name)
modify(name, description=None, start_type=None, ...)
start(name)
stop(name)
restart(name)
psutil might wrap them by providing 3 higher-level functions + one class:
win_service_list()
-> return a list orWindowsService
classeswin_service_install(name, exe_path, start_type='auto', description=None, ...)
win_service_get(name)
-> return aWindowsService
instance with the following attrs/methods:name
description
start_type
status
start()
stop()
restart()
modify()
remove()
I think it's a good idea to stay as minimal as possible, meaning we should not provide all the features offered by pywin32. Instead we should cover the most common use cases only, which are list/create/modify/remove and start/stop/restart.
References
The text was updated successfully, but these errors were encountered: