{"id":24016449,"url":"https://github.com/zechcodes/fast-protocol","last_synced_at":"2025-06-12T23:38:19.958Z","repository":{"id":246793965,"uuid":"502641205","full_name":"ZechCodes/fast-protocol","owner":"ZechCodes","description":"A very simple Python module to declare protocols for checking if objects provide the desired interface.","archived":false,"fork":false,"pushed_at":"2022-06-12T15:43:13.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T15:40:17.407Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZechCodes.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-12T14:38:15.000Z","updated_at":"2024-03-14T10:19:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfc02452-eb4e-4bc1-861f-3770b496b7b6","html_url":"https://github.com/ZechCodes/fast-protocol","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"fa4954533da40ed5dc263553c969ca1c344a4cbd"},"previous_names":["zechcodes/fast-protocol"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ZechCodes/fast-protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZechCodes%2Ffast-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZechCodes%2Ffast-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZechCodes%2Ffast-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZechCodes%2Ffast-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZechCodes","download_url":"https://codeload.github.com/ZechCodes/fast-protocol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZechCodes%2Ffast-protocol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259551199,"owners_count":22875456,"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-01-08T08:51:26.400Z","updated_at":"2025-06-12T23:38:19.930Z","avatar_url":"https://github.com/ZechCodes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-protocol\nA very simple Python module to declare protocols for checking if objects provide the desired interface.\n\n## Installation\n```shell\npip install fast-protocol\n```\n\n## Usage\nTo create a Fast Protocol just call the `fast_protocol.protocol` function passing it the names of the methods/attributes that the protocol should support.\n```python\nfrom fast_protocol import protocol\n\ndef example():\n    ...\n\nCallable = protocol(\"__call__\")  # Create a protocol that matches objects with a dunder call method\nmatch example:\n    case Callable():\n        print(\"example is callable\")\n```\nThis can be used outside a `match` statement using `isinstance`.\n```python\nif isinstance(example, Callable):\n    print(\"example is callable\")\n```\n\nProtocols are generated with the name `\"FastProtocol\"`. This name can be changed by creating a new instance of\n`FastProtocolBuilder`. The name can be set traditionally by passing the name of the protocol to the `FastProtocolBuilder` class. Alternatively you can pass the protocol name as a subscript to an existing `FastProtocolBuilder` which will return a new instance that uses that name.\n\n**Traditional approach:**\n```python\nfrom fast_protocol import FastProtocolBuilder\n\nCallable = FastProtocolBuilder(\"Callable\")(\"__call__\")\n```\n**Alternative approach:**\n```python\nfrom fast_protocol import protocol\n\nCallable = protocol[\"Callable\"](\"__call__\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzechcodes%2Ffast-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzechcodes%2Ffast-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzechcodes%2Ffast-protocol/lists"}