{"id":13709416,"url":"https://github.com/fcracker79/pycomb","last_synced_at":"2026-01-16T19:57:10.953Z","repository":{"id":62579396,"uuid":"42079567","full_name":"fcracker79/pycomb","owner":"fcracker79","description":"Tcomb port for Python 3","archived":false,"fork":false,"pushed_at":"2020-12-14T14:06:06.000Z","size":73,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-25T16:33:26.454Z","etag":null,"topics":["combinators","tcomb","type","type-safe","validation"],"latest_commit_sha":null,"homepage":null,"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/fcracker79.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}},"created_at":"2015-09-07T23:44:45.000Z","updated_at":"2021-05-18T13:20:08.000Z","dependencies_parsed_at":"2022-11-03T21:00:47.443Z","dependency_job_id":null,"html_url":"https://github.com/fcracker79/pycomb","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/fcracker79/pycomb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcracker79%2Fpycomb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcracker79%2Fpycomb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcracker79%2Fpycomb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcracker79%2Fpycomb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcracker79","download_url":"https://codeload.github.com/fcracker79/pycomb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcracker79%2Fpycomb/sbom","scorecard":{"id":394594,"data":{"date":"2025-08-11","repo":{"name":"github.com/fcracker79/pycomb","commit":"a7aaff95a640778e9d8e7c8271ecae18d9fb13ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T18:40:26.043Z","repository_id":62579396,"created_at":"2025-08-18T18:40:26.043Z","updated_at":"2025-08-18T18:40:26.043Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["combinators","tcomb","type","type-safe","validation"],"created_at":"2024-08-02T23:00:38.966Z","updated_at":"2026-01-16T19:57:10.917Z","avatar_url":"https://github.com/fcracker79.png","language":"Python","readme":"[![build status](https://img.shields.io/travis/fcracker79/pycomb/master.svg?style=flat-square)](https://travis-ci.org/fcracker79/pycomb)\n\nPyComb\n======\n\n\n[Tcomb](http://www.github.com/gcanti/tcomb) port for Python 3.\nIt provides a means to apply runtime type checking.\n\nInstallation\n------------\n\n```sh\npip install pycomb\n```\n\nBasic examples\n--------------\n\n```python\n\nfrom pycomb import combinators\n\n# A simple string\nMyStringType = combinators.String\ns1 = combinators.String('hello')  # This IS a 'str' object\ns2 = combinators.String(10)  # This will fail\n\n# A list that contains only strings\nListOfStrings = combinators.list(combinators.String)\nl1 = ListOfStrings(['1', '2', '3'])  # This IS a native tuple\nl1 = ListOfStrings(['1', '2', 3])  # This will fail\n\n# Structured data\nUser = combinators.struct(\n    {\n        'name': combinators.String, \n        'age': combinators.Int, \n        'city': combinators.maybe(combinators.String)\n    }\n)\nmy_user = User({'name': 'John Burns', 'age': 30})  # This IS a dict\nmy_user2 = User({'name': 'John Burns', 'age': '30'})  # This will fail\nmy_user3 = User({'name': 'John Burns', 'age': 30, 'city': 'New York'})  # This IS a dict\n\n# Subtypes\nSmallString = combinators.subtype(\n    combinators.String, \n    lambda d: len(d) \u003c= 10)  # Strings shorter than 11 characters\nSmallString('12345678901')  # This will fail\nSmallString('12345')  # This IS a 'str' object\n\n# Constants\njohn_data = {'name': 'John'}\nJohn = combinators.constant(john_data, name='JohnConstant')\nJohn({'name': 'John'})\nJohn({'name': 'Jack'})  # Error on JohnConstant: expected JohnConstant but was dict\n\n\n# Regexp with groups\nimport re\ndef name_condition(d):\n    return d in ('John', 'Jack')\ndef age_condition(d):\n    return int(d) \u003e 0\n\nName = combinators.subtype(combinators.String, name_condition, name='Name')\nAge = combinators.subtype(combinators.String, age_condition, name='Age')\nNameAndAge = combinators.regexp_group('(\\w+) +(-?[0-9]+)', Name, Age, name='NameAndAge')\nNameAndAge('John 32')  # Ok\nNameAndAge('John 3x')  # Error on NameAndAge: expected NameAndAge but was str\nNameAndAge('John -32')  # Error on NameAndAge[1]: expected Age but was str\nNameAndAge('WRONG 32')  # Error on NameAndAge[0]: expected Name but was str\n\n\n```\n\nValidation context\n------------------\nThe validation procedure runs within a context that controls:\n\n1. The behavior in case of error\n2. The production mode: if active, no such error is raised during validation\n\n**Context Examples**\n\n```python\n\nfrom pycomb import combinators, context\n\n# Example of production mode\nListOfNumbers = combinators.list(combinators.Number, 'ListOfNumbers')\nproduction_ctx = context.create(production_mode=True)\nnumbers = ListOfNumbers([1, 2, 'hello'], ctx=production_ctx)  # This will NOT fail\n\n\n# Example of custom behavior in case of error\nclass MyObserver(context.ValidationErrorObserver):\n    def on_error(self, ctx, expected_type, found_type):\n        print('Expected {}, got {}'.format(expected_type, found_type))\n\nListOfNumbers = combinators.list(combinators.Number, 'ListOfNumbers')\nnotification_ctx = context.create(validation_error_observer=MyObserver())\nnumbers = ListOfNumbers([1, 2, 'hello'], ctx=production_ctx)  # This will NOT fail\n# Expected output:\n# \u003e Expected Int or Float, got \u003cclass 'str'\u003e\n\n```\n\nDecorators\n----------\nIt is possible to wrap functions in order to protect the input parameters,\nor ensure the type of its return value\n\n**Decorators example**\n\n```python\n\nfrom pycomb import combinators\n\n# Example of input parameters check\n@combinators.function(\n    combinators.String, combinators.Int,\n    c=combinators.Float, d=combinators.list(combinators.Int))\ndef f(a, b, c=None, d=None):\n    pass\nf('John', 1, c=1.0, d=[3, 4])  # OK\nf(1, 1, c=1.0, d=[3, 4])  # This will fail\n\n# Example of output check\n@returning(cmb.subtype(cmb.String, lambda d: len(d) \u003c 10))\ndef f(n):\n    return ' ' * n\n\nf(3)  # OK\nf(10)  # This will fail\n\n```\n\nMore types are supported, such as:\n\n* Unions\n* Intersections\n* Functions\n* Enums\n* ...\n\nAll the base types have a default example field.\nPlease read the test code to find more examples.\n","funding_links":[],"categories":["Libraries in Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcracker79%2Fpycomb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcracker79%2Fpycomb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcracker79%2Fpycomb/lists"}