{"id":18947818,"url":"https://github.com/refactoringguru/design-patterns-python","last_synced_at":"2025-05-16T13:06:05.108Z","repository":{"id":40770839,"uuid":"165861942","full_name":"RefactoringGuru/design-patterns-python","owner":"RefactoringGuru","description":"Design Pattern Examples in Python","archived":false,"fork":false,"pushed_at":"2024-04-13T11:39:11.000Z","size":216,"stargazers_count":830,"open_issues_count":4,"forks_count":199,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-03T08:12:07.659Z","etag":null,"topics":["design-patterns","python"],"latest_commit_sha":null,"homepage":"https://refactoring.guru/design-patterns/python","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RefactoringGuru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-15T14:08:25.000Z","updated_at":"2025-04-02T21:58:54.000Z","dependencies_parsed_at":"2023-02-10T04:31:01.297Z","dependency_job_id":"aed6bfa0-6bed-4e56-8c9e-97b0b030ec5e","html_url":"https://github.com/RefactoringGuru/design-patterns-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RefactoringGuru%2Fdesign-patterns-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RefactoringGuru%2Fdesign-patterns-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RefactoringGuru%2Fdesign-patterns-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RefactoringGuru%2Fdesign-patterns-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RefactoringGuru","download_url":"https://codeload.github.com/RefactoringGuru/design-patterns-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530745,"owners_count":21119625,"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":["design-patterns","python"],"created_at":"2024-11-08T13:11:32.796Z","updated_at":"2025-04-12T07:20:49.314Z","avatar_url":"https://github.com/RefactoringGuru.png","language":"Python","readme":"# Design Patterns in Python\n\nThis repository is part of the [Refactoring.Guru](https://refactoring.guru/design-patterns) project.\n\nIt contains Python examples for all classic GoF design patterns.\n\nEach pattern includes two examples:\n\n- [x] **Conceptual** examples show the internal structure of patterns, including detailed comments.\n\n- [ ] **RealWorld** examples show how patterns can be used in real-world Python applications.\n\n\n## Requirements\n\nThese examples require Python 3.7 and newer.\n\nAll examples can be launched via the command line, using the Python executable as follows:\n\n```sh\npython src/Path-to-example/main.py\n```\n\nFor the best experience, I recommend working with examples with these IDEs:\n\n- [PyCharm](https://www.jetbrains.com/pycharm/)\n- [Visual Studio Code](https://code.visualstudio.com/) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)\n\n## FAQ\n\n#### 1. What is the _Client Code_?\n\n_Client_ means _client of classes, defined as part of a pattern_, which is merely a caller of the given methods or a user of the given classes. In other words, it's the part of your application's code that uses the pattern's classes.\n\n#### 2. I don't understand the roles you're referring to in RealWorld examples.\n\nTake a look at the conceptual example first. There you'll find detailed descriptions of each class in a pattern, its role, and connection to other classes.\n\n\n## Contributor's Guide\n\nI appreciate any help, whether it's a simple fix of a typo or a whole new example. Just [make a fork](https://help.github.com/articles/fork-a-repo/), make your change and submit a [pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).\n\nHere's a style guide which might help you to keep your changes consistent with the rest of the project's code:\n\n1. All code should match the [PEP 8 coding style guide](https://www.python.org/dev/peps/pep-0008/)\n\n2. Try to hard-wrap the code at 80th's character. It helps to list the code on the website without scrollbars.\n\n3. Aim to put all code within one file. Yes, I realize that it's not how it supposed to be done in production. However, it helps people to understand examples better, since all code fits into one screen.\n\n4. Comments may or may not have language tags in them, such as this:\n\n    ```python\n    \"\"\"\n    EN: All products families have the same varieties (MacOS/Windows).\n\n    This is a MacOS variant of a button.\n\n    RU: Все семейства продуктов имеют одни и те же вариации (MacOS/Windows).\n\n    Это вариант кнопки под MacOS.\n    \"\"\"\n    ```\n    \n    This notation helps to keep the code in one place while allowing the website to generates separate versions of examples for all listed languages. Don't be scared and ignore the non-English part of such comments. If you want to change something in a comment like this, just do it. Even if you do it wrong, we'll tell you how to fix it during the Pull Request.\n\n\n## License\n\nThis work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc-nd/4.0/80x15.png\" /\u003e\u003c/a\u003e\n\n## Credits\n\nAuthors: Alexey Pyltsyn ([@lex111](https://github.com/lex111)) and Alexander Shvets ([@neochief](https://github.com/neochief))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefactoringguru%2Fdesign-patterns-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefactoringguru%2Fdesign-patterns-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefactoringguru%2Fdesign-patterns-python/lists"}