{"id":22169652,"url":"https://github.com/tombulled/annotate","last_synced_at":"2025-03-24T17:23:18.567Z","repository":{"id":43858919,"uuid":"428819743","full_name":"tombulled/annotate","owner":"tombulled","description":"Annotation System Inspired by Java Annotations","archived":false,"fork":false,"pushed_at":"2024-03-22T18:38:11.000Z","size":83,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T07:36:27.538Z","etag":null,"topics":["annotate","label","python"],"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/tombulled.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}},"created_at":"2021-11-16T21:30:42.000Z","updated_at":"2022-01-24T20:51:56.000Z","dependencies_parsed_at":"2024-03-22T19:47:36.088Z","dependency_job_id":"a242e3d7-6748-4b16-9c0c-7429a476e281","html_url":"https://github.com/tombulled/annotate","commit_stats":{"total_commits":69,"total_committers":2,"mean_commits":34.5,"dds":"0.26086956521739135","last_synced_commit":"7b09357625eae7f7a6b8285a649a336c1a29de2f"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombulled%2Fannotate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombulled%2Fannotate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombulled%2Fannotate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tombulled%2Fannotate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tombulled","download_url":"https://codeload.github.com/tombulled/annotate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245315984,"owners_count":20595364,"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":["annotate","label","python"],"created_at":"2024-12-02T06:33:49.570Z","updated_at":"2025-03-24T17:23:18.532Z","avatar_url":"https://github.com/tombulled.png","language":"Python","readme":"# annotate\nPython Annotation System\n\n## About\nAnnotations are tags that store object metadata (e.g. for functions/classes)\n\n## Installation\n### From PyPI\n```console\npip install tombulled-annotate\n```\n### From GitHub\n```console\npip install git+https://github.com/tombulled/annotate@main\n```\n\n## Usage\n\n### Marker\nAn annotation with a fixed value\n```python\nimport annotate\n\n@annotate.marker\ndef deprecated() -\u003e bool:\n    return True\n\n@deprecated\ndef foo():\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(foo)\n{'deprecated': True}\n```\n\n### Annotation\nAn annotation with a configurable value\n```python\nimport annotate\n\n@annotate.annotation\ndef metadata(*, author: str, version: str) -\u003e dict:\n    return dict(\n        author = author,\n        version = version,\n    )\n\n@metadata(author='sam', version='1.0.1')\ndef foo():\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(foo)\n{'metadata': {'author': 'sam', 'version': '1.0.1'}}\n```\n\n## Repeatable Annotation\nAn annotation that can be used to annotate the same object multiple times\n```python\nimport annotate\n\n@annotate.annotation(repeatable=True)\ndef tag(tag: str, /) -\u003e str:\n    return tag\n\n@tag('awesome')\n@tag('cool')\n@tag('funky')\ndef foo():\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(foo)\n{'tag': ['funky', 'cool', 'awesome']}\n```\n\n## Inherited Annotation\nAn annotation that gets added to subclasses of an annotated class\n```python\nimport annotate\n\n@annotate.annotation(inherited=True)\ndef identifier(identifier: str, /) -\u003e str:\n    return identifier\n\n@identifier('abc')\nclass Class:\n    pass\n\nclass Subclass(Class):\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(Class)\n{'identifier': 'abc'}\n\u003e\u003e\u003e annotate.get_annotations(Subclass)\n{'identifier': 'abc'}\n```\n\n## Targetted Annotation\nAn annotation that targets objects of specific types\n```python\nimport annotate\nimport types\n\n@annotate.annotation(targets=(types.FunctionType,))\ndef description(description: str, /) -\u003e str:\n    return description\n\n@description('A really cool function')\ndef foo():\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(foo)\n{'description': 'A really cool function'}\n```\n\n### Non-Stored Annotation\n```python\nimport annotate\n\n@annotate.annotation(stored=False)\ndef author(name: str, /) -\u003e None:\n    pass\n\n@author('Tim')\ndef foo():\n    pass\n```\n\n```python\n\u003e\u003e\u003e annotate.get_annotations(foo)\n{}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombulled%2Fannotate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftombulled%2Fannotate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftombulled%2Fannotate/lists"}