{"id":15584242,"url":"https://github.com/ableinc/waycheck","last_synced_at":"2025-03-29T08:44:53.646Z","repository":{"id":62591028,"uuid":"483294521","full_name":"ableinc/waycheck","owner":"ableinc","description":"A lightweight Python type checker. Designed with the developer in mind.","archived":false,"fork":false,"pushed_at":"2022-04-19T16:23:34.000Z","size":4,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T05:48:22.557Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ableinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-19T15:03:39.000Z","updated_at":"2023-12-12T19:32:04.000Z","dependencies_parsed_at":"2022-11-04T07:15:53.687Z","dependency_job_id":null,"html_url":"https://github.com/ableinc/waycheck","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/ableinc%2Fwaycheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ableinc%2Fwaycheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ableinc%2Fwaycheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ableinc%2Fwaycheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ableinc","download_url":"https://codeload.github.com/ableinc/waycheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246162117,"owners_count":20733355,"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-10-02T20:40:28.256Z","updated_at":"2025-03-29T08:44:53.628Z","avatar_url":"https://github.com/ableinc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Waycheck (Python Type Checker)\n\nA lightweight Python type checker. Designed with the developer in mind. The Waycheck class is a decorator, which means you can use it by prepending '@' above the function you'd like to type check. No library dependencies under the hood - Pure Python ;)!\n\n## Install\n\n```bash\npython -m pip --install waycheck\n```\n\n## Getting Started\n\nYou can refer to the ```demo.py``` file in this repository or the code block below\nto see how ```Waycheck``` works.\n\n```python\nimport waycheck\n\n# Defining the type for each argument\n@Waycheck(a=int, b=int)\ndef main(a, b):\n    print('Total: ', a + b)\n\n\n# Defining the default type for ALL arguments\n@Waycheck(default_type=int)\ndef main2(a, b):\n    print('Total: ', a + b)\n\n\nif __name__ == '__main__':\n    main(5, 10)  # this will pass\n    main('5', 10)  # this will fail\n\n    main2(5, 10)  # this will pass\n    main2('5', 10)  # this will fail\n```\n\n## Accepted Types\n\nWaycheck can type check any valid Python Type provided to it, as well as a wildcard type. A wildcard type\nis used when an argument can be any value. This is handy when you're doing your own type checking within\nyour function and would like Waycheck to skip type checking that argument.\n\nYou can specify a wildcard by using '*'. See an example below:\n\n```python\n@Waycheck(a='*', b=bool)\ndef main(a, b):\n    if b:\n        return a\n```\n\nYou can also pass a tuple of Types, instead of '*' (wildcat). See an example below:\n\n```python\n@Waycheck(a=(str, int))\ndef main(a):\n    print('Argument a is: ', a, ' - type: ', type(a))\n```\n\n## Exmaples\n\nRefer to ```demo.py``` file.\n\n## FAQ\n\nQ: My type checking is failling/passing, but I know it shouldn't be. Why is this happening?\nA: This happens when you don't specify the correct order of appearance for the Waycheck class.\nThe order in which the arguments are passed to the function, should be the exact same order you\nprovide to the Waycheck class. By not doing this, unexpected type checking behavior will occur,\nsuch as passing when it should fail or failing when it should pass.\n\nNote: This will occur if the argument all have different expected type values. i.e if all arguments are supposed to be integers, then the order doesn't matter.\nExample:\n\n```python\n# this works as expected\n@Waycheck(a=int, b=int)\ndef main(a, b):\n    ...\n\n\n# this will fail if all the arguments\n# are not the same expected type\n@Waycheck(b=int, a=int)\ndef main(a, b):\n    ...\n```\n\nQ: Can I pass my own custom error class?\nA: No. The default error given is ```WaycheckTypeError```. You could use a blanket Exeception check (try/except) then throw whatever error you want.\n\nQ: I keep getting an IndexError, why?\nA: If you're going to type check the function you must provide Waycheck with the expected type for ALL the arguments, not just some of them.\n\n## Changelog\n\nApril 2022:\n\n* Initial Release - v0.0.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fableinc%2Fwaycheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fableinc%2Fwaycheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fableinc%2Fwaycheck/lists"}