Pants build system plugin for the PKL configuration language
Project description
pants-plugin-pkl
A Pants plugin for the PKL configuration language. It brings PKL files into the Pants build graph, enabling pants test, pants fmt, pants lint, pants package, pants tailor, and automatic dependency inference for .pkl files.
Installation
Add pants-plugin-pkl to your pants-plugins resolve:
# pants-plugins/BUILD
python_requirement(
name = "pants-plugin-pkl",
requirements = ["pants-plugin-pkl==1.0.0"],
resolve = "pants-plugins",
)
Then regenerate the lockfile:
pants generate-lockfiles --resolve=pants-plugins
Then configure pants.toml as shown in Quick start.
What this plugin does
pants-plugin-pkl integrates PKL into a Pants monorepo so that .pkl source files are first-class build targets. The plugin resolves the pkl binary automatically (system-first with download fallback) and uses it to:
- Validate PKL files compile cleanly (
pants lintviapkl eval) - Format PKL files in-place or check formatting in CI (
pants fmt/pants lintviapkl format) - Run tests written with
pkl:test(pants test) - Package PKL modules into JSON, YAML, XML, and other formats (
pants package) - Suggest BUILD targets automatically for new
.pklfiles (pants tailor) - Infer dependencies between
.pklfiles so you never have to list them by hand - Resolve external packages from
PklProject.deps.json(vendored or downloaded)
Quick start
- Copy
pants-plugins/pkl/into your repository - Configure
pants.toml:
[GLOBAL]
pants_version = "2.31.0"
pythonpath = ["%(buildroot)s/pants-plugins"]
backend_packages = [
"pants.backend.plugin_development",
"pkl",
"pkl.goals",
"pkl.lint.eval_check",
"pkl.lint.fmt",
]
[source]
root_patterns = ["pants-plugins", "/"]
[python]
enable_resolves = true
[python.resolves]
pants-plugins = "pants-plugins/lock.txt"
[python.resolves_to_interpreter_constraints]
pants-plugins = ["==3.11.*"]
- Run
pants tailorto auto-generate BUILD targets, then use Pants as normal:
pants lint src:: # validate + format check
pants fmt src:: # format in-place
pants test src:: # run pkl tests
pants package src:pkg # evaluate to JSON/YAML/etc
Documentation
See docs/index.md for the full reference, including:
- Prerequisites
- Installation
- Architecture
- Backends
- Configuration (
[pkl],[pkl-fmt],[pkl-eval-check],[pkl-test-runner]) - Target types (
pkl_source,pkl_sources,pkl_test,pkl_tests,pkl_package) - Goals (lint, fmt, test, package, tailor, dependencies)
- Dependency inference
- External packages (auto/vendored/download modes)
- PKL binary resolution (system-first vs download-only)
- Limitations
- Troubleshooting
PKL version requirements
| Feature | Minimum PKL version |
|---|---|
Core (test, lint, package, dep inference) |
0.27.0 |
pants fmt (pkl format) |
0.30.0 |
| Default / recommended | 0.31.0 |
License
See LICENSE.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pants_plugin_pkl-1.0.1.tar.gz.
File metadata
- Download URL: pants_plugin_pkl-1.0.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2d826b31355a95c6a60e2cebd84ed5e0cecf4d8a4cf5719cc6aca90422ef9ab
|
|
| MD5 |
d10963e7ed2c3c0a32b05653538aee5e
|
|
| BLAKE2b-256 |
57dcf1e7d87421687cdefe7f76e4bd525bfbe851eed16a13899831ddee2899c9
|
Provenance
The following attestation bundles were made for pants_plugin_pkl-1.0.1.tar.gz:
Publisher:
release.yml on Drafteame/pants-plugin-pkl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pants_plugin_pkl-1.0.1.tar.gz -
Subject digest:
c2d826b31355a95c6a60e2cebd84ed5e0cecf4d8a4cf5719cc6aca90422ef9ab - Sigstore transparency entry: 1166415986
- Sigstore integration time:
-
Permalink:
Drafteame/pants-plugin-pkl@ac86338ed67ec819ea07b55b275d030a334ae7fc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Drafteame
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac86338ed67ec819ea07b55b275d030a334ae7fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file pants_plugin_pkl-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pants_plugin_pkl-1.0.1-py3-none-any.whl
- Upload date:
- Size: 61.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f22586a9cec8ca6ab447fc8a712611bbdded23c492d4a5df849af040e24a63ca
|
|
| MD5 |
124b2d3ec255f7e975f8c5d784f68e32
|
|
| BLAKE2b-256 |
c07709df38a55620fc659dbf0e7a9c28e0021fe0da3f952b3b617623ead7ae6f
|
Provenance
The following attestation bundles were made for pants_plugin_pkl-1.0.1-py3-none-any.whl:
Publisher:
release.yml on Drafteame/pants-plugin-pkl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pants_plugin_pkl-1.0.1-py3-none-any.whl -
Subject digest:
f22586a9cec8ca6ab447fc8a712611bbdded23c492d4a5df849af040e24a63ca - Sigstore transparency entry: 1166416031
- Sigstore integration time:
-
Permalink:
Drafteame/pants-plugin-pkl@ac86338ed67ec819ea07b55b275d030a334ae7fc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Drafteame
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac86338ed67ec819ea07b55b275d030a334ae7fc -
Trigger Event:
push
-
Statement type: