Python library for Apple's PKL.
Project description
[!CAUTION]
This project has moved to a new location: pkl-python on PyPI.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pkll-0.1.10.tar.gz
.
File metadata
- Download URL: pkll-0.1.10.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd75f42adc1f334bc3210639fc09492a76bba74f4446650c79eaa0a3577bed7a |
|
MD5 | 45cb55890617654d11a345baeff20096 |
|
BLAKE2b-256 | b10f8cbffabf010e7145ff78aa01f3b9fd66f849411aee25a7b0e80055f5198f |
File details
Details for the file pkll-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: pkll-0.1.10-py3-none-any.whl
- Upload date:
- Size: 30.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5006b9427434a6c12ee3c01074738f5fb19ef029e401cd23dd9d7453e2d62644 |
|
MD5 | 615cb3204e68f875ed459aeac1757c3a |
|
BLAKE2b-256 | 74da7bca7805064a907cf1b5068ec8790fd9c9b7886e411d25f05b8db311da9a |