{"id":23006360,"url":"https://github.com/syntapy/singleton","last_synced_at":"2025-07-20T16:35:21.949Z","repository":{"id":46871352,"uuid":"395356158","full_name":"syntapy/singleton","owner":"syntapy","description":"Simple python singleton metaclass","archived":false,"fork":false,"pushed_at":"2021-09-24T05:12:50.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-08T06:14:03.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntapy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-12T15:01:35.000Z","updated_at":"2021-09-24T05:12:53.000Z","dependencies_parsed_at":"2022-07-22T21:02:22.111Z","dependency_job_id":null,"html_url":"https://github.com/syntapy/singleton","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntapy%2Fsingleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntapy%2Fsingleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntapy%2Fsingleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntapy%2Fsingleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntapy","download_url":"https://codeload.github.com/syntapy/singleton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246837685,"owners_count":20841903,"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":"2024-12-15T08:12:19.322Z","updated_at":"2025-04-02T15:13:24.603Z","avatar_url":"https://github.com/syntapy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Makes any python class a singleton by calling\n\n```python\nfrom singleton import Singleton\n\nclass MyClass(metaclass=Singleton, Baseclasses...):\n   pass\n```\n\nThis is method 2 taken from [here](https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python) but adapted to support separate instances for different constructor arguments\n\nToDo\n----\nApproaches to offer\n- metaclass\n- class decorator\n- base class\n\nRequirements are\n- [ ] Singleton for each class for each combo of arguments\n  - i.e. can have multiple instances of same class if they have different constructor arguments\n  - [x] metaclass\n  - [ ] class decorator\n  - [ ] base class\n- [ ] A separate object contains all instances of each class\n  - Do not e.g. have a single dict containing every instances of the singleton (that is just bloated, and any bugs could leak out to other different classes\n  - [ ] metaclass (probably not possible)\n  - [ ] class decorator\n  - [ ] base class\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntapy%2Fsingleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntapy%2Fsingleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntapy%2Fsingleton/lists"}