{"id":16482622,"url":"https://github.com/ariebovenberg/quacks","last_synced_at":"2025-03-21T07:30:47.049Z","repository":{"id":37028312,"uuid":"437037734","full_name":"ariebovenberg/quacks","owner":"ariebovenberg","description":"🦆 Better duck-typing with mypy-compatible extensions to Protocol","archived":false,"fork":false,"pushed_at":"2024-04-01T05:13:35.000Z","size":419,"stargazers_count":15,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-01T06:27:03.898Z","etag":null,"topics":["duck-typing","immutability","mypy","mypy-plugins","protocols","traits"],"latest_commit_sha":null,"homepage":"https://quacks.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariebovenberg.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","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}},"created_at":"2021-12-10T16:08:37.000Z","updated_at":"2024-04-15T06:50:52.494Z","dependencies_parsed_at":"2024-01-02T11:09:11.854Z","dependency_job_id":"c3008161-faa0-44c0-90b2-5ee3309292c7","html_url":"https://github.com/ariebovenberg/quacks","commit_stats":{"total_commits":133,"total_committers":3,"mean_commits":"44.333333333333336","dds":"0.26315789473684215","last_synced_commit":"2725eb7c0b5e9401659dcd81257f4c7971274474"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariebovenberg%2Fquacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariebovenberg%2Fquacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariebovenberg%2Fquacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariebovenberg%2Fquacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariebovenberg","download_url":"https://codeload.github.com/ariebovenberg/quacks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244757258,"owners_count":20505362,"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":["duck-typing","immutability","mypy","mypy-plugins","protocols","traits"],"created_at":"2024-10-11T13:11:27.907Z","updated_at":"2025-03-21T07:30:46.789Z","avatar_url":"https://github.com/ariebovenberg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"🦆 Quacks\n=========\n\n.. image:: https://img.shields.io/pypi/v/quacks.svg\n   :target: https://pypi.python.org/pypi/quacks\n\n.. image:: https://img.shields.io/pypi/l/quacks.svg\n   :target: https://pypi.python.org/pypi/quacks\n\n.. image:: https://img.shields.io/pypi/pyversions/quacks.svg\n   :target: https://pypi.python.org/pypi/quacks\n\n.. image:: https://github.com/ariebovenberg/quacks/actions/workflows/build.yml/badge.svg\n   :target: https://github.com/ariebovenberg/quacks/actions/workflows/build.yml\n\n.. image:: https://img.shields.io/readthedocs/quacks.svg\n   :target: http://quacks.readthedocs.io/\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n\n.. epigraph::\n\n  If it walks like a duck and it quacks like a duck, then it must be a duck\n\n\nThanks to `PEP544 \u003chttps://www.python.org/dev/peps/pep-0544/\u003e`_, Python now has protocols:\na way to define duck typing statically.\nThis library gives you some niceties to make common idioms easier.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n   pip install quacks\n\n⚠️ For type checking to work with ``mypy``, you'll need to enable the plugin in\nyour `mypy config file \u003chttps://mypy.readthedocs.io/en/latest/config_file.html\u003e`_:\n\n.. code-block:: ini\n\n   [mypy]\n   plugins = quacks\n\nFeatures\n--------\n\nEasy read-only protocols\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nDefining read-only protocols is great for encouraging immutability and\nworking with frozen dataclasses. Use the ``readonly`` decorator:\n\n\n.. code-block:: python\n\n    from quacks import readonly\n\n    @readonly\n    class User(Protocol):\n        id: int\n        name: str\n        is_premium: bool\n\nWithout this decorator, we'd have to write quite a lot of cruft,\nreducing readability:\n\n\n.. code-block:: python\n\n    class User(Protocol):\n        @property\n        def id(self) -\u003e int: ...\n        @property\n        def name(self) -\u003e str: ...\n        @property\n        def is_premium(self) -\u003e bool: ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariebovenberg%2Fquacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariebovenberg%2Fquacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariebovenberg%2Fquacks/lists"}