{"id":34103375,"url":"https://github.com/jw-y/pkl-python","last_synced_at":"2026-04-10T10:02:36.006Z","repository":{"id":226812071,"uuid":"767914155","full_name":"jw-y/pkl-python","owner":"jw-y","description":"Python binding for Apple's Pkl language","archived":false,"fork":false,"pushed_at":"2026-02-28T11:10:44.000Z","size":269,"stargazers_count":69,"open_issues_count":3,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-04-09T04:22:10.715Z","etag":null,"topics":["apple","language","pkl","python"],"latest_commit_sha":null,"homepage":"","language":"Pkl","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/jw-y.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-06T05:58:58.000Z","updated_at":"2026-03-20T08:16:30.000Z","dependencies_parsed_at":"2024-08-07T20:54:52.549Z","dependency_job_id":null,"html_url":"https://github.com/jw-y/pkl-python","commit_stats":null,"previous_names":["jw-y/pkll"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jw-y/pkl-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw-y%2Fpkl-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw-y%2Fpkl-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw-y%2Fpkl-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw-y%2Fpkl-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jw-y","download_url":"https://codeload.github.com/jw-y/pkl-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jw-y%2Fpkl-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"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":["apple","language","pkl","python"],"created_at":"2025-12-14T17:37:54.427Z","updated_at":"2026-04-10T10:02:35.999Z","avatar_url":"https://github.com/jw-y.png","language":"Pkl","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e\n\u003e # THIS LIBRARY IS CURRENTLY PRE-RELEASE\n\u003e\n\u003e `pkl-python` is currently major version `v0`, and **breaking changes will happen** between versions.\n\n# pkl-python - Pkl Bindings for Python\nPython binding for [Apple's Pkl language](https://pkl-lang.org/index.html).\n\n## Getting Started\n### Installation\n\n``` bash\npip install pkl-python\n```\n\n### Basic Usage\nHere's how you can start using `pkl-python` to load a PKL module:\n\n```python\nimport pkl\n\nconfig = pkl.load(\"path/to/pkl/example_module.pkl\")\nconfig = pkl.loads(\"a: Int = 1 + 1\")\n```\n\n### Code Generation\nAs Python is a dynamic language, codegen is not strictly necessary.\nHowever, codegen lets you expect contents of pkl files within Python modules.\n\n```\npkl-gen-python path/to/pkl/example_module.pkl\n```\n\n### TODO\n* [x] (codgen) pip binary installation\n* [ ] (codgen) gatherer depth-first ordering\n* [ ] (codgen) clean up code\n\n\n## Advanced Features\n\n```python\nimport pkl\n\nconfig = pkl.load(\"./tests/types.pkl\")\nconfig = pkl.load(\"./tests/types.pkl\", expr=\"datasize\")\nconfig = pkl.load(None, module_text=\"a: Int = 1 + 1\")\nconfig = pkl.load(\"./tests/types.pkl\", debug=True)\n```\n\n### `pkl.load` Parameters Detail\nFor details on the parameters, refer\n* [`pkl eval`](https://pkl-lang.org/main/current/pkl-cli/index.html#command-eval)\n* [Message Passing API](https://pkl-lang.org/main/current/bindings-specification/message-passing-api.html).\n\n### Custom Readers\nIt is possible to add module or resource or module readers:\n```python\nfrom typing import List\nfrom dataclasses import dataclass\n\nimport pkl\nfrom pkl import (\n    ModuleReader, ResourceReader, PathElement,\n    ModuleSource, PreconfiguredOptions, PklError,\n)\n\nclass TestModuleReader(ModuleReader):\n    def read(self, url) -\u003e str:\n        return \"foo = 1\"\n\n    def list_elements(self, url: str) -\u003e List[PathElement]:\n        return [PathElement(\"foo.pkl\", False)]\n\nopts = PreconfiguredOptions(\n    moduleReaders=[TestModuleReader(\"customfs\", True, True, True)]\n)\nopts.allowedModules.append(\"customfs:\")\nconfig = pkl.load(\"./tests/pkls/myModule.pkl\", evaluator_options=opts)\n```\n\n## Appendix\n\n### Type Mappings\n\nWhile in pre-release they are subject to change.\n\n| Pkl type         | TypeScript type            |\n| ---------------- | -------------------------- |\n| Null             | `None`                     |\n| Boolean          | `bool`                     |\n| String           | `str`                      |\n| Int              | `int`                      |\n| Int8             | `int`                      |\n| Int16            | `int`                      |\n| Int32            | `int`                      |\n| UInt             | `int`                      |\n| UInt8            | `int`                      |\n| UInt16           | `int`                      |\n| UInt32           | `int`                      |\n| Float            | `float`                    |\n| Number           | `float`                    |\n| List             | `list`                     |\n| Listing          | `list`                     |\n| Map              | `dict`                     |\n| Mapping          | `dict`                     |\n| Set              | `set`                      |\n| Pair             | `pkl.Pair`                 |\n| Dynamic          | `dataclasses.dataclass`    |\n| DataSize         | `pkl.DataSize`             |\n| Duration         | `pkl.Duration`             |\n| IntSeq           | `pkl.IntSeq`               |\n| Class            | `dataclasses.dataclass`    |\n| TypeAlias        | `typing`                   |\n| Any              | `typing.Any`               |\n| Unions (A\\|B\\|C) | `typing.Union[A\\|B\\|C]`    |\n| Regex            | `pkl.Regex`                |\n\n## Contributing\nContributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\nPKL is released under the MIT License. See the LICENSE file for more details.\n\n## Contact\nFor support or to contribute, please contact jwyang0213@gmail.com or visit our GitHub repository to report issues or submit pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjw-y%2Fpkl-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjw-y%2Fpkl-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjw-y%2Fpkl-python/lists"}