{"id":21260328,"url":"https://github.com/nlm/parseable","last_synced_at":"2026-05-15T18:34:54.524Z","repository":{"id":57450864,"uuid":"72360740","full_name":"nlm/parseable","owner":"nlm","description":"Reliable parsing of python data structures into objects","archived":false,"fork":false,"pushed_at":"2017-02-02T23:43:10.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T16:41:35.603Z","etag":null,"topics":["json","nested-parseables","parsing","schema"],"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/nlm.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":"2016-10-30T16:24:23.000Z","updated_at":"2023-09-08T17:16:30.000Z","dependencies_parsed_at":"2022-09-26T17:31:35.819Z","dependency_job_id":null,"html_url":"https://github.com/nlm/parseable","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nlm/parseable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlm%2Fparseable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlm%2Fparseable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlm%2Fparseable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlm%2Fparseable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nlm","download_url":"https://codeload.github.com/nlm/parseable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nlm%2Fparseable/sbom","scorecard":{"id":690652,"data":{"date":"2025-08-11","repo":{"name":"github.com/nlm/parseable","commit":"7e24801f5145ce3a8cf858c0962b4a2341571df5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/25 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":"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":"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":"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":"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":"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":"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":"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":"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T02:13:54.845Z","repository_id":57450864,"created_at":"2025-08-22T02:13:54.846Z","updated_at":"2025-08-22T02:13:54.846Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33074876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["json","nested-parseables","parsing","schema"],"created_at":"2024-11-21T04:17:43.865Z","updated_at":"2026-05-15T18:34:54.508Z","avatar_url":"https://github.com/nlm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Parseable [![Build Status](https://travis-ci.org/nlm/parseable.svg)](https://travis-ci.org/nlm/parseable) [![codecov](https://codecov.io/gh/nlm/parseable/branch/master/graph/badge.svg)](https://codecov.io/gh/nlm/parseable) [![License: MIT](https://img.shields.io/github/license/nlm/parseable.svg)](https://opensource.org/licenses/MIT) [![Code Issues](https://www.quantifiedcode.com/api/v1/project/b63f9fedea2e4909a5a213878a0e07a3/badge.svg)](https://www.quantifiedcode.com/app/project/b63f9fedea2e4909a5a213878a0e07a3)\n=========\n\nA python library to make easier the parsing of data structures into objects,\nwith strong validation.\n\nThis has been originally developed to parse messages from the Telegram Bot API\n(https://core.telegram.org/bots/api/)\n\nData validation is done using 'schema' (https://pypi.python.org/pypi/schema)\n\nSoftware in Development\n-----------------------\n\n*Warning*: This is software is in beta stage, it is subject to changes\n\nBasic Usage\n-----------\n\nBasic usage is simple. You call the `parseable` function, providing\na class name and a validation schema (see the `schema` package documentation\nfor more informations)\n\n```python\n\u003e\u003e\u003e from parseable import parseable\n\u003e\u003e\u003e User = parseable('User', {'id': int, 'name': str})\n\u003e\u003e\u003e user = User({'id': 2, 'name': 'Joe'})\n\u003e\u003e\u003e user == {'id': 2, 'name': 'Joe'}\nTrue\n\u003e\u003e\u003e isinstance(user, User)\nTrue\n\n```\n\nIf the data doesn't match the schema, a `SchemaError` exception is raised\n\n```python\n\u003e\u003e\u003e from parseable import SchemaError\n\u003e\u003e\u003e try:\n...     baduser = User({'a wrong': 'data structure'})\n... except SchemaError as exc:\n...     print(exc)\nMissing keys: 'id', 'name'\n\n```\n\nRecursive Parsing\n-----------------\n\nThis library allow you to include parseables into other parseables,\nso you can define objects and include them in each other.\nThis makes nested api objects easier to parse.\n\n```python\n\u003e\u003e\u003e from parseable import parseable, Use\n\u003e\u003e\u003e User = parseable('User', {'id': int, 'name': str})\n\u003e\u003e\u003e Message = parseable('Message', {'from': Use(User), 'text': str})\n\u003e\u003e\u003e message = Message({'from': {'id': 2, 'name': 'Joe'}, 'text': 'Hello'})\n\u003e\u003e\u003e message == {'text': 'Hello', 'from': {'id': 2, 'name': 'Joe'}}\nTrue\n\n```\n\nYou can also recurse on the current object itself,\nusing the special class `Self`\n\n```python\n\u003e\u003e\u003e from parseable import parseable, Use, Optional, Self\n\u003e\u003e\u003e User = parseable('User', {'id': int, Optional('parent'): Use(Self)})\n\u003e\u003e\u003e user = User({'id': 2, 'parent': {'id': 1}})\n\u003e\u003e\u003e user == {'id': 2, 'parent': {'id': 1}}\nTrue\n\n```\n\nDefaults\n--------\n\nAs with `schema.Schema`, you can use defaults:\n\n```python\n\u003e\u003e\u003e from parseable import parseable, Use, Optional, Self\n\u003e\u003e\u003e DefDemo = parseable('DefDemo', {Optional('id', default=4): int})\n\u003e\u003e\u003e defdemo = DefDemo({'id': 2})\n\u003e\u003e\u003e defdemo['id']\n2\n\u003e\u003e\u003e defdemo = DefDemo({})\n\u003e\u003e\u003e defdemo['id']\n4\n\n```\n\nProducing Content\n-----------------\n\nParsing text from an API is cool, but you also have to reply sometimes.\nYou can use the exact same objects to do that.\n\n```python\n\u003e\u003e\u003e from parseable import parseable, Use\n\u003e\u003e\u003e User = parseable('User', {'id': int, 'name': str})\n\u003e\u003e\u003e Message = parseable('Message', {'from': Use(User), 'text': str})\n\u003e\u003e\u003e # defining objects\n\u003e\u003e\u003e user = User({'id': 2, 'name': 'Joe'})\n\u003e\u003e\u003e message = Message({'from': user.data, 'text': 'Hello'})\n\u003e\u003e\u003e message == {'text': 'Hello', 'from': {'id': 2, 'name': 'Joe'}}\nTrue\n\n```\n\nYou can then encode this and send it to your API endpoint.\nThis way, you can guarantee the correctness of data structures\non input and output operations.\n\nValue Expansion\n---------------\n\nYou can use parseable object instances as any other object, but sometimes,\nyou really need the real underlying data structures types. For example,\nwhen you want to use operators or when you want to dump\ndata using the json module.\n\n### Using type-specific operators\n\nIf you need to access the object data, you can use the `data` attribute.\n\n```python\n\u003e\u003e\u003e from parseable import parseable, expand\n\u003e\u003e\u003e Int = parseable('Int', int)\n\u003e\u003e\u003e integer = Int(3)\n\u003e\u003e\u003e try:\n...     print(integer * integer)\n... except TypeError as err:\n...     print(err)\n...\nunsupported operand type(s) for *: 'Int' and 'Int'\n\u003e\u003e\u003e print(integer.data * integer.data)\n9\n\n```\n\n### Encoding objects as JSON\n\nIf you have nested Parseables, you might want to get the values of\nall the sub-objects too. In this case, you can use the `expand` function.\nIt recurses on lists and dicts, so if you have nested Parseables,\nthe whole structure will be expanded.\n\n```python\n\u003e\u003e\u003e import json\n\u003e\u003e\u003e user = User({'id': 2, 'name': 'Joe'})\n\u003e\u003e\u003e message = Message({'from': user.data, 'text': 'Hello'})\n\u003e\u003e\u003e isinstance(message, dict)\nFalse\n\u003e\u003e\u003e from parseable import expand\n\u003e\u003e\u003e message = expand(message)\n\u003e\u003e\u003e isinstance(message, dict)\nTrue\n\u003e\u003e\u003e json.dumps(message) # doctest: +SKIP\n'{\"text\": \"Hello\", \"from\": {\"id\": 2, \"name\": \"Joe\"}}'\n\n```\n\nTypes and inheritance\n---------------------\n\nAll the objects as subclasses of parseable.Parseable, you can check\nif an object is a parseable like this:\n\n```python\n\u003e\u003e\u003e from parseable import parseable, Parseable\n\u003e\u003e\u003e User = parseable('User', {'id': int, 'name': str})\n\u003e\u003e\u003e issubclass(User, Parseable)\nTrue\n\n```\n\nSome Parseables will verify as Sequence or Mapping, depending on the Schema\nthat you create them with.\n\n```python\n\u003e\u003e\u003e from parseable import parseable\n\u003e\u003e\u003e from collections import Sequence, Mapping\n\u003e\u003e\u003e\n\u003e\u003e\u003e seq_schema = [int]\n\u003e\u003e\u003e MySeq = parseable('MySeq', seq_schema)\n\u003e\u003e\u003e myseq = MySeq([1, 2, 3])\n\u003e\u003e\u003e isinstance(seq_schema, Sequence)\nTrue\n\u003e\u003e\u003e isinstance(myseq, Sequence)\nTrue\n\u003e\u003e\u003e\n\u003e\u003e\u003e map_schema = {str: str}\n\u003e\u003e\u003e MyMap = parseable('MyMap', map_schema)\n\u003e\u003e\u003e mymap = MyMap({'test': 'ok'})\n\u003e\u003e\u003e isinstance(map_schema, Mapping)\nTrue\n\u003e\u003e\u003e isinstance(mymap, Mapping)\nTrue\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlm%2Fparseable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlm%2Fparseable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlm%2Fparseable/lists"}