Skip to main content

PKLL - PKL Language Python Binding

Python binding for Apple's Pkl language.

Status

  • Evaluator API: fully functional
  • Code Generation: in development

TODO

  • (codgen) binary installation feature
  • (codgen) fix class order
  • (codgen) clean up code
  • (evaluator) change default to dataclasses

Installation

pip install pkll

Usage

Basic Usage

Here's how you can start using PKLL to load a PKL module:

import pkll

config = pkll.load("path/to/pkl/example_module.pkl")
print(config)

Advanced Features

For details on the parameters, refer Message Passing API.

from pkll import load

# Advanced loading with custom environment and properties
result = load(
    "path/to/pkl/example_module.pkl"
    env={"CUSTOM_ENV": "value"},
    properties={"custom.property": "value"}
)
print(result)

Custom Handler

It is possible to add custom resources or module handler:

import pkll
from pkll.handler import (
    ListResponse,
    ReadModuleResponse,
    ReadResourceResponse,
    ResourcesHandler,
)
from pkll.msgapi.outgoing import ClientResourceReader

class CustomModuleHandler(ResourcesHandler):
    def list_response(self, uri: str) -> ListResponse:
        return ListResponse(
            pathElements=[{"name": "foo.pkl", "isDirectory": False}]
        )

    def read_response(self, uri: str) -> ReadResourceResponse:
        return ReadModuleResponse(
            contents="foo = 1",
        )

config = pkll.load(
    "./tests/myModule.pkl",
    allowedModules=["pkl:", "repl:", "file:", "customfs:"],
    clientModuleReaders=[
        {
            "scheme": "customfs",
            "hasHierarchicalUris": True,
            "isGlobbable": True,
            "isLocal": True,
        }
    ],
    debug=True,
    module_handler=CustomModuleHandler(),
)

Contributing

Contributions 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.

License

PKLL is released under the MIT License. See the LICENSE file for more details.

Contact

For support or to contribute, please contact jwyang0213@gmail.com or visit our GitHub repository to report issues or submit pull requests.

Metadata

Release files for pkll 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pkll 0.1.10
File Size Uploaded Provenance Actions
pkll-0.1.10.tar.gz 23.7 kB Without provenance Details for pkll-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pkll 0.1.10
File Interpreter ABI Platform Actions
pkll-0.1.10-py3-none-any.whl Python 3 none any Details for pkll-0.1.10-py3-none-any.whl

Total release size: 54.1 kB

Release files / pkll-0.1.10.tar.gz

Download URL pkll-0.1.10.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fd75f42adc1f334bc3210639fc09492a76bba74f4446650c79eaa0a3577bed7a
BLAKE2b-256 checksum
How to use checksums
b10f8cbffabf010e7145ff78aa01f3b9fd66f849411aee25a7b0e80055f5198f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / pkll-0.1.10-py3-none-any.whl

Download URL pkll-0.1.10-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5006b9427434a6c12ee3c01074738f5fb19ef029e401cd23dd9d7453e2d62644
BLAKE2b-256 checksum
How to use checksums
74da7bca7805064a907cf1b5068ec8790fd9c9b7886e411d25f05b8db311da9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for pkll 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page