{"id":25411714,"url":"https://github.com/koho/winsvc","last_synced_at":"2025-06-15T02:32:54.210Z","repository":{"id":62589184,"uuid":"314594146","full_name":"koho/winsvc","owner":"koho","description":"A Windows Service Creator API.","archived":false,"fork":false,"pushed_at":"2020-11-23T07:19:48.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T10:54:00.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-20T15:31:28.000Z","updated_at":"2020-12-01T03:08:56.000Z","dependencies_parsed_at":"2022-11-03T17:54:50.461Z","dependency_job_id":null,"html_url":"https://github.com/koho/winsvc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/koho/winsvc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koho%2Fwinsvc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koho%2Fwinsvc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koho%2Fwinsvc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koho%2Fwinsvc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koho","download_url":"https://codeload.github.com/koho/winsvc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koho%2Fwinsvc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259912507,"owners_count":22931075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-16T10:19:20.299Z","updated_at":"2025-06-15T02:32:54.190Z","avatar_url":"https://github.com/koho.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# winsvc\n\nA Windows Service Creator API.\n\n## Install\n```\npip install winsvc\n```\n\n## Example\n```python\n# test_svc.py\nimport os\nimport sys\nimport time\nimport click\nimport pathlib\nfrom winsvc.cmd import add_svc_command\nfrom winsvc.svc import Service\n\n\nclass TestService(Service):\n    _svc_name_ = 'winsvc'\n    _svc_display_name_ = \"WIN SVC\"\n    _svc_description_ = 'A Windows Service Creator'\n    _exe_name_ = sys.executable\n\n    def __init__(self, path):\n        self.running = True\n        self.path = path\n        self._exe_args_ = f'{os.path.abspath(__file__)} {path}'\n\n    def start(self):\n        while self.running:\n            pathlib.Path(self.path).touch()\n            time.sleep(5)\n\n    def stop(self):\n        self.running = False\n\n\n@add_svc_command()\n@click.group(invoke_without_command=True)\n@click.argument(\"path\", type=click.Path())\n@click.pass_context\ndef main(ctx, path):\n    s = TestService(path)\n    if ctx.invoked_subcommand is None:\n        # Run in command line\n        s.start()\n    else:\n        # Run in Windows service\n        ctx.obj = s\n\n\nif __name__ == '__main__':\n    main()\n```\n\n**Run in command line:**\n```\npython test_svc.py test.txt\n```\n\n**Run in service:**\n```\npython test_svc.py test.txt svc -d . install\npython test_svc.py test.txt svc -d . start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoho%2Fwinsvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoho%2Fwinsvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoho%2Fwinsvc/lists"}