feat: add pdl-lint tool that can be configured via pyproject.toml #864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wrote a PDL lint tool for one of my projects to validate that PDL files in the project are valid at build time. I imagine this tool would be nice to be part of Prompt Declaration Library itself. Hence this proposal.
The tool's behavior can be configured either via
pyproject.toml
or.pdl-lint
file, with preference given to settings ofpyproject.toml
, ignoring any settings in.pdl-lint
file.Sample output
Happy Case
Failure Case
Tool settings in
pyproject.toml
NOTE: Any additional properties in this section will be ignored. A warning will be shown instead to let the user know that the additional properties have no effect on this tool.
CLI Usage
Testing done
I used
uv
instead ofpip
directly. But, I believe it has the same effect.All tests, except those that depend on
ollama
, ran successfully. The error I get for the failing tests are shown below.and the following error:
${error_msg}
Please repair the code!
: 'code_line' is undefined
What is your query?
examples/tutorial/programs/chatbot.pdl: model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
examples/tutorial/programs/code-json.pdl: model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
examples/tutorial/programs/tfidf_rag.pdl: model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
examples/tutorial/programs/weather.pdl: model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat
model 'ollama_chat/granite3.2:2b' encountered ConnectError('[Errno 99] Cannot assign requested address') trying to POST against http://localhost:11434/api/chat