├── packages ├── com.github.actions │ ├── VERSION.txt │ ├── PklProject.deps.json │ ├── internal │ │ └── util.pkl │ ├── PklProject │ └── actions │ │ ├── first-interaction │ │ ├── v1 │ │ │ └── FirstInteraction.pkl │ │ └── v3 │ │ │ └── FirstInteraction.pkl │ │ ├── upload-pages-artifact │ │ ├── v3 │ │ │ └── UploadPagesArtifact.pkl │ │ └── v4 │ │ │ └── UploadPagesArtifact.pkl │ │ └── cache │ │ └── save │ │ └── v4 │ │ └── CacheSave.pkl ├── pkl.csv │ ├── PklProject.deps.json │ └── PklProject ├── pkl.lua │ ├── PklProject.deps.json │ ├── tests │ │ └── fixtures │ │ │ ├── comment.lua │ │ │ └── sample.lua │ └── PklProject ├── pkl.tar │ ├── PklProject.deps.json │ ├── examples │ │ ├── test_examples.sh │ │ ├── archive.ustar.pkl │ │ └── archive.pkl │ └── PklProject ├── icalendar │ ├── PklProject.deps.json │ ├── PklProject │ └── type │ │ ├── DateTime.pkl │ │ └── Date.pkl ├── pkl.table │ ├── PklProject.deps.json │ └── PklProject ├── pkl.toml │ ├── PklProject.deps.json │ ├── PklProject │ ├── tests │ │ └── toml.pkl │ └── examples │ │ ├── converters.pkl │ │ └── dates.pkl ├── com.circleci.v2 │ ├── PklProject.deps.json │ ├── PklProject │ ├── tests │ │ └── Config.pkl │ └── examples │ │ └── concurrent_workflow.pkl ├── io.prometheus │ ├── PklProject.deps.json │ ├── tests │ │ ├── configuration.pkl-expected.pcf │ │ ├── rule.pkl-expected.pcf │ │ ├── rule.pkl │ │ └── configuration.pkl │ ├── PklProject │ ├── examples │ │ ├── configuration.pkl │ │ └── rule.pkl │ └── PrometheusObject.pkl ├── org.apache.spark │ ├── PklProject.deps.json │ ├── tests │ │ ├── PropertiesBase.pkl-expected.pcf │ │ ├── utils.pkl-expected.pcf │ │ └── PropertiesBase.pkl │ ├── PklProject │ └── PropertiesBase.pkl ├── org.openapis.v3 │ ├── PklProject.deps.json │ ├── PklProject │ ├── License.pkl │ ├── tests │ │ ├── Document.pkl │ │ └── expressions.pkl │ ├── Contact.pkl │ ├── ExternalDocs.pkl │ ├── examples │ │ └── extension-example.pkl │ ├── Tag.pkl │ ├── Reference.pkl │ ├── RequestBody.pkl │ ├── Extension.pkl │ ├── Server.pkl │ ├── Security.pkl │ ├── Example.pkl │ ├── Header.pkl │ └── ServerVariable.pkl ├── com.github.dependabot │ ├── PklProject.deps.json │ ├── tests │ │ ├── examples.pkl-expected.pcf │ │ └── examples.pkl │ └── PklProject ├── pkl.experimental.net │ ├── PklProject.deps.json │ ├── PklProject │ └── tests │ │ └── u128.pkl-expected.pcf ├── pkl.experimental.uri │ ├── PklProject.deps.json │ └── PklProject ├── io.github.typesafegithub │ ├── PklProject.deps.json │ ├── PklProject │ └── ActionTypes.pkl ├── pkl.experimental.syntax │ ├── PklProject.deps.json │ ├── tests │ │ ├── ObjectBodyNode.pkl-expected.pcf │ │ ├── ExpressionNode.pkl-expected.pcf │ │ ├── ClassNode.pkl │ │ └── ModuleNode.pkl-expected.pcf │ ├── PklProject │ ├── TypeAnnotationNode.pkl │ ├── QualifiedIdentifierNode.pkl │ ├── AnnotationNode.pkl │ ├── ParameterNode.pkl │ └── Node.pkl ├── pkl.experimental.deepToTyped │ ├── PklProject.deps.json │ └── PklProject ├── k8s.contrib │ ├── tests │ │ └── fixtures │ │ │ ├── custom.yml │ │ │ ├── multipleVersions.yml │ │ │ ├── datasizes.yml │ │ │ ├── glusterfs.yml │ │ │ └── CustomType.pkl │ ├── PklProject.deps.json │ └── PklProject ├── com.influxdata.telegraf │ ├── PklProject.deps.json │ ├── plugins │ │ ├── serializers │ │ │ ├── OutputDataFormat.pkl │ │ │ └── JsonOutputDataFormat.pkl │ │ ├── parsers │ │ │ └── InputDataFormat.pkl │ │ ├── outputs │ │ │ └── DiscardOutput.pkl │ │ ├── processors │ │ │ ├── Processor.pkl │ │ │ └── StarlarkProcessor.pkl │ │ └── inputs │ │ │ ├── SolrInput.pkl │ │ │ ├── CpuInput.pkl │ │ │ ├── DiskInput.pkl │ │ │ ├── NetInput.pkl │ │ │ ├── FileInput.pkl │ │ │ ├── OpenTelemetry.pkl │ │ │ └── Input.pkl │ ├── PklProject │ ├── tests │ │ └── Telegraf.pkl │ ├── Processors.pkl │ └── examples │ │ ├── InputJolokiaAgent.pkl │ │ ├── opentelemetry-output.pkl │ │ ├── simple.pkl │ │ └── x509CertInput.pkl ├── org.openapis.v3.contrib │ ├── PklProject.deps.json │ ├── tests │ │ └── fixtures │ │ │ └── SelfReference.pkl │ ├── PklProject │ └── examples │ │ └── Finch.pkl ├── org.json_schema │ ├── PklProject.deps.json │ ├── tests │ │ ├── JsonSchema.pkl-expected.pcf │ │ └── JsonSchema.pkl │ ├── PklProject │ └── examples │ │ └── basic.pkl ├── pkl.experimental.structuredRead │ ├── PklProject.deps.json │ ├── tests │ │ ├── dynamicType.pkl-expected.pcf │ │ └── fixtures │ │ │ └── TestStructure.pkl │ ├── PklProject │ └── examples │ │ ├── envVars │ │ └── envVars.pkl │ │ ├── https │ │ └── https.pkl │ │ └── helmStyle │ │ └── chart.pkl ├── k8s.contrib.appEnvCluster │ ├── PklProject.deps.json │ └── PklProject ├── pkl.pipe │ ├── examples │ │ ├── k8s_deployment.yaml │ │ ├── k8s_service_and_pod.yaml │ │ ├── k8s_deployment_images.pkl │ │ ├── k8s_name_and_kind.pkl │ │ └── github_repos_stars.pkl │ ├── PklProject.deps.json │ ├── tests │ │ ├── examples.pkl │ │ └── examples.pkl-expected.pcf │ ├── PklProject │ ├── kubeval.pkl │ └── json.pkl ├── k8s.contrib.crd │ ├── tests │ │ ├── SchemaGenerator.pkl-expected.pcf │ │ └── SchemaGenerator.pkl │ ├── PklProject │ └── PklProject.deps.json ├── org.json_schema.contrib │ ├── PklProject.deps.json │ ├── internal │ │ └── Type.pkl │ ├── PklProject │ └── tests │ │ └── TypesGenerator.pkl-expected.pcf └── com.github.actions.contrib │ ├── PklProject.deps.json │ └── PklProject ├── .mailmap ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── .gitignore ├── settings-gradle.lockfile ├── .github ├── dependabot.yml ├── PklProject ├── workflows │ ├── test_report.yml │ ├── __lockfile__.yml │ └── build.yml └── PklProject.deps.json ├── .gitattributes ├── settings.gradle.kts ├── MAINTAINERS.adoc ├── scripts ├── generate-github.sh ├── actionTypes │ └── actions │ │ ├── first-interaction@v3.pkl │ │ ├── upload-pages-artifact@v4.pkl │ │ ├── setup-go@v6.pkl │ │ ├── download-artifact@v6.pkl │ │ ├── labeler@v6.pkl │ │ ├── github-script@v7.pkl │ │ └── setup-dotnet@v5.pkl ├── PklProject └── PklProject.deps.json ├── SECURITY.adoc ├── DEVELOPMENT.adoc └── README.adoc /packages/com.github.actions/VERSION.txt: -------------------------------------------------------------------------------- 1 | 1.3.0 2 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Jen Basch <421772+HT154@users.noreply.github.com> 2 | Jen Basch 3 | -------------------------------------------------------------------------------- /packages/pkl.csv/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.lua/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.tar/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/icalendar/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.table/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.toml/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apple/pkl-pantry/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /packages/com.circleci.v2/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/io.prometheus/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/org.apache.spark/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/com.github.actions/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/com.github.dependabot/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.experimental.net/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.experimental.uri/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/io.github.typesafegithub/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/pkl.experimental.deepToTyped/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": {} 4 | } 5 | -------------------------------------------------------------------------------- /packages/k8s.contrib/tests/fixtures/custom.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Custom 3 | metadata: 4 | name: my-custom-type 5 | spec: 6 | field1: foo 7 | field2: bar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | 3 | # Ignore Gradle project-specific cache directory 4 | .gradle 5 | 6 | # Ignore Gradle build output directory 7 | build 8 | 9 | .DS_Store 10 | 11 | .out/ 12 | 13 | .vscode/ 14 | .pkl-lsp/ -------------------------------------------------------------------------------- /settings-gradle.lockfile: -------------------------------------------------------------------------------- 1 | # This is a Gradle generated file for dependency locking. 2 | # Manual edits can break the build and are not advised. 3 | # This file is expected to be part of source control. 4 | empty=incomingCatalogForLibs0 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | ignore: 6 | - dependency-name: '*' 7 | update-types: 8 | - version-update:semver-major 9 | schedule: 10 | interval: weekly 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" 10 | } 11 | 12 | rootProject.name = "pkl-pantry" 13 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.2", 7 | "path": "../pkl.toml" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/org.openapis.v3.contrib/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/org.openapis.v3@2": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.openapis.v3@2.2.0", 7 | "path": "../org.openapis.v3" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/org.json_schema/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3", 7 | "path": "../pkl.experimental.uri" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/pkl.lua/tests/fixtures/comment.lua: -------------------------------------------------------------------------------- 1 | -- This is a copy of the sample file from the Parser doc comment 2 | --[[ 3 | This file has a header comment. 4 | ]] 5 | foo="bar" 6 | count=2 7 | -- line comment here 8 | enable=true 9 | frob=nil 10 | ports={80, 443} 11 | ips={ 12 | localhost = "127.0.0.1"; 13 | ["example.com"] = "93.184.215.14"; 14 | } 15 | _ENV[" "]="space" -------------------------------------------------------------------------------- /packages/pkl.tar/examples/test_examples.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash -e 2 | 3 | # test the files archive.*.pkl in this directory 4 | # evaluate each and ask tar to list the result's contents 5 | 6 | cd "$(dirname "$0")" 7 | 8 | for file in archive.*.pkl; do 9 | echo "+ pkl eval $file | tar tv" 10 | pkl eval $file | tar tv -v 11 | echo 12 | done 13 | 14 | echo "PASS" 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=df67a32e86e3276d011735facb1535f64d0d88df84fa87521e90becc2d735444 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 7 | "path": "../pkl.experimental.deepToTyped" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/k8s.contrib.appEnvCluster/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", 7 | "checksums": { 8 | "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /MAINTAINERS.adoc: -------------------------------------------------------------------------------- 1 | = MAINTAINERS 2 | 3 | This page lists all active Maintainers of this repository. 4 | 5 | See link:CONTRIBUTING.adoc[] for general contribution guidelines. 6 | 7 | == Maintainers (in alphabetical order) 8 | 9 | * https://github.com/bioball[Daniel Chao] 10 | * https://github.com/stackoverflow[Islon Scherer] 11 | * https://github.com/HT154[Jen Basch] 12 | * https://github.com/holzensp[Philip Hölzenspies] 13 | -------------------------------------------------------------------------------- /packages/org.apache.spark/tests/PropertiesBase.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["rendering properties"] { 3 | """ 4 | spark.core.numbers = 5 5 | spark.driver.something = some driver setting 6 | spark.executor.something = some executor setting 7 | spark.shards.1.setting.this-node.memory = 5g 8 | spark.kubernetes.some.type.of.memory = 10Gi 9 | spark.some.type.of.duration = 5min 10 | 11 | """ 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /scripts/generate-github.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Generates actions and `catalog.pkl` files 3 | 4 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" 5 | 6 | pkl eval --project-dir "$SCRIPT_DIR" "$SCRIPT_DIR"/generate-github-actions.pkl -m "$SCRIPT_DIR"/.. 7 | pkl eval --project-dir "$SCRIPT_DIR" "$SCRIPT_DIR"/generate-github-catalog.pkl -m "$SCRIPT_DIR"/.. 8 | 9 | cd "$SCRIPT_DIR/.." 10 | 11 | ./gradlew spotlessApply 12 | -------------------------------------------------------------------------------- /packages/io.prometheus/tests/configuration.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["basic configuration"] { 3 | """ 4 | global: 5 | scrape_timeout: 10s 6 | scrape_configs: 7 | - job_name: my-job 8 | kubernetes_sd_configs: 9 | - role: pod 10 | relabel_configs: 11 | - regex: .*? 12 | remote_write: 13 | - url: https://example.com/remote_write 14 | sigv4: 15 | region: us-west-2 16 | 17 | """ 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/k8s.contrib/tests/fixtures/multipleVersions.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: foo.bar.baz 5 | --- 6 | apiVersion: apiextensions.k8s.io/v1 7 | kind: CustomResourceDefinition 8 | metadata: 9 | name: foo.bar.baz 10 | --- 11 | apiVersion: apiextensions.k8s.io/v1beta1 12 | kind: CustomResourceDefinition 13 | metadata: 14 | name: foo.bar.biz 15 | --- 16 | apiVersion: apiextensions.k8s.io/v1 17 | kind: CustomResourceDefinition 18 | metadata: 19 | name: foo.bar.qux -------------------------------------------------------------------------------- /packages/com.github.dependabot/tests/examples.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["basic.pkl"] { 3 | """ 4 | version: 2 5 | updates: 6 | - package-ecosystem: npm 7 | directory: / 8 | schedule: 9 | interval: daily 10 | - package-ecosystem: docker 11 | directory: / 12 | schedule: 13 | interval: weekly 14 | - package-ecosystem: github-actions 15 | directory: / 16 | schedule: 17 | interval: weekly 18 | 19 | """ 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/pkl.pipe/examples/k8s_deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: nginx-deployment 6 | labels: 7 | app: nginx 8 | spec: 9 | replicas: 3 10 | selector: 11 | matchLabels: 12 | app: nginx 13 | template: 14 | metadata: 15 | labels: 16 | app: nginx 17 | spec: 18 | containers: 19 | - name: nginx 20 | image: nginx:1.14.2 21 | ports: 22 | - containerPort: 80 23 | - name: splunk 24 | image: splunkforwarder:1234 25 | -------------------------------------------------------------------------------- /packages/k8s.contrib.crd/tests/SchemaGenerator.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["schema generation"] { 3 | """ 4 | module com.bar.k8sSchema 5 | 6 | import "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1#/K8sResource.pkl" 7 | 8 | /// Resource modules keyed by `kind` and `apiVersion`. 9 | resourceTemplates: Mapping> = new { 10 | ["Foo"] { 11 | ["bar.com/v1"] = import("v1/Foo") 12 | } 13 | ["Qux"] { 14 | ["baz.bar.com/v1"] = import("baz/v1/Qux") 15 | } 16 | } 17 | 18 | """ 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/pkl.pipe/examples/k8s_service_and_pod.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx 6 | labels: 7 | app.kubernetes.io/name: proxy 8 | spec: 9 | containers: 10 | - name: nginx 11 | image: nginx:stable 12 | ports: 13 | - containerPort: 80 14 | name: http-web-svc 15 | 16 | --- 17 | apiVersion: v1 18 | kind: Service 19 | metadata: 20 | name: nginx-service 21 | spec: 22 | selector: 23 | app.kubernetes.io/name: proxy 24 | ports: 25 | - name: name-of-service-port 26 | protocol: TCP 27 | port: 80 28 | targetPort: http-web-svc 29 | -------------------------------------------------------------------------------- /packages/org.apache.spark/tests/utils.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["convertIndexedProperty"] { 3 | Map("foo.bar.1.biz.11", "eleven", "foo.bar.1.biz.12", "twelve", "foo.bar.2.biz.22", "two") 4 | Map("foo.bar.1.biz", 1, "foo.bar.2.biz", 2) 5 | } 6 | ["flattenMapKeys"] { 7 | Map(List(".1", ".11"), "eleven", List(".1", ".12"), "twelve", List(".2", ".22"), "two") 8 | } 9 | ["convertProperty"] { 10 | Map("foo.bar.baz", 1) 11 | Map("foo.env.FOO", "foo", "foo.env.BAR", "bar") 12 | Map("foo.env.FOO.buz.BAR", "bar") 13 | Map("spark.kubernetes.baz", "5Gi") 14 | Map("spark.memory", "5g") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/k8s.contrib/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", 7 | "checksums": { 8 | "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" 9 | } 10 | }, 11 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": { 12 | "type": "local", 13 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3", 14 | "path": "../pkl.experimental.uri" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/pkl.lua/tests/fixtures/sample.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This is an example config file written in Lua. 3 | It consists of key/value pairs and only literals, no expressions. 4 | ]] 5 | greeting="Hello, world!" 6 | snippet=[=[ 7 | Long Lua strings can be written inside brackets like this: [[ 8 | This is a multiline string. 9 | It ends at the close double-bracket.]] 10 | ]=] 11 | hex_floats={ 12 | 0x10.0, 13 | 0x0.fffff, 14 | -0x32p3, 15 | } 16 | tableKeys={ 17 | identifier = true; 18 | ["string"] = "yes"; 19 | [42] = "the meaning of life"; 20 | [3.14159] = "pi"; 21 | [true] = "very true"; 22 | [{1, 2, 3}] = "even tables can be keys"; 23 | -- but nil and NaN cannot 24 | } 25 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/tests/dynamicType.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["dynamic types"] { 3 | new { 4 | TestInput { 5 | Nested = "A new string" 6 | } 7 | } 8 | } 9 | ["nested dynamic types"] { 10 | new { 11 | Layer1 { 12 | Layer2 { 13 | Layer3 { 14 | TestValue = 999 15 | DefaultString = "Still here" 16 | } 17 | TestIntType = 32 18 | } 19 | DefaultInt = 42 20 | } 21 | } 22 | } 23 | ["incorrect dynamic value"] { 24 | "Error processing property in pkl.experimental.structuredRead.tests.dynamicType#NestedDynamic: \t'Layer1.Layer2.TestIntType': Unable to coerce 'String' into type Int" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/k8s.contrib/tests/fixtures/datasizes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: various-datasizes 5 | spec: 6 | containers: 7 | - name: kilobytes 8 | resources: 9 | requests: 10 | memory: 1k 11 | 12 | - name: kebibytes 13 | resources: 14 | requests: 15 | memory: 1Ki 16 | 17 | - name: mebibytes 18 | resources: 19 | requests: 20 | memory: 1Mi 21 | 22 | - name: exbibytes 23 | resources: 24 | requests: 25 | memory: 1Ei 26 | 27 | - name: exabytes 28 | resources: 29 | requests: 30 | memory: 1E 31 | 32 | - name: fractional-gigabytes 33 | resources: 34 | requests: 35 | memory: 0.5Gi -------------------------------------------------------------------------------- /packages/io.prometheus/tests/rule.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["basic rule"] { 3 | """ 4 | groups: 5 | - name: alerting_rules 6 | interval: 5m 7 | labels: 8 | group: alerts 9 | rules: 10 | - alert: HighRequestLatency 11 | expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 12 | for: 10m 13 | labels: 14 | prod: true 15 | priority: 1 16 | severity: page 17 | annotations: 18 | summary: High request latency 19 | - name: recording_rules 20 | interval: 10h 21 | labels: 22 | group: recording 23 | rules: 24 | - record: job:http_inprogress_requests:sum 25 | expr: sum by (job) (http_inprogress_requests) 26 | 27 | """ 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/tests/ObjectBodyNode.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["for generator"] { 3 | """ 4 | { 5 | for (person in people) { 6 | person.name 7 | } 8 | } 9 | """ 10 | """ 11 | { 12 | for (person: Person in people) { 13 | person.name 14 | } 15 | } 16 | """ 17 | """ 18 | { 19 | for (personIndex, person in people) { 20 | person.name 21 | } 22 | } 23 | """ 24 | """ 25 | { 26 | for (personIndex: Int, person: Person in people) { 27 | person.name 28 | } 29 | } 30 | """ 31 | } 32 | ["when generator"] { 33 | """ 34 | { 35 | when (test) { 36 | conditionalProperty = true 37 | } 38 | } 39 | """ 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SECURITY.adoc: -------------------------------------------------------------------------------- 1 | = Security 2 | 3 | For the protection of our community, the Pkl team does not disclose, discuss, or confirm security issues until our investigation is complete and any necessary updates are generally available. 4 | 5 | == Reporting a security vulnerability 6 | 7 | If you have discovered a security vulnerability within the Pkl Pantry project, please report it to us. 8 | We welcome reports from everyone, including security researchers, developers, and users. 9 | 10 | Security vulnerabilities may be reported on the link:https://security.apple.com/submit[Report a vulnerability] form. 11 | When submitting a vulnerability, select "Apple Devices and Software" as the affected platform, and "Open Source" as the affected area. 12 | 13 | For more information, see https://pkl-lang.org/security.html. 14 | -------------------------------------------------------------------------------- /packages/org.json_schema/tests/JsonSchema.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["basic.json"] { 3 | """ 4 | { 5 | "$id": "https://example.com/person.schema.json", 6 | "$schema": "https://json-schema.org/draft/2020-12/schema", 7 | "title": "Person", 8 | "type": "object", 9 | "properties": { 10 | "firstName": { 11 | "description": "The person's first name", 12 | "type": "string" 13 | }, 14 | "lastName": { 15 | "description": "The person's last name", 16 | "type": "string" 17 | }, 18 | "age": { 19 | "description": "Age in years which must be equal to or greater than zero.", 20 | "type": "integer", 21 | "minimum": 0 22 | } 23 | } 24 | } 25 | 26 | """ 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/k8s.contrib/tests/fixtures/glusterfs.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Endpoints 3 | metadata: 4 | name: glusterfs-cluster 5 | subsets: 6 | - addresses: 7 | - ip: 10.240.106.152 8 | ports: 9 | - port: 1 10 | - addresses: 11 | - ip: 10.240.79.157 12 | ports: 13 | - port: 1 14 | --- 15 | apiVersion: v1 16 | kind: Pod 17 | metadata: 18 | name: glusterfs 19 | spec: 20 | containers: 21 | - name: glusterfs 22 | image: nginx 23 | volumeMounts: 24 | - mountPath: "/mnt/glusterfs" 25 | name: glusterfsvol 26 | volumes: 27 | - name: glusterfsvol 28 | glusterfs: 29 | endpoints: glusterfs-cluster 30 | path: kube_vol 31 | readOnly: true 32 | --- 33 | apiVersion: v1 34 | kind: Service 35 | metadata: 36 | name: glusterfs-cluster 37 | spec: 38 | ports: 39 | - port: 1 -------------------------------------------------------------------------------- /packages/org.json_schema.contrib/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.1.0", 7 | "path": "../pkl.experimental.syntax" 8 | }, 9 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": { 10 | "type": "local", 11 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3", 12 | "path": "../pkl.experimental.uri" 13 | }, 14 | "package://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1": { 15 | "type": "local", 16 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.1.0", 17 | "path": "../org.json_schema" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/pkl.pipe/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/k8s.contrib@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/k8s.contrib@1.0.3", 7 | "path": "../k8s.contrib" 8 | }, 9 | "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { 10 | "type": "remote", 11 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1", 12 | "checksums": { 13 | "sha256": "75c6d66d94c335417a3c502e107aaeadf7a60b4e1d34b2c979afe11193205a1a" 14 | } 15 | }, 16 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": { 17 | "type": "local", 18 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3", 19 | "path": "../pkl.experimental.uri" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DEVELOPMENT.adoc: -------------------------------------------------------------------------------- 1 | = Development 2 | 3 | == Generating actions within `com.github.actions` 4 | 5 | The link:scripts/generate-github.sh[generate-github.sh] script generates all actions within the link:packages/com.github.actions/actions/[] subdirectory. 6 | The script fetches action types from https://github.com/typesafegithub/github-actions-typing-catalog[github-actions-typing-catalog] if available. 7 | 8 | Sometimes, the latest version isn't available in that catalog. 9 | In these cases, the types for that action must be added directly to link:scripts/actionTypes/[]. 10 | To do so: 11 | 12 | 1. Move the action out of `coreActions` and into `allCoreVersions`, with that version pinned 13 | 2. Add a typing for this module within link:scripts/actionTypes/actions/[], which amends `amends "@io.github.typesafegithub/ActionTypes.pkl"`. 14 | 3. Re-run the link:scripts/generate-github.sh[generate script]. 15 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | pkl = "0.30.+" 3 | kotlin = "2.2.20" 4 | junit = "5.+" 5 | spotless = "6.25.0" 6 | junitPlatformLauncher = "1.+" 7 | 8 | [libraries] 9 | junitEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } 10 | junitParams = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junit" } 11 | junitPlatformLauncher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junitPlatformLauncher" } 12 | pklCore = { group = "org.pkl-lang", name = "pkl-core", version.ref = "pkl" } 13 | pklParser = { group = "org.pkl-lang", name = "pkl-parser", version.ref = "pkl" } 14 | spotlessPlugin = { group = "com.diffplug.spotless", name = "spotless-plugin-gradle", version.ref = "spotless"} 15 | pklFormatter = { group = "org.pkl-lang", name = "pkl-formatter", version.ref = "pkl" } 16 | 17 | [plugins] 18 | pkl = { id = "org.pkl-lang", version.ref = "pkl" } 19 | -------------------------------------------------------------------------------- /packages/pkl.tar/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../basePklProject.pkl" 17 | 18 | package { 19 | version = "0.1.0" 20 | } 21 | -------------------------------------------------------------------------------- /packages/pkl.experimental.uri/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../basePklProject.pkl" 17 | 18 | package { 19 | version = "1.0.3" 20 | } 21 | -------------------------------------------------------------------------------- /packages/pkl.tar/examples/archive.ustar.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Test UStar archives. 17 | amends "archive.pkl" 18 | 19 | renderer { 20 | pax = null 21 | } 22 | -------------------------------------------------------------------------------- /packages/org.openapis.v3.contrib/tests/fixtures/SelfReference.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module SelfReference 17 | 18 | import "SelfReference.pkl" 19 | 20 | myself: SelfReference 21 | -------------------------------------------------------------------------------- /packages/io.github.typesafegithub/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Typings for GitHub Actions 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.0.0" 21 | } 22 | -------------------------------------------------------------------------------- /packages/pkl.toml/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A [TOML](https://toml.io/en/) [Renderer]. 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.0.2" 21 | } 22 | -------------------------------------------------------------------------------- /packages/pkl.lua/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A parser and renderer for a subset of [Lua](https://www.lua.org). 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.1.1" 21 | } 22 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Modules for describing [OpenAPI](https://www.openapis.org/) v3.x 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "2.2.0" 21 | } 22 | -------------------------------------------------------------------------------- /packages/pkl.experimental.net/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Experimental library for handling network (IP and MAC) addresses. 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.2.1" 21 | } 22 | -------------------------------------------------------------------------------- /packages/com.circleci.v2/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Templates for defining [CircleCI](https://circleci.com) configuration. 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.7.0" 21 | } 22 | -------------------------------------------------------------------------------- /packages/com.github.dependabot/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Templates for managing [Dependabot](https://github.com/dependabot). 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.0.0" 21 | } 22 | -------------------------------------------------------------------------------- /packages/io.prometheus/tests/rule.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module io.prometheus.tests.rule 17 | 18 | amends "pkl:test" 19 | 20 | examples { 21 | ["basic rule"] { 22 | import("../examples/rule.pkl").output.text 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/pkl.csv/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A [RFC4180](https://www.ietf.org/rfc/rfc4180.txt) compliant CSV [Renderer] and [Parser]. 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.1.0" 21 | } 22 | -------------------------------------------------------------------------------- /packages/pkl.experimental.deepToTyped/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// An experimental module that does a deep-conversion of [Dynamic] into [Typed]. 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.1.1" 21 | } 22 | -------------------------------------------------------------------------------- /packages/org.openapis.v3.contrib/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../basePklProject.pkl" 17 | 18 | package { 19 | version = "1.1.0" 20 | } 21 | 22 | dependencies { 23 | ["openapi"] = import("../org.openapis.v3/PklProject") 24 | } 25 | -------------------------------------------------------------------------------- /packages/org.openapis.v3.contrib/examples/Finch.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module darwins.Finch 17 | 18 | /// What is this beak good for? 19 | beakIsGoodFor: "nuts"|"fruits"|"insects" 20 | 21 | output { 22 | renderer = new JsonRenderer {} 23 | } 24 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Experimental Pkl syntax library 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.1.0" 21 | apiTests = import*("tests/*.pkl").keys.toListing() 22 | } 23 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = Pkl Pantry 2 | 3 | This is a monorepo of packages that are maintained and published by the Pkl team. 4 | 5 | == Using packages 6 | 7 | Packages within this repository are published as `package://pkg.pkl-lang.org/pkl-pantry/@`. 8 | 9 | === Direct imports 10 | 11 | Modules from package can be imported directly. For example, the below line imports module `toml.pkl` from package link:packages/pkl.toml/[`pkl.toml`] at version `1.0.0`: 12 | 13 | [source,pkl] 14 | ---- 15 | import "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0#/toml.pkl" 16 | ---- 17 | 18 | === In a project 19 | 20 | If using a link:https://pkl-lang.org/main/current/language-reference/index.html#projects[project], add a package as a dependency: 21 | 22 | [source,pkl] 23 | ---- 24 | amends "pkl:Project" 25 | 26 | dependencies { 27 | ["toml"] { uri = "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0" } 28 | } 29 | ---- 30 | 31 | == Documentation 32 | 33 | The documentation for all packages published here can be found in our 34 | link:https://pkl-lang.org/package-docs[Package Docs] website. 35 | -------------------------------------------------------------------------------- /packages/com.github.actions/internal/util.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module com.github.actions.internal.util 17 | 18 | function isExclusive(a: Any, b: Any) = 19 | if (a != null) 20 | b == null 21 | else if (b != null) 22 | a == null 23 | else 24 | false 25 | -------------------------------------------------------------------------------- /packages/io.prometheus/tests/configuration.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module io.prometheus.tests.configuration 17 | 18 | amends "pkl:test" 19 | 20 | examples { 21 | ["basic configuration"] { 22 | import("../examples/configuration.pkl").output.text 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/icalendar/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Library for working with iCalendar data. 17 | /// 18 | /// Implements [RFC 5545](https://datatracker.ietf.org/doc/html/rfc5545). 19 | amends "../basePklProject.pkl" 20 | 21 | package { 22 | version = "0.1.1" 23 | } 24 | -------------------------------------------------------------------------------- /packages/io.prometheus/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Templates for configuring [Prometheus](https://prometheus.io), 17 | /// an open-source systems monitoring and alerting toolkit. 18 | amends "../basePklProject.pkl" 19 | 20 | package { 21 | version = "1.4.0" 22 | } 23 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends ".../basePklProject.pkl" 17 | 18 | 19 | package { 20 | version = "1.0.4" 21 | } 22 | 23 | dependencies { 24 | ["deepToTyped"] = import("../pkl.experimental.deepToTyped/PklProject") 25 | } 26 | -------------------------------------------------------------------------------- /packages/org.json_schema.contrib/internal/Type.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.json_schema.contrib.internal.Type 17 | 18 | import "@jsonschema/JsonSchema.pkl" 19 | import "Type.pkl" 20 | 21 | moduleName: String 22 | 23 | name: String 24 | 25 | typealias TypeNames = Map 26 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/TypeAnnotationNode.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.experimental.syntax.TypeAnnotationNode 17 | 18 | extends "Node.pkl" 19 | 20 | import "TypeNode.pkl" 21 | 22 | type: TypeNode 23 | 24 | function render(currentIndent: String) = ": \(type.render(currentIndent))" 25 | -------------------------------------------------------------------------------- /packages/k8s.contrib/tests/fixtures/CustomType.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module CustomType 17 | 18 | extends "@k8s/K8sResource.pkl" 19 | 20 | fixed apiVersion = "v1" 21 | 22 | fixed kind = "Custom" 23 | 24 | spec: CustomSpec? 25 | 26 | class CustomSpec { 27 | field1: String? 28 | 29 | field2: String? 30 | } -------------------------------------------------------------------------------- /packages/pkl.table/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// [TableRenderer] generates pretty human-readable and markdown-compatible tables! 17 | amends "../basePklProject.pkl" 18 | 19 | package { 20 | version = "1.1.0" 21 | description = "Generates pretty human-readable, markdown-compatible, and HTML tables." 22 | } 23 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/License.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// License information for the exposed API. 17 | module org.openapis.v3.License 18 | 19 | /// The license name used for the API. 20 | name: String 21 | 22 | /// A URL to the license used for the API. 23 | /// 24 | /// MUST be in the format of a URL. 25 | url: Uri? 26 | -------------------------------------------------------------------------------- /.github/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "pkl:Project" 17 | 18 | dependencies { 19 | ["pkl.impl.ghactions"] { 20 | uri = "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.1.6" 21 | } 22 | ["com.github.actions"] { uri = "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0" } 23 | } 24 | -------------------------------------------------------------------------------- /packages/com.github.actions.contrib/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 7 | "path": "../pkl.experimental.deepToTyped" 8 | }, 9 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": { 10 | "type": "local", 11 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.1.0", 12 | "path": "../pkl.experimental.syntax" 13 | }, 14 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1": { 15 | "type": "local", 16 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0", 17 | "path": "../com.github.actions" 18 | }, 19 | "package://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1": { 20 | "type": "local", 21 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1.0.0", 22 | "path": "../io.github.typesafegithub" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/first-interaction@v3.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["repo_token"] { 20 | type = "string" 21 | } 22 | ["issue_message"] { 23 | type = "string" 24 | } 25 | ["pr_message"] { 26 | type = "string" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/com.github.actions/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Templates for defining [GitHub Actions](https://github.com/features/actions) workflows. 17 | /// 18 | /// Originally defined in [pkl-gha](https://github.com/stefma/pkl-gha). 19 | amends "../basePklProject.pkl" 20 | 21 | package { 22 | version = read("VERSION.txt").text.trim() 23 | } 24 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/serializers/OutputDataFormat.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Base class for [output data formats](https://docs.influxdata.com/telegraf/v1.17/data_formats/output/). 17 | @ModuleInfo { minPklVersion = "0.25.0" } 18 | abstract module com.influxdata.telegraf.plugins.serializers.OutputDataFormat 19 | 20 | data_format: String 21 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/parsers/InputDataFormat.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Base class for [input data formats](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md). 17 | @ModuleInfo { minPklVersion = "0.25.0" } 18 | abstract module com.influxdata.telegraf.plugins.parsers.InputDataFormat 19 | 20 | data_format: String 21 | -------------------------------------------------------------------------------- /packages/k8s.contrib.appEnvCluster/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Template that captures the hierarchical pattern of Application, Environment, and Cluster. 17 | amends "../basePklProject.pkl" 18 | 19 | dependencies { 20 | ["k8s"] { 21 | uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1" 22 | } 23 | } 24 | 25 | package { 26 | version = "1.0.2" 27 | } -------------------------------------------------------------------------------- /packages/k8s.contrib/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Utilities for handling k8s configuration in Pkl. 17 | amends "../basePklProject.pkl" 18 | 19 | dependencies { 20 | ["k8s"] { 21 | uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.0.1" 22 | } 23 | ["uri"] = import("../pkl.experimental.uri/PklProject") 24 | } 25 | 26 | package { 27 | version = "1.0.3" 28 | } -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/outputs/DiscardOutput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The Discard output plugin simply drops all metrics that are sent to it. 17 | /// 18 | /// It is only meant to be used for testing purposes. 19 | @ModuleInfo { minPklVersion = "0.25.0" } 20 | module com.influxdata.telegraf.plugins.outputs.DiscardOutput 21 | 22 | extends "Output.pkl" 23 | -------------------------------------------------------------------------------- /packages/com.github.dependabot/tests/examples.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module com.github.dependabot.tests.examples 17 | 18 | amends "pkl:test" 19 | 20 | import* "../examples/*.pkl" as allExamples 21 | 22 | examples { 23 | for (filename in allExamples.keys) { 24 | [filename.drop("../examples/".length)] { 25 | allExamples[filename].output.text 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/org.json_schema/tests/JsonSchema.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.json_schema.tests.JsonSchema 17 | 18 | amends "pkl:test" 19 | 20 | local allExamples = import*("../examples/*.pkl") 21 | 22 | examples { 23 | for (example in allExamples.keys) { 24 | [example.drop(12).replaceLast("pkl", "json")] { 25 | allExamples[example].output.text 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /packages/org.openapis.v3/tests/Document.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.openapis.v3.tests.Document 17 | 18 | amends "pkl:test" 19 | 20 | local allExamples = import*("../examples/*.pkl") 21 | 22 | examples { 23 | for (example in allExamples.keys) { 24 | [example.drop("../examples/".length).dropLast(4)] { 25 | allExamples[example].output.text 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/com.circleci.v2/tests/Config.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module com.circleci.v2.tests.Config 17 | 18 | amends "pkl:test" 19 | 20 | local allExamples = import*("../examples/*.pkl") 21 | 22 | examples { 23 | for (example in allExamples.keys) { 24 | [example.drop("../examples/".length).replaceLast("pkl", "yaml")] { 25 | allExamples[example].output.text 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Templates for configuring [Telegraf](https://docs.influxdata.com/telegraf), 17 | /// a plugin-driven server agent for collecting and reporting metrics. 18 | amends "../basePklProject.pkl" 19 | 20 | dependencies { 21 | ["toml"] = import("../pkl.toml/PklProject") 22 | } 23 | 24 | package { 25 | version = "1.6.0" 26 | } 27 | -------------------------------------------------------------------------------- /packages/pkl.toml/tests/toml.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.toml.tests.toml 17 | 18 | amends "pkl:test" 19 | 20 | examples { 21 | ["basic.pkl"] { 22 | import("../examples/basic.pkl").output.text 23 | } 24 | ["converters.pkl"] { 25 | import("../examples/converters.pkl").output.text 26 | } 27 | ["dates.pkl"] { 28 | import("../examples/dates.pkl").output.text 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/upload-pages-artifact@v4.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["name"] { 20 | type = "string" 21 | } 22 | ["path"] { 23 | type = "string" 24 | } 25 | ["retention-days"] { 26 | type = "integer" 27 | } 28 | } 29 | outputs { 30 | ["artifact_id"] { 31 | type = "integer" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/tests/Telegraf.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module com.influxdata.telegraf.tests.Telegraf 17 | 18 | amends "pkl:test" 19 | 20 | local allExamples = import*("../examples/*.pkl") 21 | 22 | examples { 23 | for (name in allExamples.keys) { 24 | [name.drop("../examples".length + 1).replaceLast("pkl", "toml")] { 25 | allExamples[name].output.text 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.github/workflows/test_report.yml: -------------------------------------------------------------------------------- 1 | # Generated from Workflow.pkl. DO NOT EDIT. 2 | name: PR Test Reports 3 | 'on': 4 | workflow_run: 5 | types: 6 | - completed 7 | workflows: 8 | - Pull Request 9 | permissions: 10 | contents: read 11 | jobs: 12 | test-results: 13 | name: Test Results 14 | if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' 15 | permissions: 16 | actions: read 17 | checks: write 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Download artifacts 21 | uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 22 | with: 23 | path: artifacts 24 | name: test-results-.* 25 | name_is_regexp: true 26 | run_id: ${{ github.event.workflow_run.id }} 27 | - name: Publish test results 28 | uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2 29 | with: 30 | commit: ${{ github.event.workflow_run.head_sha }} 31 | comment_mode: 'off' 32 | files: artifacts/**/*.xml 33 | event_file: artifacts/test-results-event-file/event.json 34 | event_name: ${{ github.event.workflow_run.event }} 35 | -------------------------------------------------------------------------------- /packages/pkl.experimental.net/tests/u128.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["toString"] { 3 | "00000000000000000000000000000001" 4 | "ffffffffffffffffffffffffffffffff" 5 | "Type constraint `isBetween(0, 4294967295)` violated. Value: 4294967296" 6 | } 7 | ["and"] { 8 | "00000000000000000000000000000000" 9 | "00000000000000000000000000000000" 10 | "74ab3ef809bfce41ab38bef110efba83" 11 | "74ab3ef809bfce41ab38bef110efba83" 12 | } 13 | ["or"] { 14 | "74ab3ef809bfce41ab38bef110efba83" 15 | "74ab3ef809bfce41ab38bef110efba83" 16 | "ffffffffffffffffffffffffffffffff" 17 | "ffffffffffffffffffffffffffffffff" 18 | } 19 | ["shl"] { 20 | "00000000000000000000000000000001" 21 | "00000000000000000000000000000002" 22 | "00000000000000000000000000080000" 23 | "00000000000000000000000100000000" 24 | "00000000000000000000000200000000" 25 | "00000000000000000008000000000000" 26 | "00000000000000010000000000000000" 27 | "00000000000000020000000000000000" 28 | "00000000001000000000000000000000" 29 | } 30 | ["add"] { 31 | "00000000000000000000000000000002" 32 | "e9567df0137f9c8356717de221df7506" 33 | "74ab3ef809bfce41ab38bef110efba83" 34 | } 35 | ["seq"] { 36 | 65 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/Processors.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | open module com.influxdata.telegraf.Processors 17 | 18 | import "plugins/processors/StarlarkProcessor.pkl" 19 | 20 | /// The [starlark processor](https://github.com/influxdb/telegraf/tree/master/plugins/processors/starlark) calls 21 | /// a Starlark function for each matched metric, allowing for custom programmatic metric processing. 22 | starlark: Listing? 23 | -------------------------------------------------------------------------------- /packages/org.json_schema/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Modules for [JSON Schema](https://json-schema.org). 17 | /// 18 | /// This package includes utilities for resolving JSON Schema references, as well as generating Pkl modules from a 19 | /// JSON Schema document. 20 | amends "../basePklProject.pkl" 21 | 22 | dependencies { 23 | ["uri"] = import("../pkl.experimental.uri/PklProject") 24 | } 25 | 26 | package { 27 | version = "1.1.0" 28 | } 29 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/QualifiedIdentifierNode.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// One or more identifiers, separated by dots, e.g. `foo.bar.baz` 17 | @Unlisted 18 | module pkl.experimental.syntax.QualifiedIdentifierNode 19 | 20 | extends "Node.pkl" 21 | 22 | import "IdentifierNode.pkl" 23 | 24 | parts: Listing(!isEmpty) 25 | 26 | function render(currentIndent: String) = parts.toList().map((p) -> p.render(currentIndent)).join(".") 27 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/examples/envVars/envVars.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Example reading values from the enviroment to fill 17 | /// in a Pkl class. 18 | /// 19 | /// Try running `pkl eval envVars.pkl` 20 | module envVars 21 | import ".../structuredRead.pkl" 22 | 23 | class EnvConfig { 24 | SHELL: String? 25 | USER: String? 26 | PWD: String? 27 | LANG: String? 28 | } 29 | 30 | output { 31 | value = structuredRead.fromEnv.fill(EnvConfig) 32 | } -------------------------------------------------------------------------------- /packages/pkl.pipe/tests/examples.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.pipe.tests.examples 17 | amends "pkl:test" 18 | 19 | examples { 20 | ["k8s deployment images"] { 21 | import("../examples/k8s_deployment_images.pkl").output.text 22 | } 23 | ["k8s name and kind list"] { 24 | import("../examples/k8s_name_and_kind.pkl").output.text 25 | } 26 | ["github repos and stars"] { 27 | import("../examples/github_repos_stars.pkl").output.text 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Contact.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Contact information for the exposed API. 17 | module org.openapis.v3.Contact 18 | 19 | /// The identifying name of the contact person/organization. 20 | name: String? 21 | 22 | /// The URL pointing to the contact information. MUST be in the format of a URL. 23 | url: Uri? 24 | 25 | /// The email address of the contact person/organization. 26 | /// 27 | /// MUST be in the format of an email address. 28 | email: String? 29 | -------------------------------------------------------------------------------- /packages/k8s.contrib.crd/tests/SchemaGenerator.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module k8s.contrib.crd.tests.SchemaGenerator 17 | 18 | amends "pkl:test" 19 | 20 | import "../generate.pkl" 21 | 22 | examples { 23 | ["schema generation"] { 24 | (generate) { 25 | generateSchema = true 26 | sourceContents = read("fixtures/crds_subdomain.yaml") 27 | source = "dummy://test_uri" 28 | baseApiGroup = "bar.com" 29 | }.output.files["k8sSchema.pkl"].text 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/AnnotationNode.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.experimental.syntax.AnnotationNode 17 | 18 | extends "Node.pkl" 19 | 20 | import "QualifiedIdentifierNode.pkl" 21 | import "ObjectBodyNode.pkl" 22 | 23 | identifier: QualifiedIdentifierNode 24 | 25 | body: ObjectBodyNode? 26 | 27 | function render(currentIndent: String) = 28 | "\(currentIndent)@\(identifier.render(currentIndent))" + 29 | if (body == null) "" else " " + body.render(currentIndent) 30 | -------------------------------------------------------------------------------- /packages/com.github.actions.contrib/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../basePklProject.pkl" 17 | 18 | dependencies { 19 | ["com.github.actions"] = import("../com.github.actions/PklProject") 20 | ["io.github.typesafegithub"] = import("../io.github.typesafegithub/PklProject") 21 | ["deepToTyped"] = import("../pkl.experimental.deepToTyped/PklProject") 22 | ["syntax"] = import("../pkl.experimental.syntax/PklProject") 23 | } 24 | 25 | package { 26 | version = "1.0.4" 27 | } 28 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/ExternalDocs.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Allows referencing an external resource for extended documentation. 17 | module org.openapis.v3.ExternalDocs 18 | 19 | /// A short description of the target documentation. 20 | /// 21 | /// CommonMark syntax MAY be used for rich text representation. 22 | @SourceCode { language = "Markdown" } 23 | description: String? 24 | 25 | /// The URL for the target documentation. 26 | /// 27 | /// Value MUST be in the format of a URL. 28 | url: Uri? 29 | -------------------------------------------------------------------------------- /packages/pkl.pipe/tests/examples.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["k8s deployment images"] { 3 | """ 4 | nginx:1.14.2 5 | splunkforwarder:1234 6 | """ 7 | } 8 | ["k8s name and kind list"] { 9 | """ 10 | v1.Pod: nginx 11 | v1.Service: nginx-service 12 | """ 13 | } 14 | ["github repos and stars"] { 15 | """ 16 | cups: 1584 17 | swift-lldb: 666 18 | swift: 60875 19 | swift-llbuild: 977 20 | swift-package-manager: 8960 21 | swift-llvm: 814 22 | swift-clang: 672 23 | swift-evolution: 13735 24 | swift-corelibs-foundation: 4700 25 | swift-corelibs-libdispatch: 2249 26 | swift-corelibs-xctest: 1003 27 | example-package-playingcard: 267 28 | example-package-fisheryates: 174 29 | example-package-deckofplayingcards: 163 30 | example-package-dealer: 276 31 | swift-3-api-guidelines-review: 452 32 | swift-docker: 1242 33 | swift-integration-tests: 95 34 | swift-cmark: 222 35 | swift-internals: 184 36 | fstools: 40 37 | swift-compiler-rt: 95 38 | swift-xcode-playground-support: 248 39 | ccs-caldavclientlibrary: 38 40 | ccs-caldavtester: 47 41 | ccs-calendarserver: 448 42 | ccs-pyosxframeworks: 25 43 | ccs-pycalendar: 67 44 | ccs-pykerberos: 107 45 | ccs-pyopendirectory: 22 46 | """ 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /scripts/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "pkl:Project" 17 | 18 | dependencies { 19 | ["com.github.actions.contrib"] = import("../packages/com.github.actions.contrib/PklProject") 20 | ["com.github.actions"] = import("../packages/com.github.actions/PklProject") 21 | ["io.github.typesafegithub"] = import("../packages/io.github.typesafegithub/PklProject") 22 | ["syntax"] = import("../packages/pkl.experimental.syntax/PklProject") 23 | ["deepToTyped"] = import("../packages/pkl.experimental.deepToTyped/PklProject") 24 | } 25 | -------------------------------------------------------------------------------- /packages/org.json_schema.contrib/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Utilities for [JSON Schema](https://json-schema.org). 17 | /// 18 | /// This package includes utilities for generating Pkl from a given JSON Schema document. 19 | amends "../basePklProject.pkl" 20 | 21 | dependencies { 22 | ["jsonschema"] = import("../org.json_schema/PklProject") 23 | ["uri"] = import("../pkl.experimental.uri/PklProject") 24 | ["syntax"] = import("../pkl.experimental.syntax/PklProject") 25 | } 26 | 27 | package { 28 | version = "1.2.0" 29 | } 30 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/tests/fixtures/TestStructure.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | test = "Hello" 17 | 18 | other:Int 19 | 20 | class DoubleNested { 21 | num: Int 22 | float: Float 23 | string: String 24 | nullable: Number? 25 | hasDefault = 23.3 26 | } 27 | 28 | class Thing { 29 | stuff: Boolean 30 | nested: DoubleNested 31 | } 32 | 33 | t:Thing 34 | 35 | typealias Stuff = String 36 | 37 | c:Stuff 38 | 39 | number:Number 40 | secondNumber: Number 41 | 42 | float: Float 43 | secondFloat: Float 44 | 45 | nullableWithDefault: Int? = 10 -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/processors/Processor.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Processor plugins transform, decorate, and/or filter metrics collected by input plugins, 17 | /// passing the transformed metrics to the output plugins 18 | @ModuleInfo { minPklVersion = "0.25.0" } 19 | abstract module com.influxdata.telegraf.plugins.processors.Processor 20 | 21 | extends "../Plugin.pkl" 22 | 23 | /// This is the order in which processors are executed. 24 | /// 25 | /// If this is not specified, then processor execution order will be random. 26 | order: Number? 27 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/examples/https/https.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Example using structureRead to get resources https 17 | /// resources. Not necessarily recommended usage. 18 | /// 19 | /// Try `pkl eval fromHttps.pkl` 20 | module https 21 | 22 | import ".../structuredRead.pkl" 23 | 24 | Http { 25 | `raw.githubusercontent.com/apple/pkl-pantry` { 26 | `8fcea0e535d2eb473545305d8a573144f2b0d33d` { 27 | `README.adoc` {} 28 | `CONTRIBUTING.adoc` {} 29 | } 30 | } 31 | } 32 | 33 | output { 34 | value = structuredRead.fromHttps.fill(Http) 35 | } -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/tests/ExpressionNode.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["binary operators - basic"] { 3 | #""foo" + "bar""# 4 | } 5 | ["binary operators - precedence: no parentheses when child precedence is higher"] { 6 | "5 * 5 + 5 * 5" 7 | } 8 | ["binary operators - precedence: parenthese added when child precedence is lower"] { 9 | "(5 + 5) * (5 + 5)" 10 | } 11 | ["unary operators"] { 12 | "!false" 13 | } 14 | ["unary operators - parenthesizes binary expressions"] { 15 | "-(5 + 10)" 16 | } 17 | ["member access - single identifier"] { 18 | "foo" 19 | } 20 | ["member access - method call"] { 21 | "foo(bar, biz)" 22 | } 23 | ["if/else"] { 24 | """ 25 | if (foo == "foo") 26 | "foo" 27 | else 28 | "bar" 29 | """ 30 | """ 31 | if (foo == "foo") 32 | "foo" 33 | else 34 | "bar" 35 | """ 36 | } 37 | ["super access"] { 38 | "super.someProperty" 39 | "super.someProperty(true)" 40 | } 41 | ["super subscript"] { 42 | #"super["test"]"# 43 | } 44 | ["subscript"] { 45 | #"test["key"]"# 46 | """ 47 | (if (test) 48 | testTrue 49 | else 50 | testFalse)["test" + "Key"] 51 | """ 52 | } 53 | ["read"] { 54 | #"read("env:HOME")"# 55 | #"read*("env:HOME")"# 56 | #"read?("env:HOME")"# 57 | } 58 | ["trace"] { 59 | "trace(test)" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /packages/pkl.pipe/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Tools for constructing pipelines and one-liners in Pkl, by processing text, JSON, or YAML. 17 | /// 18 | /// Use Pkl's `--expression` (or `-x`) argument to provide a Pkl expression that will be evaluated 19 | /// in the context of the content passed to `stdin`. 20 | /// The Pkl property `pipe` (also aliased as `stdin`) represents the content that was passed to `stdin`. 21 | amends "../basePklProject.pkl" 22 | 23 | package { 24 | version = "1.0.2" 25 | } 26 | 27 | dependencies { 28 | ["k8s.contrib"] = import("../k8s.contrib/PklProject") 29 | } 30 | -------------------------------------------------------------------------------- /scripts/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions.contrib@1": { 5 | "type": "local", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions.contrib@1.0.3", 7 | "path": "../packages/com.github.actions.contrib" 8 | }, 9 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 10 | "type": "local", 11 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 12 | "path": "../packages/pkl.experimental.deepToTyped" 13 | }, 14 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": { 15 | "type": "local", 16 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.1.0", 17 | "path": "../packages/pkl.experimental.syntax" 18 | }, 19 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1": { 20 | "type": "local", 21 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0", 22 | "path": "../packages/com.github.actions" 23 | }, 24 | "package://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1": { 25 | "type": "local", 26 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/io.github.typesafegithub@1.0.0", 27 | "path": "../packages/io.github.typesafegithub" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.actions@1.3.0", 7 | "checksums": { 8 | "sha256": "76174cb974310b3d952280b76ed224eb4ee6fd5419bf696ad9a66fba44bd427d" 9 | } 10 | }, 11 | "package://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1": { 12 | "type": "remote", 13 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-project-commons/pkl.impl.ghactions@1.1.6", 14 | "checksums": { 15 | "sha256": "efe36e694f45b0804c5fcc746774727c016c866478b8c1eb0ea86d00c8bd8cf2" 16 | } 17 | }, 18 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 19 | "type": "remote", 20 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 21 | "checksums": { 22 | "sha256": "1e6e29b441ffdee2605d317f6543a4a604aab5af472b63f0c47d92a3b4b36f7f" 23 | } 24 | }, 25 | "package://pkg.pkl-lang.org/pkl-pantry/com.github.dependabot@1": { 26 | "type": "remote", 27 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/com.github.dependabot@1.0.0", 28 | "checksums": { 29 | "sha256": "02ef6f25bfca5b1d095db73ea15de79d2d2c6832ebcab61e6aba90554382abcb" 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/examples/extension-example.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../Document.pkl" 17 | 18 | info { 19 | title = "Extension Example" 20 | version = "1.0.0" 21 | extensions { 22 | ["x-key"] = "info" 23 | } 24 | } 25 | 26 | components { 27 | schemas { 28 | ["Schema"] { 29 | type = "string" 30 | extensions { 31 | ["x-key"] = "schema" 32 | } 33 | } 34 | } 35 | securitySchemes { 36 | ["basicAuth"] { 37 | type = "http" 38 | scheme = "basic" 39 | extensions { 40 | ["x-key"] = "basicAuth" 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Tag.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Adds metadata to a single tag that is used by the Operation Object. 17 | /// 18 | /// It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. 19 | module org.openapis.v3.Tag 20 | 21 | import "ExternalDocs.pkl" 22 | 23 | /// The name of the tag. 24 | name: String 25 | 26 | /// A short description for the tag. 27 | /// 28 | /// CommonMark syntax MAY be used for rich text representation. 29 | @SourceCode { language = "Markdown" } 30 | description: String? 31 | 32 | /// Additional external documentation for this tag. 33 | externalDocs: ExternalDocs? 34 | -------------------------------------------------------------------------------- /packages/pkl.pipe/examples/k8s_deployment_images.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This example shows how to parse a Kubernetes deployment object to get a list of all container images. 17 | /// It is the equivalent of the CLI invocation: 18 | /// 19 | /// ``` 20 | /// pkl eval yaml.pkl -x 'pipe.spec.template.spec.containers.toList().map((c) -> c.image).join("\n")' < examples/k8s_deployment.yaml 21 | /// ``` 22 | module pkl.pipe.examples.k8s_deployment_images 23 | amends "../yaml.pkl" 24 | 25 | input = read("./k8s_deployment.yaml") 26 | 27 | output { 28 | text = module.pipe.spec.template.spec.containers.toList().map((c) -> c.image).join("\n") 29 | } 30 | -------------------------------------------------------------------------------- /packages/pkl.pipe/examples/k8s_name_and_kind.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This example shows how to parse a Kubernetes deployment object to get a list of all container images. 17 | /// It is the equivalent of the CLI invocation: 18 | /// 19 | /// ``` 20 | /// pkl eval yaml.pkl -x 'pipe.map((r) -> "\(r.apiVersion).\(r.kind): \(r.metadata.name)").join("\n")' < examples/service_and_pod.yaml 21 | /// ``` 22 | module pkl.pipe.examples.k8s_name_and_kind 23 | amends "../yaml.pkl" 24 | 25 | input = read("./k8s_service_and_pod.yaml") 26 | 27 | output { 28 | text = module.pipe.map((r) -> "\(r.apiVersion).\(r.kind): \(r.metadata.name)").join("\n") 29 | } 30 | -------------------------------------------------------------------------------- /packages/io.prometheus/examples/configuration.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module io.prometheus.examples.configuration 17 | 18 | amends "../Configuration.pkl" 19 | 20 | global { 21 | scrape_timeout = 10.s 22 | } 23 | 24 | scrape_configs { 25 | new { 26 | job_name = "my-job" 27 | kubernetes_sd_configs { 28 | new { 29 | role = "pod" 30 | } 31 | } 32 | relabel_configs { 33 | new { 34 | regex = ".*?" 35 | } 36 | } 37 | } 38 | } 39 | 40 | remote_write { 41 | new { 42 | url = "https://example.com/remote_write" 43 | sigv4 { 44 | region = "us-west-2" 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/ParameterNode.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Node representing a method or function argument declaration. 17 | @Unlisted 18 | module pkl.experimental.syntax.ParameterNode 19 | 20 | extends "Node.pkl" 21 | 22 | import "TypeAnnotationNode.pkl" 23 | import "IdentifierNode.pkl" 24 | 25 | /// The name of the parameter. May be `_` for an unbound parameter. 26 | name: IdentifierNode 27 | 28 | /// The type of the parameter. 29 | typeAnnotation: TypeAnnotationNode? 30 | 31 | function render(currentIndent: String) = List(name.render(currentIndent), typeAnnotation?.render(currentIndent)) 32 | .filterNonNull() 33 | .join("") 34 | -------------------------------------------------------------------------------- /packages/org.json_schema/examples/basic.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../JsonSchema.pkl" 17 | 18 | $id = "https://example.com/person.schema.json" 19 | 20 | $schema = "https://json-schema.org/draft/2020-12/schema" 21 | 22 | title = "Person" 23 | 24 | type = "object" 25 | 26 | properties { 27 | ["firstName"] { 28 | type = "string" 29 | description = "The person's first name" 30 | } 31 | ["lastName"] { 32 | type = "string" 33 | description = "The person's last name" 34 | } 35 | ["age"] { 36 | type = "integer" 37 | description = "Age in years which must be equal to or greater than zero." 38 | minimum = 0 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.github/workflows/__lockfile__.yml: -------------------------------------------------------------------------------- 1 | #file: noinspection MandatoryParamsAbsent,UndefinedAction 2 | # This is a fake workflow that never runs. 3 | # It's used to pin actions to specific git SHAs when generating actual workflows. 4 | # It also gets updated by dependabot (see .github/dependabot.yml). 5 | # Generated from Workflow.pkl. DO NOT EDIT. 6 | name: __lockfile__ 7 | 'on': 8 | push: 9 | branches-ignore: 10 | - '**' 11 | tags-ignore: 12 | - '**' 13 | jobs: 14 | locks: 15 | if: 'false' 16 | runs-on: nothing 17 | steps: 18 | - name: EnricoMi/publish-unit-test-result-action@v2 19 | uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2 20 | - name: actions/checkout@v6 21 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 22 | - name: actions/create-github-app-token@v2 23 | uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2 24 | - name: actions/download-artifact@v6 25 | uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 26 | - name: actions/setup-java@v5 27 | uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5 28 | - name: actions/upload-artifact@v5 29 | uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 30 | - name: dawidd6/action-download-artifact@v11 31 | uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11 32 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/processors/StarlarkProcessor.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The starlark processor calls a Starlark function for each matched metric, allowing for custom programmatic metric processing. 17 | @ModuleInfo { minPklVersion = "0.25.0" } 18 | open module com.influxdata.telegraf.plugins.processors.StarlarkProcessor 19 | 20 | extends "Processor.pkl" 21 | 22 | /// Source of the Starlark script. 23 | @SourceCode { language = "Starlark" } 24 | source: String? 25 | 26 | /// File containing a Starlark script. 27 | script: String? 28 | 29 | /// The constants of the Starlark script. 30 | constants: Mapping? 31 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Reference.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A reference to other components in the specification, internally and externally. 17 | /// 18 | /// The Reference Object is defined by [JSON Reference](https://datatracker.ietf.org/doc/html/draft-pbryan-zyp-json-ref-03) 19 | /// and follows the same structure, behavior and rules. 20 | /// 21 | /// For this specification, reference resolution is accomplished as defined by the JSON Reference specification 22 | /// and not by the JSON Schema specification. 23 | /// 24 | /// https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object 25 | module org.openapis.v3.Reference 26 | 27 | /// The reference URI 28 | `$ref`: Uri 29 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/tests/expressions.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.openapis.v3.tests.expressions 17 | 18 | amends "pkl:test" 19 | 20 | import "../expressions.pkl" 21 | 22 | facts { 23 | ["Expression"] { 24 | "$method" is expressions.Expression 25 | "$request.header.accept" is expressions.Expression 26 | "$request.path.id" is expressions.Expression 27 | "$request.body#/user/uuid" is expressions.Expression 28 | "$url" is expressions.Expression 29 | "$response.body#/status" is expressions.Expression 30 | "$response.header.Server" is expressions.Expression 31 | !("bar" is expressions.Expression) 32 | !("$request.header.über" is expressions.Expression) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/tests/ClassNode.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.experimental.syntax.tests.ClassNode 17 | 18 | amends "pkl:test" 19 | 20 | import "../ClassNode.pkl" 21 | 22 | facts { 23 | ["extending"] { 24 | new ClassNode { 25 | classHeader { 26 | name { 27 | value = "MyClass" 28 | } 29 | extendsClause { 30 | type { 31 | name { 32 | parts { 33 | new { 34 | value = "Base" 35 | } 36 | } 37 | } 38 | } 39 | } 40 | } 41 | 42 | }.render("") == """ 43 | class MyClass extends Base { 44 | 45 | } 46 | """ 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/tests/ModuleNode.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["full declaration"] { 3 | """ 4 | #!/usr/bin/env pkl eval 5 | /// This is a module doc comment! 6 | @test { annotation = true } 7 | open module pkl.experimental.syntax.tests.ModuleNode 8 | 9 | amends "pkl:test" 10 | 11 | """ 12 | } 13 | ["short methods are rendered inline"] { 14 | """ 15 | /// Adds five to its argument. 16 | const local function addFive(input: Int) = input + 5 17 | 18 | """ 19 | } 20 | ["methods with long values are rendered indented"] { 21 | """ 22 | /// Adds five to its argument. 23 | const local function myReallyLongMethodForAddingFiveToAnInteger(inputIntegerValue: Int) = 24 | inputIntegerValue + 5 25 | 26 | """ 27 | } 28 | ["methods with long values but short first lines are rendered inline"] { 29 | """ 30 | /// Adds five to its argument and returns a dynamic object containing the result. 31 | const local function myLongMethodForReturningADynamicObject(inputIntegerValue: Int) = new Dynamic { 32 | value = inputIntegerValue + 5 33 | } 34 | 35 | """ 36 | } 37 | ["typealiases"] { 38 | """ 39 | typealias Short = "A"|"B" 40 | 41 | typealias Long = 42 | "Apple" 43 | |"Blackberry" 44 | |"Cherry" 45 | |"Durian" 46 | |"Elderberry" 47 | |"Fig" 48 | |"Guava" 49 | |"Huckleberry" 50 | |"I_can't_think_of_a_fruit_that_starts_with_I" 51 | 52 | """ 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/SolrInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The [Solr input plugin](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/solr/README.md) 17 | /// collcts stats via the [MBean Request Handler](https://solr.apache.org/guide/6_6/mbean-request-handler.html). 18 | @ModuleInfo { minPklVersion = "0.25.0" } 19 | open module com.influxdata.telegraf.plugins.inputs.SolrInput 20 | 21 | extends "./Input.pkl" 22 | 23 | /// One or more URLs of Solr servers 24 | servers: Listing(!isEmpty) 25 | 26 | /// Optional list of one or more Solr cores 27 | /// 28 | /// Defaults to all 29 | cores: Listing? 30 | 31 | /// Optional HTTP Basic Auth Credentials. 32 | username: String? 33 | password: String? 34 | -------------------------------------------------------------------------------- /packages/com.github.actions/actions/first-interaction/v1/FirstInteraction.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Greet new contributors when they create their first issue or open their first pull request 17 | module com.github.actions.actions.`first-interaction`.v1.FirstInteraction 18 | 19 | extends ".../AbstractTypedStep.pkl" 20 | 21 | fixed action: "actions/first-interaction" 22 | 23 | fixed version: "v1" 24 | 25 | with: With 26 | 27 | class With { 28 | /// Token for the repository. Can be passed in using {{ secrets.GITHUB_TOKEN }} 29 | `repo-token`: String 30 | 31 | /// Comment to post on an individual's first issue 32 | `issue-message`: String? 33 | 34 | /// Comment to post on an individual's first pull request 35 | `pr-message`: String? 36 | } 37 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/CpuInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The `cpu` plugin gather metrics on the system CPUs. 17 | @ModuleInfo { minPklVersion = "0.25.0" } 18 | module com.influxdata.telegraf.plugins.inputs.CpuInput 19 | 20 | extends "Input.pkl" 21 | 22 | /// Whether to report per-CPU stats or not. 23 | /// 24 | /// Default: `true` 25 | percpu: Boolean? 26 | 27 | /// Whether to report total system CPU stats or not. 28 | /// 29 | /// Default: `true` 30 | totalcpu: Boolean? 31 | 32 | /// If true, collect raw CPU time metrics. 33 | /// 34 | /// Default: `false` 35 | collect_cpu_time: Boolean? 36 | 37 | /// If true, compute and report the sum of all non-idle CPU states. 38 | /// 39 | /// Default: `false` 40 | report_active: Boolean? 41 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/serializers/JsonOutputDataFormat.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The [JSON output data format](https://docs.influxdata.com/telegraf/v1.17/data_formats/output/json/) 17 | /// serializes Telegraf metrics into JSON documents. 18 | @ModuleInfo { minPklVersion = "0.25.0" } 19 | module com.influxdata.telegraf.plugins.serializers.JsonOutputDataFormat 20 | 21 | extends "OutputDataFormat.pkl" 22 | 23 | data_format: "json" 24 | 25 | /// Files to write to. 26 | /// 27 | /// `"stdout"` is a specially handled file. 28 | files: Listing 29 | 30 | /// The resolution to use for the metric timestamp. 31 | /// 32 | /// Durations are truncated to the power of 10 less than the specified units. 33 | json_timestamp_units: Duration 34 | -------------------------------------------------------------------------------- /packages/pkl.toml/examples/converters.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.toml.examples.converters 17 | 18 | import "../toml.pkl" 19 | 20 | class Dog { 21 | breed: String 22 | sleepTime: Duration 23 | } 24 | 25 | dogs { 26 | new Dog { 27 | breed = "Golden Retreiver" 28 | sleepTime = 12.h 29 | } 30 | new Dog { 31 | breed = "GERMAN SHEPHERD" 32 | sleepTime = 10.h 33 | } 34 | new Dog { 35 | breed = "greyhound" 36 | sleepTime = 18.h 37 | } 38 | } 39 | 40 | output { 41 | renderer = new toml.Renderer { 42 | converters { 43 | [Dog] = (dog: Dog) -> (dog) { 44 | breed = dog.breed.toLowerCase() 45 | } 46 | [Duration] = (dur: Duration) -> "\(dur.value)\(dur.unit)" 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/setup-go@v6.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["go-version"] { 20 | type = "string" 21 | } 22 | ["go-version-file"] { 23 | type = "string" 24 | } 25 | ["check-latest"] { 26 | type = "boolean" 27 | } 28 | ["token"] { 29 | type = "string" 30 | } 31 | ["cache"] { 32 | type = "boolean" 33 | } 34 | ["cache-dependency-path"] { 35 | type = "string" 36 | } 37 | ["architecture"] { 38 | type = "enum" 39 | `allowed-values` { 40 | "x86" 41 | "x64" 42 | } 43 | } 44 | } 45 | outputs { 46 | ["go-version"] { 47 | type = "string" 48 | } 49 | ["cache-hit"] { 50 | type = "boolean" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/examples/InputJolokiaAgent.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../Telegraf.pkl" 17 | 18 | agent { 19 | collection_jitter = 0.s 20 | debug = true 21 | flush_interval = 30.s 22 | flush_jitter = 0.s 23 | interval = 30.s 24 | } 25 | 26 | inputs { 27 | jolokia2_agent { 28 | new { 29 | urls { 30 | "http://localhost:7883" 31 | } 32 | response_timeout = 3.s 33 | tls_cert = "/var/private/client.pem" 34 | tls_key = "/var/private/client-key.pem" 35 | metric { 36 | new { 37 | name = "java_runtime" 38 | mbean = "java.lang:type=Runtime" 39 | paths { 40 | "Uptime" 41 | } 42 | } 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/download-artifact@v6.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["name"] { 20 | type = "string" 21 | } 22 | ["artifact-ids"] { 23 | type = "list" 24 | separator = "," 25 | `list-item` { 26 | type = "string" 27 | } 28 | } 29 | ["path"] { 30 | type = "string" 31 | } 32 | ["pattern"] { 33 | type = "string" 34 | } 35 | ["merge-multiple"] { 36 | type = "boolean" 37 | } 38 | ["github-token"] { 39 | type = "string" 40 | } 41 | ["repository"] { 42 | type = "string" 43 | } 44 | ["run-id"] { 45 | type = "string" 46 | } 47 | } 48 | outputs { 49 | ["download-path"] { 50 | type = "string" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/com.github.actions/actions/first-interaction/v3/FirstInteraction.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Greet first-time contributors when they open an issue or PR 17 | module com.github.actions.actions.`first-interaction`.v3.FirstInteraction 18 | 19 | extends ".../AbstractTypedStep.pkl" 20 | 21 | fixed action: "actions/first-interaction" 22 | 23 | fixed version: "v3" 24 | 25 | with: With 26 | 27 | class With { 28 | /// Comment to post on an individual's first issue 29 | issue_message: String? 30 | 31 | /// Comment to post on an individual's first pull request 32 | pr_message: String? 33 | 34 | /// Token with permissions to post issue and PR comments 35 | /// 36 | /// Default if unspecified: `"${{ github.token }}"` 37 | repo_token: String? 38 | } 39 | -------------------------------------------------------------------------------- /packages/pkl.experimental.syntax/Node.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// An abstraction for a Pkl code snippet. 17 | /// 18 | /// Nodes are used for building syntax trees, which can be used to render Pkl source code. 19 | @ModuleInfo { minPklVersion = "0.25.0" } 20 | @Unlisted 21 | abstract module pkl.experimental.syntax.Node 22 | 23 | hidden pcfRenderer: ValueRenderer = new PcfRenderer { useCustomStringDelimiters = true } 24 | 25 | /// The indentation when rendering. 26 | hidden indent: String = " " 27 | 28 | /// The max column width to use when rendering. 29 | hidden maxColumnWidth: Int = 100 30 | 31 | abstract function render(currentIndent: String): String 32 | 33 | function parenthesize(str: String) = "(" + str + ")" 34 | 35 | output { 36 | text = render("") 37 | } 38 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/examples/opentelemetry-output.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../Telegraf.pkl" 17 | 18 | outputs { 19 | opentelemetry { 20 | new { 21 | service_address = "localhost:4312" 22 | timeout = 10.s 23 | tls_ca = "/path/to/ca/cert" 24 | tls_cert = "/path/to/cert" 25 | tls_key = "/path/to/key" 26 | tls_server_name = "tls-server.com" 27 | compression = "gzip" 28 | coralogix { 29 | application = "myapp" 30 | private_key = "my secret value" 31 | subsystem = "my subsystem" 32 | } 33 | attributes { 34 | ["service.name"] = "foo" 35 | ["service.version"] = "1.0.0" 36 | } 37 | headers { 38 | ["x-api-key"] = "my-api-key" 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/pkl.pipe/examples/github_repos_stars.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This example shows how to map a Github API response for repos in an org 17 | /// into a list of "reponame: stars". It is the equivalent of the CLI invocation: 18 | /// 19 | /// ``` 20 | /// curl https://api.github.com/orgs/apple/repos | pkl eval json.pkl -x 'pipe.toList().map((r) -> "\(r.name): \(r.stargazers_count)").join("\n")' 21 | /// ``` 22 | module pkl.pipe.examples.github_repos_stars 23 | amends "../json.pkl" 24 | 25 | // This does the equivalent of stdin redirection, eg: 26 | // pkl eval json.pkl -x '...' < ./github.json 27 | input = read("./github.json") 28 | 29 | output { 30 | // This is equivalent to `pkl eval -x` 31 | text = module.pipe.toList().map((r) -> "\(r.name): \(r.stargazers_count)").join("\n") 32 | } 33 | -------------------------------------------------------------------------------- /packages/pkl.experimental.structuredRead/examples/helmStyle/chart.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Example of using structuredRead to recreate the behaviour of `values` 17 | /// in helm charts. 18 | /// 19 | /// In this example the default values are loaded from values.pkl, but any 20 | /// value can be overwritten by passing `-p =` to `pkl eval`. 21 | /// 22 | /// Try running `pkl eval chart.pkl -p nameOverride="BetterVector" -p replicas=30 -p args.1="/config"` 23 | /// 24 | /// The overwritten values are automatically coersed into the same type as the default 25 | /// so `replicas` retains its `Int` type, and the string value `30` is automatically 26 | /// converted as needed. 27 | module chart 28 | 29 | amends "values.pkl" 30 | 31 | output { 32 | value = module.fromExternalProps 33 | } -------------------------------------------------------------------------------- /packages/com.circleci.v2/examples/concurrent_workflow.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module com.circleci.v2.examples.concurrent_workflow 17 | 18 | // Adapdation of https://circleci.com/docs/sample-config/#concurrent-workflow 19 | amends "../Config.pkl" 20 | 21 | jobs { 22 | ["build"] { 23 | docker { 24 | new { image = "cimg/base:2023.03" } 25 | } 26 | steps { 27 | "checkout" 28 | module.run(#"echo "this is the build job""#) 29 | } 30 | } 31 | ["test"] { 32 | docker { 33 | new { image = "cimg/base:2023.03"} 34 | } 35 | steps { 36 | "checkout" 37 | module.run(#"echo "this is the build job""#) 38 | } 39 | } 40 | } 41 | 42 | workflows { 43 | ["build_and_test"] { 44 | jobs { 45 | "build" 46 | "test" 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/RequestBody.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.openapis.v3.RequestBody 17 | 18 | import "MediaType.pkl" 19 | 20 | /// A brief description of the request body. 21 | /// 22 | /// This could contain examples of use. CommonMark syntax MAY be used for rich text representation. 23 | @SourceCode { language = "Markdown" } 24 | description: String? 25 | 26 | /// The content of the request body. 27 | /// 28 | /// The key is a media type or media type range and the value describes it. For requests that match multiple 29 | /// keys, only the most specific key is applicable. e.g. text/plain overrides text/* 30 | content: Mapping? 31 | 32 | /// Determines if the request body is required in the request. 33 | /// 34 | /// Defaults to false. 35 | required: Boolean? 36 | -------------------------------------------------------------------------------- /packages/k8s.contrib.crd/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Utilities for [Kubernetes Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/). 17 | /// 18 | /// This package includes utilities for generating Pkl for a given CRD. 19 | amends "../basePklProject.pkl" 20 | 21 | dependencies { 22 | ["jsonschema"] = import("../org.json_schema/PklProject") 23 | ["jsonschema.contrib"] = import("../org.json_schema.contrib/PklProject") 24 | ["deepToTyped"] = import("../pkl.experimental.deepToTyped/PklProject") 25 | ["uri"] = import("../pkl.experimental.uri/PklProject") 26 | ["syntax"] = import("../pkl.experimental.syntax/PklProject") 27 | 28 | ["k8s"] { uri = "package://pkg.pkl-lang.org/pkl-k8s/k8s@1.2.0" } 29 | } 30 | 31 | package { 32 | version = "4.2.0" 33 | } 34 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/examples/simple.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../Telegraf.pkl" 17 | 18 | import "../plugins/serializers/JsonOutputDataFormat.pkl" 19 | 20 | global_tags { 21 | ["user"] = "alice" 22 | } 23 | 24 | inputs { 25 | http { 26 | new { 27 | method = "GET" 28 | urls { 29 | "https://server.company.org/metrics" 30 | } 31 | } 32 | } 33 | cpu { 34 | new { 35 | percpu = false 36 | totalcpu = true 37 | tags { 38 | ["tag1"] = "foo" 39 | ["tag2"] = "bar" 40 | } 41 | } 42 | } 43 | } 44 | 45 | outputs { 46 | file { 47 | new { 48 | files { 49 | "my/file.txt" 50 | } 51 | data_format = new JsonOutputDataFormat { 52 | json_timestamp_units = 5.s 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /packages/k8s.contrib.crd/PklProject.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "resolvedDependencies": { 4 | "package://pkg.pkl-lang.org/pkl-k8s/k8s@1": { 5 | "type": "remote", 6 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-k8s/k8s@1.2.0", 7 | "checksums": { 8 | "sha256": "5a37ac359c21442ddba07e339fa211b0db8999104715e891e7d2dab0228ace47" 9 | } 10 | }, 11 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1": { 12 | "type": "local", 13 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.deepToTyped@1.1.1", 14 | "path": "../pkl.experimental.deepToTyped" 15 | }, 16 | "package://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1": { 17 | "type": "local", 18 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema.contrib@1.2.0", 19 | "path": "../org.json_schema.contrib" 20 | }, 21 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1": { 22 | "type": "local", 23 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.syntax@1.1.0", 24 | "path": "../pkl.experimental.syntax" 25 | }, 26 | "package://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1": { 27 | "type": "local", 28 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/pkl.experimental.uri@1.0.3", 29 | "path": "../pkl.experimental.uri" 30 | }, 31 | "package://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1": { 32 | "type": "local", 33 | "uri": "projectpackage://pkg.pkl-lang.org/pkl-pantry/org.json_schema@1.1.0", 34 | "path": "../org.json_schema" 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/pkl.toml/examples/dates.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module pkl.toml.examples.dates 17 | 18 | import "../toml.pkl" 19 | 20 | // Offset Date-Time 21 | odt1 = new toml.DateTime { value = "1979-05-27T07:32:00Z" } 22 | odt2 = new toml.DateTime { value = "1979-05-27T00:32:00-07:00" } 23 | odt3 = new toml.DateTime { value = "1979-05-27T00:32:00.999999-07:00" } 24 | odt4 = new toml.DateTime { value = "1979-05-27 07:32:00Z" } 25 | 26 | // Local Date-Time 27 | ldt1 = new toml.DateTime { value = "1979-05-27T07:32:00" } 28 | ldt2 = new toml.DateTime { value = "1979-05-27T00:32:00.999999" } 29 | 30 | // Local Date 31 | ld1 = new toml.Date { value = "1979-05-27" } 32 | 33 | // Local Time 34 | lt1 = new toml.Time { value = "07:32:00" } 35 | lt2 = new toml.Time { value = "00:32:00.999999" } 36 | 37 | output { 38 | renderer = new toml.Renderer {} 39 | } 40 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/labeler@v6.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["repo-token"] { 20 | type = "string" 21 | } 22 | ["configuration-path"] { 23 | type = "string" 24 | } 25 | ["sync-labels"] { 26 | type = "boolean" 27 | } 28 | ["dot"] { 29 | type = "boolean" 30 | } 31 | ["pr-number"] { 32 | type = "list" 33 | separator = 34 | """ 35 | 36 | 37 | """ 38 | `list-item` { 39 | type = "string" 40 | } 41 | } 42 | } 43 | outputs { 44 | ["new-labels"] { 45 | type = "list" 46 | separator = "," 47 | `list-item` { 48 | type = "string" 49 | } 50 | } 51 | ["all-labels"] { 52 | type = "list" 53 | separator = "," 54 | `list-item` { 55 | type = "string" 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /packages/com.github.actions/actions/upload-pages-artifact/v3/UploadPagesArtifact.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A composite action that prepares your static assets to be deployed to GitHub Pages 17 | module com.github.actions.actions.`upload-pages-artifact`.v3.UploadPagesArtifact 18 | 19 | extends ".../AbstractTypedStep.pkl" 20 | 21 | fixed action: "actions/upload-pages-artifact" 22 | 23 | fixed version: "v3" 24 | 25 | with: With 26 | 27 | class With { 28 | /// Artifact name 29 | /// 30 | /// Default if unspecified: `"github-pages"` 31 | name: String? 32 | 33 | /// Path of the directory containing the static assets. 34 | /// 35 | /// Default if unspecified: `"_site/"` 36 | path: String? 37 | 38 | /// Duration after which artifact will expire in days. 39 | /// 40 | /// Default if unspecified: `"1"` 41 | `retention-days`: Int? 42 | } 43 | -------------------------------------------------------------------------------- /packages/com.github.actions/actions/upload-pages-artifact/v4/UploadPagesArtifact.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A composite action that prepares your static assets to be deployed to GitHub Pages 17 | module com.github.actions.actions.`upload-pages-artifact`.v4.UploadPagesArtifact 18 | 19 | extends ".../AbstractTypedStep.pkl" 20 | 21 | fixed action: "actions/upload-pages-artifact" 22 | 23 | fixed version: "v4" 24 | 25 | with: With 26 | 27 | class With { 28 | /// Artifact name 29 | /// 30 | /// Default if unspecified: `"github-pages"` 31 | name: String? 32 | 33 | /// Path of the directory containing the static assets. 34 | /// 35 | /// Default if unspecified: `"_site/"` 36 | path: String? 37 | 38 | /// Duration after which artifact will expire in days. 39 | /// 40 | /// Default if unspecified: `"1"` 41 | `retention-days`: Int? 42 | } 43 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Extension.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The Extension object represents the possibility of adding additional data 17 | /// to extend the specification at certain points. 18 | /// 19 | /// 20 | module org.openapis.v3.Extension 21 | 22 | import "Info.pkl" 23 | import "SecurityScheme.pkl" 24 | import "Schema.pkl" 25 | 26 | /// A string representing the key of an extension. 27 | typealias Key = String(startsWith("x-"), length > 2) 28 | 29 | hidden converters: Mapping Any> = new { 30 | local extractExtensions = (it: Module) -> it.toMap() + (it.getProperty("extensions") ?? Map()).toMap() 31 | [Schema.getClass()] = extractExtensions 32 | [SecurityScheme.getClass()] = extractExtensions 33 | [Info.getClass()] = extractExtensions 34 | } 35 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Server.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// An object representing a Server. 17 | module org.openapis.v3.Server 18 | 19 | import "ServerVariable.pkl" 20 | 21 | /// A URL to the target host. 22 | /// 23 | /// This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the 24 | /// location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named 25 | /// in {brackets}. 26 | url: String 27 | 28 | /// An optional string describing the host designated by the URL. 29 | /// 30 | /// CommonMark syntax MAY be used for rich text representation. 31 | @SourceCode { language = "Markdown" } 32 | description: String? 33 | 34 | /// A map between a variable name and its value. 35 | /// 36 | /// The value is used for substitution in the server's URL template. 37 | variables: Mapping? 38 | -------------------------------------------------------------------------------- /packages/icalendar/type/DateTime.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This value type is used to identify values that specify a precise calendar date and time of day. 17 | /// 18 | /// https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.5 19 | module icalendar.type.DateTime 20 | 21 | import "Date.pkl" 22 | import "Time.pkl" 23 | import "DateTime.pkl" 24 | 25 | typealias DateTimeString = String(matches(Regex("\(Date.dateRegex)T\(Time.timeRegex)"))) 26 | 27 | date: Date 28 | 29 | time: Time 30 | 31 | /// Indicates that [time] is UTC, not local. 32 | fixed utc: Boolean = time.utc 33 | 34 | function toString(): String = "\(date)T\(time)" 35 | 36 | /// Parse a [DateTimeString] into a [DateTime]. 37 | const function DateTime(input: DateTimeString): DateTime = new { 38 | local parts: List(length == 2) = input.split("T") 39 | date = Date.Date(parts.first) 40 | time = Time.Time(parts.last) 41 | } 42 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Security.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Various security data types. 17 | module org.openapis.v3.Security 18 | 19 | /// Lists the required security schemes to execute this operation. 20 | /// 21 | /// The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the 22 | /// Components Object. 23 | /// 24 | /// Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a 25 | /// request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers 26 | /// are required to convey security information. 27 | /// 28 | /// When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the 29 | /// Security Requirement Objects in the list needs to be satisfied to authorize the request. 30 | typealias Requirement = Mapping> 31 | -------------------------------------------------------------------------------- /packages/pkl.tar/examples/archive.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | import ".../File.pkl" 17 | import "../tar.pkl" 18 | 19 | archive: tar.FileSystem = new { 20 | ["regularFile.txt"] { 21 | text = "this is a regular file" 22 | } 23 | ["exactlyOneBlock.txt"] { 24 | // exactly the size of a block to test padding code 25 | text = "HI".repeat(256) 26 | } 27 | ["someDir/regularFile.txt"] = this["regularFile.txt"] 28 | ["someDir/with/path/long/enough/to/need/a/ustar/prefix/which/is/actually/quite/long/apparently/regularFile.txt"] = 29 | this["regularFile.txt"] 30 | ["someDir/hardLink.txt"] = new File.Link { 31 | target = "../regularFile.txt" 32 | } 33 | ["someDir/symLink.txt"] = new File.SymbolicLink { 34 | target = "../regularFile.txt" 35 | } 36 | ["someDir/otherDir"] = new File.Directory {} 37 | } 38 | 39 | renderer: tar.Renderer 40 | 41 | output { 42 | value = archive 43 | renderer = outer.renderer 44 | } 45 | -------------------------------------------------------------------------------- /packages/icalendar/type/Date.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This value type is used to identify values that contain a calendar date. 17 | /// 18 | /// https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.4 19 | module icalendar.type.Date 20 | 21 | import "Date.pkl" 22 | 23 | // language=Regexp 24 | const hidden dateRegex = "([0-9]{4})(0[1-9]|1[12])(0[1-9]|[12][0-9]|3[01])" 25 | typealias DateString = String(matches(Regex(dateRegex))) 26 | 27 | /// Year value. 28 | y: Int(isBetween(0, 9999)) 29 | 30 | /// Month value. 31 | m: Int(isBetween(1, 12)) 32 | 33 | /// Day value. 34 | d: Int(isBetween(1, 31)) 35 | 36 | function toString(): String = List( 37 | y.toString().padStart(4, "0"), 38 | m.toString().padStart(2, "0"), 39 | d.toString().padStart(2, "0") 40 | ).join("") 41 | 42 | const function Date(input: DateString): Date = new { 43 | y = input.substring(0, 4).toInt() 44 | m = input.substring(4, 6).toInt() 45 | d = input.substring(6, 8).toInt() 46 | } 47 | -------------------------------------------------------------------------------- /packages/org.apache.spark/PklProject: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Definitions for [Apache Spark](https://spark.apache.org). 17 | /// 18 | /// Apache Spark is a distributed computing framework used for processing and analyzing large datasets. 19 | /// It can be applied to data that is structured (like database tables) or unstructured (like log files). 20 | /// Data can be processed one-off or on a schedule, or continuously as a stream of items from a queue. 21 | amends "../basePklProject.pkl" 22 | 23 | package { 24 | version = "1.0.2" 25 | description = """ 26 | Definitions for [Apache Spark](https://spark.apache.org). 27 | 28 | Apache Spark is a distributed computing framework used for processing and analyzing large datasets. 29 | It can be applied to data that is structured (like database tables) or unstructured (like log files). 30 | Data can be processed one-off or on a schedule, or continuously as a stream of items from a queue. 31 | """ 32 | } 33 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Example.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.openapis.v3.Example 17 | 18 | /// Short description for the example 19 | summary: String? 20 | 21 | /// Long description for the example. 22 | /// 23 | /// CommonMark syntax MAY be used for rich text representation. 24 | @SourceCode { language = "Markdown" } 25 | description: String? 26 | 27 | /// Embedded literal example. The value field and externalValue field are mutually exclusive. 28 | /// 29 | /// To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to 30 | /// contain the example, escaping where necessary. 31 | value: Any?(!(this != null && externalValue != null)) 32 | 33 | /// A URL that points to the literal example. 34 | /// 35 | /// This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The 36 | /// value field and externalValue field are mutually exclusive. 37 | externalValue: Uri? 38 | -------------------------------------------------------------------------------- /packages/io.prometheus/PrometheusObject.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Base module for Prometheus configuration objects 17 | @ModuleInfo { minPklVersion = "0.25.0" } 18 | abstract module io.prometheus.PrometheusObject 19 | 20 | typealias MetricNameFormat = String(matches(Regex(#"[a-zA-Z_:][a-zA-Z0-9_:]*"#))) 21 | 22 | typealias LabelNameFormat = String(matches(Regex(#"[a-zA-Z_][a-zA-Z0-9_]*"#))) 23 | 24 | typealias Labels = Mapping 25 | 26 | typealias Scheme = *"http"|"https" 27 | 28 | local function convertDuration(dur: Duration) = 29 | if (dur.unit == "min") dur.value.toString() + "m" 30 | else if (dur.unit == "ns") convertDuration(dur.toUnit("ms")) 31 | else if (dur.unit == "us") convertDuration(dur.toUnit("ms")) 32 | else dur.value.toString() + dur.unit 33 | 34 | output { 35 | renderer = new YamlRenderer { 36 | converters { 37 | [Duration] = (dur: Duration) -> convertDuration(dur) 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/Header.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The Header Object follows the structure of the Parameter Object with the 17 | /// following changes: 18 | /// 19 | /// * name MUST NOT be specified, it is given in the corresponding headers map. 20 | /// * in MUST NOT be specified, it is implicitly in header. 21 | /// * All traits that are affected by the location MUST be applicable to a 22 | /// location of header (for example, style). 23 | module org.openapis.v3.Header 24 | 25 | extends "BaseParameter.pkl" 26 | 27 | import "Schema.pkl" 28 | import "Reference.pkl" 29 | 30 | /// Determines whether this parameter is mandatory. 31 | required: Boolean? 32 | 33 | /// Describes how the parameter value will be serialized depending on the type of the parameter value. 34 | /// 35 | /// In this case, it's a header, so it should always be "simple". 36 | style: "simple"? 37 | 38 | /// The schema defining the type used for the parameter. 39 | schema: (*Schema|Reference)? 40 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Generated from Workflow.pkl. DO NOT EDIT. 2 | name: Build 3 | 'on': 4 | push: 5 | branches-ignore: 6 | - main 7 | - release/* 8 | tags-ignore: 9 | - '**' 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: false 13 | permissions: 14 | contents: read 15 | jobs: 16 | build: 17 | permissions: 18 | checks: write 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 22 | with: 23 | persist-credentials: false 24 | fetch-depth: 0 25 | - uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5 26 | with: 27 | java-version: '21' 28 | distribution: temurin 29 | cache: gradle 30 | - name: Setup Pkl 31 | id: setup-pkl 32 | env: 33 | PKL_VERSION: 0.30.0 34 | PKL_FILENAME: pkl 35 | PKL_DOWNLOAD_URL: https://github.com/apple/pkl/releases/download/0.30.0/pkl-linux-amd64 36 | shell: bash 37 | run: |- 38 | DIR="$(mktemp -d /tmp/pkl-$PKL_VERSION-XXXXXX)" 39 | PKL_EXEC="$DIR/$PKL_FILENAME" 40 | curl -sfL -o $PKL_EXEC "$PKL_DOWNLOAD_URL" 41 | chmod +x $PKL_EXEC 42 | echo "$DIR" >> "$GITHUB_PATH" 43 | echo "pkl_exec=$PKL_EXEC" >> "$GITHUB_OUTPUT" 44 | - run: ./gradlew build 45 | - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 46 | with: 47 | name: build 48 | path: build 49 | - name: Publish test results 50 | if: '!cancelled()' 51 | uses: EnricoMi/publish-unit-test-result-action@34d7c956a59aed1bfebf31df77b8de55db9bbaaf # v2 52 | with: 53 | comment_mode: 'off' 54 | files: build/test-results/**/*.xml 55 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/DiskInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The [disk input plugin](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/disk/README.md) 17 | /// gathers metrics about disk usage. 18 | /// 19 | /// Note that `used_percent` is calculated by doing `used / (used + free)`, 20 | /// _not_ `used / total`, which is how the unix `df` command does it. 21 | /// See for more details. 22 | @ModuleInfo { minPklVersion = "0.25.0" } 23 | module com.influxdata.telegraf.plugins.inputs.DiskInput 24 | 25 | extends "Input.pkl" 26 | 27 | /// By default stats will be gathered for all mount points. 28 | /// 29 | /// Set mount_points will restrict the stats to only the specified mount points. 30 | mount_points: Listing? 31 | 32 | typealias FsType = "tmpfs" | "devtmpfs" | "devfs" | "iso9660" | "overlay" | "aufs" | "squashfs" 33 | 34 | /// Ignore mount points by filesystem type. 35 | ignore_fs: Listing? 36 | -------------------------------------------------------------------------------- /packages/pkl.pipe/kubeval.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// A Pkl implementation of a Kubernetes manifest validation tool, inspired by 17 | /// [kubeval](https://github.com/instrumenta/kubeval) 18 | /// 19 | /// Example usage: 20 | /// 21 | /// ``` 22 | /// pkl eval <(pkl eval -m package://pkg.pkl-lang.org/pkl-pantry/pkl.pipe@#/kubeval.pkl> < deployment.yaml) 23 | /// # or 24 | /// pkl eval <(pkl eval -p input=deployment.yaml package://pkg.pkl-lang.org/pkl-pantry/pkl.pipe@#/kubeval.pkl) 25 | /// ``` 26 | @ModuleInfo { minPklVersion = "0.24.0" } 27 | module pkl.pipe.kubeval 28 | amends "yaml.pkl" 29 | 30 | import "@k8s.contrib/convert.pkl" 31 | 32 | parser { 33 | useMapping = true 34 | } 35 | 36 | input = (read?("prop:input").ifNonNull((it) -> read(it as String)) as Resource?) ?? super.input 37 | 38 | output = (convert) { 39 | resourcesToConvert = 40 | let (pipe = module.pipe) 41 | if (pipe is List) 42 | pipe 43 | else 44 | List(pipe) 45 | }.output 46 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/github-script@v7.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["script"] { 20 | type = "string" 21 | } 22 | ["github-token"] { 23 | type = "string" 24 | } 25 | ["debug"] { 26 | type = "boolean" 27 | } 28 | ["user-agent"] { 29 | type = "string" 30 | } 31 | ["previews"] { 32 | type = "list" 33 | separator = "," 34 | `list-item` { 35 | type = "string" 36 | } 37 | } 38 | ["result-encoding"] { 39 | type = "enum" 40 | name = "Encoding" 41 | `allowed-values` { 42 | "string" 43 | "json" 44 | } 45 | } 46 | ["retries"] { 47 | type = "integer" 48 | } 49 | ["retry-exempt-status-codes"] { 50 | type = "list" 51 | separator = "," 52 | `list-item` { 53 | type = "integer" 54 | } 55 | } 56 | ["base-url"] { 57 | type = "string" 58 | } 59 | } 60 | outputs { 61 | ["result"] { 62 | type = "string" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /packages/org.openapis.v3/ServerVariable.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// An object representing a Server Variable for server URL template 17 | /// substitution. 18 | module org.openapis.v3.ServerVariable 19 | 20 | /// An enumeration of string values to be used if the substitution options are from a limited set. 21 | /// 22 | /// The array SHOULD NOT be empty. 23 | enum: Listing(!isEmpty, isDistinct)? 24 | 25 | /// The default value to use for substitution, which SHALL be sent if an alternate value is not supplied. 26 | /// 27 | /// Note this behavior is different than the Schema Object's treatment of default values, because in those cases 28 | /// parameter values are optional. If the enum is defined, the value SHOULD exist in the enum's values. 29 | default: String(enum == null || enum.toList().contains(this)) 30 | 31 | /// An optional description for the server variable. 32 | /// 33 | /// CommonMark syntax MAY be used for rich text representation. 34 | @SourceCode { language = "Markdown" } 35 | description: String? 36 | -------------------------------------------------------------------------------- /packages/org.apache.spark/PropertiesBase.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | abstract module org.apache.spark.PropertiesBase 17 | 18 | import "pkl:semver" 19 | import "utils.pkl" 20 | 21 | /// The Spark version to use these properties with. 22 | hidden targetSparkVersion: String? 23 | 24 | function since(sparkVersion: String): Boolean = 25 | if (targetSparkVersion == null) true 26 | else 27 | let (parsedVersion = semver.Version(sparkVersion)) 28 | if (!parsedVersion.isGreaterThan(semver.Version(targetSparkVersion))) 29 | throw("This property exists since Spark version \(parsedVersion), but target Spark version is \(targetSparkVersion).") 30 | else 31 | true 32 | 33 | hidden effectiveProperties: Map = 34 | module.toMap().flatMap((key, value) -> utils.convertProperty(key, value)) 35 | 36 | /// Indicates that the annotated property cannot be set by the user. 37 | class Reserved extends Annotation 38 | 39 | output { 40 | value = effectiveProperties 41 | renderer = new PropertiesRenderer {} 42 | } 43 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/examples/x509CertInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "../Telegraf.pkl" 17 | 18 | inputs { 19 | x509_cert { 20 | new { 21 | sources { 22 | "tcp://example.org:443" 23 | "https://influxdata.com:443" 24 | "smtp://mail.localhost:25" 25 | "udp://127.0.0.1:4433" 26 | "/etc/ssl/certs/ssl-cert-snakeoil.pem" 27 | "/etc/mycerts/*.mydomain.org.pem" 28 | "file:///path/to/*.pem" 29 | "jks:///etc/mycerts/keystore.jks" 30 | "pkcs12:///etc/mycerts/keystore.p12" 31 | } 32 | timeout = 5.s 33 | server_name = "myhost.example.com" 34 | exclude_only_roots = true 35 | pad_serial_with_zeroes = true 36 | password = "hunter2" 37 | tls_ca = "/etc/telegraf/ca.pem" 38 | tls_cert = "/etc/telegraf/cert.pem" 39 | tls_key = "/etc/telegraf/key.pem" 40 | tls_server_name = "myhost.example.com" 41 | use_proxy = true 42 | proxy_url = "http://localhost:8888" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /scripts/actionTypes/actions/setup-dotnet@v5.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | amends "@io.github.typesafegithub/ActionTypes.pkl" 17 | 18 | inputs { 19 | ["dotnet-version"] { 20 | type = "string" 21 | } 22 | ["dotnet-quality"] { 23 | type = "enum" 24 | name = "DotNetQuality" 25 | `allowed-values` { 26 | "daily" 27 | "signed" 28 | "validated" 29 | "preview" 30 | "ga" 31 | } 32 | } 33 | ["global-json-file"] { 34 | type = "string" 35 | } 36 | ["source-url"] { 37 | type = "string" 38 | } 39 | ["owner"] { 40 | type = "string" 41 | } 42 | ["config-file"] { 43 | type = "string" 44 | } 45 | ["cache"] { 46 | type = "boolean" 47 | } 48 | ["cache-dependency-path"] { 49 | type = "list" 50 | separator = 51 | """ 52 | 53 | 54 | """ 55 | `list-item` { 56 | type = "string" 57 | } 58 | } 59 | } 60 | outputs { 61 | ["cache-hit"] { 62 | type = "boolean" 63 | } 64 | ["dotnet-version"] { 65 | type = "string" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/NetInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The [net input plugin](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/net/NET_README.md) 17 | /// gathers metrics about network interface and protocol usage (Linux only). 18 | @ModuleInfo { minPklVersion = "0.25.0" } 19 | module com.influxdata.telegraf.plugins.inputs.NetInput 20 | 21 | extends "Input.pkl" 22 | 23 | /// By default, telegraf gathers stats from any up interface (excluding loopback). 24 | /// 25 | /// Setting interfaces will tell it to gather these explicit interfaces, regardless of status. 26 | /// When specifying an interface, glob-style patterns are also supported. 27 | /// 28 | /// Example: 29 | /// ``` 30 | /// interfaces { "eth*", "enp0s[0-1]", "lo" } 31 | /// ``` 32 | interfaces: Listing? 33 | 34 | /// On linux systems telegraf also collects protocol stats. 35 | /// 36 | /// Setting this property to `true` will skip reporting of protocol metrics. 37 | /// 38 | /// Default: `false` 39 | ignore_protocol_stats: Boolean? 40 | -------------------------------------------------------------------------------- /packages/io.prometheus/examples/rule.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module io.prometheus.examples.rule 17 | 18 | amends "../Rule.pkl" 19 | 20 | groups { 21 | new AlertingRuleGroup { 22 | name = "alerting_rules" 23 | interval = 5.min 24 | labels { 25 | ["group"] = "alerts" 26 | } 27 | rules { 28 | new { 29 | alert = "HighRequestLatency" 30 | expr = #"job:request_latency_seconds:mean5m{job="myjob"} > 0.5"# 31 | `for` = 10.min 32 | labels { 33 | ["prod"] = true 34 | ["priority"] = 1 35 | ["severity"] = "page" 36 | } 37 | annotations { 38 | ["summary"] = "High request latency" 39 | } 40 | } 41 | } 42 | } 43 | new RecordingRuleGroup { 44 | name = "recording_rules" 45 | interval = 10.h 46 | labels { 47 | ["group"] = "recording" 48 | } 49 | rules { 50 | new { 51 | `record` = "job:http_inprogress_requests:sum" 52 | expr = "sum by (job) (http_inprogress_requests)" 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/FileInput.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// The `file` plugin parses the **complete** contents of a file **every interval** 17 | /// using the selected input data format. 18 | /// 19 | /// **Note:** If you wish to parse only newly appended lines use the `tail` input plugin instead. 20 | @ModuleInfo { minPklVersion = "0.25.0" } 21 | open module com.influxdata.telegraf.plugins.inputs.FileInput 22 | 23 | extends "Input.pkl" 24 | 25 | import "../parsers/InputDataFormat.pkl" 26 | 27 | /// Files to parse each interval. 28 | /// 29 | /// Accept standard unix glob matching rules, as well as `**` to match recursive files and directories. 30 | files: Listing 31 | 32 | /// Name a tag containing the name of the file the data was parsed from. 33 | /// 34 | /// Leave empty to disable. 35 | file_tag: String? 36 | 37 | /// The [input data format](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md) 38 | /// to consume. 39 | /// 40 | /// Each data format has its own unique set of configuration options. 41 | data_format: InputDataFormat? 42 | -------------------------------------------------------------------------------- /packages/com.github.actions/actions/cache/save/v4/CacheSave.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Save Cache artifacts like dependencies and build outputs to improve workflow execution time 17 | module com.github.actions.actions.cache.save.v4.CacheSave 18 | 19 | extends ".../AbstractTypedStep.pkl" 20 | 21 | fixed action: "actions/cache/save" 22 | 23 | fixed version: "v4" 24 | 25 | with: With 26 | 27 | class With { 28 | /// A list of files, directories, and wildcard patterns to cache 29 | hidden pathList: Listing 30 | 31 | /// A list of files, directories, and wildcard patterns to cache 32 | /// 33 | /// To set as a [Listing], use [pathList]. 34 | path: String = pathList.join("\n") 35 | 36 | /// An explicit key for saving the cache 37 | key: String 38 | 39 | /// The chunk size used to split up large files during upload, in bytes 40 | `upload-chunk-size`: Int? 41 | 42 | /// An optional boolean when enabled, allows windows runners to save caches that can be restored on other platforms 43 | /// 44 | /// Default if unspecified: `"false"` 45 | enableCrossOsArchive: Boolean? 46 | } 47 | -------------------------------------------------------------------------------- /packages/org.apache.spark/tests/PropertiesBase.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | module org.apache.spark.tests.PropertiesBase 17 | 18 | amends "pkl:test" 19 | 20 | import "../PropertiesBase.pkl" 21 | 22 | local class SampleSparkProperties extends PropertiesBase { 23 | `spark.core.numbers`: Int? 24 | `spark.{driver|executor}.something`: Mapping? 25 | `spark.shards.[0-9].setting.[node].memory`: Mapping>? 26 | `spark.kubernetes.some.type.of.memory`: DataSize? 27 | `spark.some.type.of.duration`: Duration? 28 | } 29 | 30 | examples { 31 | ["rendering properties"] { 32 | new SampleSparkProperties { 33 | `spark.{driver|executor}.something` { 34 | ["driver"] = "some driver setting" 35 | ["executor"] = "some executor setting" 36 | } 37 | `spark.core.numbers` = 5 38 | `spark.shards.[0-9].setting.[node].memory` { 39 | ["1"] { 40 | ["this-node"] = 5.gib 41 | } 42 | } 43 | `spark.kubernetes.some.type.of.memory` = 10.gib 44 | `spark.some.type.of.duration` = 5.min 45 | }.output.text 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /packages/org.json_schema.contrib/tests/TypesGenerator.pkl-expected.pcf: -------------------------------------------------------------------------------- 1 | examples { 2 | ["numbers"] { 3 | "Number" 4 | "Number(isBetween(5, 10))" 5 | "Number(this <= 5)" 6 | "Number(this > 5)" 7 | "Number(this < 5)" 8 | "Int(this % 5 == 0)" 9 | "Number(isPositive)" 10 | "Number(isPositive)" 11 | "Int" 12 | "UInt8" 13 | } 14 | ["number literals"] { 15 | "Number(this == 5)" 16 | "Number(this == 5 || this == 6 || this == 7)" 17 | } 18 | ["strings"] { 19 | "String" 20 | "String(!isEmpty)" 21 | "String(length >= 5)" 22 | "String(length <= 10)" 23 | "String(length.isBetween(5, 10))" 24 | #"String(matches(Regex("[a-z]")))"# 25 | "Uri" 26 | "String(isRegex)" 27 | } 28 | ["string literals"] { 29 | #""Hello""# 30 | #""Hello""# 31 | #""Bart"|"Lisa""# 32 | } 33 | ["booleans"] { 34 | "Boolean" 35 | } 36 | ["boolean literals"] { 37 | "Boolean(this == true)" 38 | "Boolean(this == false)" 39 | "Boolean(this == false)" 40 | "Boolean" 41 | } 42 | ["arrays"] { 43 | "Listing" 44 | "Listing" 45 | "Listing" 46 | "Listing(isDistinct)" 47 | "Listing" 48 | "Listing" 49 | } 50 | ["mappings"] { 51 | "Mapping" 52 | #"Mapping"# 53 | } 54 | ["nullables"] { 55 | "String(length >= 10)?" 56 | "(String(length >= 10)|Number(this >= 10))?" 57 | } 58 | ["unions"] { 59 | "String(length >= 5)|Int(this % 10 == 0)" 60 | "String(length >= 5)|Int(this % 10 == 0)" 61 | } 62 | ["not"] { 63 | #"String(this != "foo")"# 64 | "String(!length.isBetween(5, 10))" 65 | } 66 | ["null"] { 67 | "Null" 68 | } 69 | ["allOf"] { 70 | "String(length.isBetween(5, 10))" 71 | } 72 | ["types from $ref"] { 73 | "Foo" 74 | "unknown" 75 | } 76 | ["boolean schemas"] { 77 | "Any" 78 | "nothing" 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/OpenTelemetry.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// This [OpenTelemetry input plugin](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/opentelemetry) 17 | /// receives traces, metrics and logs from OpenTelemetry clients and agents via gRPC. 18 | @ModuleInfo { minPklVersion = "0.25.0" } 19 | module com.influxdata.telegraf.plugins.inputs.OpenTelemetry 20 | 21 | extends "Input.pkl" 22 | 23 | /// Address and port to listen on. 24 | /// 25 | /// Default if unset: `0.0.0.0:4317` 26 | service_address: String? 27 | 28 | /// New connection timeout 29 | /// 30 | /// Default if unset: 5s 31 | timeout: Duration? 32 | 33 | /// Supports: "prometheus-v1", "prometheus-v2" 34 | /// 35 | /// Default: "prometheus-v1" 36 | metrics_schema: (*"prometheus-v1" | "prometheus-v2")? 37 | 38 | /// Optional TLS Config. 39 | /// 40 | /// Set one or more allowed client CA certificate file names to 41 | /// enable mutually authenticated TLS connections 42 | tls_allowed_cacerts: Listing? 43 | 44 | /// Add service certificate 45 | tls_cert: String? 46 | 47 | /// Add service key 48 | tls_key: String? 49 | -------------------------------------------------------------------------------- /packages/io.github.typesafegithub/ActionTypes.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Type information for GitHub Actions https://github.com/typesafegithub/github-actions-typing 17 | module io.github.typesafegithub.ActionTypes 18 | 19 | /// The inputs of the action. 20 | /// 21 | /// https://github.com/typesafegithub/github-actions-typing/blob/main/README.md 22 | inputs: Mapping? 23 | 24 | /// The outputs of the action. 25 | /// 26 | /// https://github.com/typesafegithub/github-actions-typing/blob/main/README.md 27 | outputs: Mapping? 28 | 29 | typealias TypeName = "string" | "boolean" | "integer" | "float" | "enum" | "list" 30 | 31 | class Property { 32 | type: TypeName 33 | 34 | name: String(type is "integer" | "enum")? 35 | 36 | `named-values`: Mapping(type == "integer")? 37 | 38 | separator: String(type == "list")? 39 | 40 | `list-item`: Property(type == "list")? 41 | 42 | `allowed-values`: Listing(type == "enum")? 43 | } 44 | 45 | output { 46 | renderer = new YamlRenderer {} 47 | } 48 | -------------------------------------------------------------------------------- /packages/com.influxdata.telegraf/plugins/inputs/Input.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// Telegraf input plugins are used with the InfluxData time series platform 17 | /// to collect metrics from the system, services, or third party APIs. 18 | /// 19 | /// All metrics are gathered from the inputs you enable and configure in the configuration file. 20 | @ModuleInfo { minPklVersion = "0.25.0" } 21 | abstract module com.influxdata.telegraf.plugins.inputs.Input 22 | 23 | extends "../Plugin.pkl" 24 | 25 | /// How often to gather this metric. 26 | /// 27 | /// Normal plugins use a single global interval, 28 | /// but if one particular input should be run less or more often, 29 | /// you can configure that here. 30 | interval: Duration? 31 | 32 | /// Override the base name of the measurement. 33 | /// 34 | /// Default: name of the input 35 | name_override: String? 36 | 37 | /// Specifies a prefix to attach to the measurement name. 38 | name_prefix: String? 39 | 40 | /// Specifies a suffix to attach to the measurement name. 41 | name_suffix: String? 42 | 43 | /// A map of tags to apply to a specific input’s measurements. 44 | tags: Mapping? 45 | -------------------------------------------------------------------------------- /packages/pkl.pipe/json.pkl: -------------------------------------------------------------------------------- 1 | //===----------------------------------------------------------------------===// 2 | // Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // https://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //===----------------------------------------------------------------------===// 16 | /// CLI tool for working with JSON in Pkl, kind of like [jq](https://stedolan.github.io/jq/). 17 | /// 18 | /// Example usage: 19 | /// 20 | /// # Get my IP address 21 | /// curl https://ifconfig.co/json | pkl eval package://pkg.pkl-lang.org/pkl-pantry/pkl.pipe@#/json.pk -x 'pipe.ip' 22 | /// 23 | /// # Get repos and stars for Github org 24 | /// curl https://api.github.com/orgs/apple/repos | pkl eval package://pkg.pkl-lang.org/pkl-pantry/pkl.pipe@#/json.pkl -x 'pipe.toList().map((r) -> "\(r.name): \(r.stargazers_count)").join("\n")' 25 | @ModuleInfo { minPklVersion = "0.24.0" } 26 | module pkl.pipe.json 27 | extends "./text.pkl" 28 | 29 | import "pkl:json" 30 | 31 | local parsed = new json.Parser { 32 | useMapping = read?("prop:useMapping")?.toBoolean() ?? false 33 | }.parse(input) 34 | 35 | pipe: (List|json.Value)? = if (parsed is Listing) parsed.toList() else parsed 36 | stdin: (List|json.Value)? = pipe 37 | 38 | output { 39 | value = pipe 40 | when (read?("prop:pkl.outputFormat") == null) { 41 | renderer = module.jsonRenderer 42 | } 43 | } 44 | --------------------------------------------------------------------------------