Skip to content

Commit 3355ab9

Browse files
committed
Merge branch 'main' into ollama-doc
2 parents 8b668f8 + 818ffc0 commit 3355ab9

File tree

304 files changed

+8763
-9005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+8763
-9005
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
# Maintain dependencies for npm
14+
- package-ecosystem: "npm"
15+
directory: "/pdl-live"
16+
schedule:
17+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: pre-commit checks
4040
run: pre-commit run -a
4141
- name: run tests
42-
run: py.test -v --capture=tee-sys tests
42+
run: py.test -v --capture=tee-sys --ignore=tests/test_examples_run.py tests
4343

4444
viewer:
4545
name: Build PDL live viewer
@@ -57,6 +57,6 @@ jobs:
5757
- name: Install dependencies
5858
run: npm install
5959
- name: Generate pdl_ast.d.ts
60-
run: npx json2ts ../pdl-schema.json src/pdl_ast.d.ts --unreachableDefinitions
60+
run: npx json2ts ../src/pdl/pdl-schema.json src/pdl_ast.d.ts --unreachableDefinitions
6161
- name: Build viewer
6262
run: npm run build

.github/workflows/mkdocs-gh-pages.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
paths:
1010
- "mkdocs.yml"
1111
- "docs/**"
12+
- "pdl-live"
1213

1314
# Allows you to run this workflow manually from the Actions tab
1415
workflow_dispatch:
@@ -26,35 +27,32 @@ concurrency:
2627
cancel-in-progress: false
2728

2829
jobs:
29-
# Build viewer
30-
viewer:
31-
name: Build PDL live viewer
30+
# Build docs
31+
build:
3232
runs-on: ubuntu-latest
33-
defaults:
34-
run:
35-
working-directory: ./pdl-live
3633
steps:
37-
- uses: actions/checkout@v4
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
# Viewer
3837
- name: Set up node
3938
uses: actions/setup-node@v4
4039
with:
4140
node-version: 22
4241
- name: Install dependencies
42+
working-directory: ./pdl-live
4343
run: npm install
4444
- name: Generate pdl_ast.d.ts
45-
run: npx json2ts ../pdl-schema.json src/pdl_ast.d.ts --unreachableDefinitions
45+
working-directory: ./pdl-live
46+
run: npx json2ts ../src/pdl/pdl-schema.json src/pdl_ast.d.ts --unreachableDefinitions
4647
- name: Build viewer
48+
working-directory: ./pdl-live
4749
run: npm run build
4850
- name: Copy viewer
51+
working-directory: ./pdl-live
4952
run: cp ./dist/bundle.js ../docs/dist/bundle.js
50-
51-
# Build docs
52-
build:
53-
runs-on: ubuntu-latest
54-
needs: viewer
55-
steps:
56-
- name: Checkout
57-
uses: actions/checkout@v4
53+
- name: Copy schema
54+
run: cp ./src/pdl/pdl-schema.json ./docs/dist/pdl-schema.json
55+
# Docs
5856
- name: Setup Pages
5957
uses: actions/configure-pages@v5
6058
- name: Setup Python
@@ -67,6 +65,7 @@ jobs:
6765
run: mkdocs build --config-file ./mkdocs.yml --strict --site-dir ./_site
6866
env:
6967
CI: true
68+
# Deploy
7069
- name: Upload artifact
7170
uses: actions/upload-pages-artifact@v3
7271

.github/workflows/release.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
name: Publish prompt-declaration-language to PyPI and TestPyPI
3+
4+
on:
5+
# push:
6+
# branches:
7+
# - "main"
8+
release:
9+
types:
10+
- released
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
name: Build distribution 📦
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.x"
24+
- name: Install pypa/build
25+
run: >-
26+
python3 -m
27+
pip install
28+
build
29+
--user
30+
- name: Build a binary wheel and a source tarball
31+
run: python3 -m build
32+
- name: Store the distribution packages
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: python-package-distributions
36+
path: dist/
37+
38+
publish-to-pypi:
39+
name: >-
40+
Publish prompt-declaration-language to PyPI
41+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
42+
needs:
43+
- build
44+
runs-on: ubuntu-latest
45+
environment:
46+
name: pypi
47+
url: https://pypi.org/p/prompt-declaration-language
48+
permissions:
49+
id-token: write # IMPORTANT: mandatory for trusted publishing
50+
51+
steps:
52+
- name: Download all the dists
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
- name: Publish distribution 📦 to PyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1
59+
60+
# github-release:
61+
# name: >-
62+
# Sign prompt-declaration-language with Sigstore
63+
# and upload them to GitHub Release
64+
# needs:
65+
# - publish-to-pypi
66+
# runs-on: ubuntu-latest
67+
68+
# permissions:
69+
# contents: write # IMPORTANT: mandatory for making GitHub Releases
70+
# id-token: write # IMPORTANT: mandatory for sigstore
71+
72+
# steps:
73+
# - name: Download all the dists
74+
# uses: actions/download-artifact@v4
75+
# with:
76+
# name: python-package-distributions
77+
# path: dist/
78+
# - name: Sign the dists with Sigstore
79+
# uses: sigstore/[email protected]
80+
# with:
81+
# inputs: >-
82+
# ./dist/*.tar.gz
83+
# ./dist/*.whl
84+
# - name: Create GitHub Release
85+
# env:
86+
# GITHUB_TOKEN: ${{ github.token }}
87+
# run: >-
88+
# gh release create
89+
# '${{ github.ref_name }}'
90+
# --repo '${{ github.repository }}'
91+
# --notes ""
92+
# - name: Upload artifact signatures to GitHub Release
93+
# env:
94+
# GITHUB_TOKEN: ${{ github.token }}
95+
# # Upload to GitHub Release using the `gh` CLI.
96+
# # `dist/` contains the built packages, and the
97+
# # sigstore-produced signatures and certificates.
98+
# run: >-
99+
# gh release upload
100+
# '${{ github.ref_name }}' dist/**
101+
# --repo '${{ github.repository }}'
102+
103+
publish-to-testpypi:
104+
name: Publish prompt-declaration-language to TestPyPI
105+
needs:
106+
- build
107+
runs-on: ubuntu-latest
108+
109+
environment:
110+
name: testpypi
111+
url: https://test.pypi.org/p/prompt-declaration-language
112+
113+
permissions:
114+
id-token: write # IMPORTANT: mandatory for trusted publishing
115+
116+
steps:
117+
- name: Download all the dists
118+
uses: actions/download-artifact@v4
119+
with:
120+
name: python-package-distributions
121+
path: dist/
122+
- name: Publish distribution 📦 to TestPyPI
123+
uses: pypa/gh-action-pypi-publish@release/v1
124+
with:
125+
repository-url: https://test.pypi.org/legacy/
126+
verbose: true

.github/workflows/run-examples.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Run examples
3+
4+
on:
5+
schedule:
6+
- cron: '0 1 * * *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
tests:
11+
name: Exeution tests
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ['3.11', '3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Cache pip
25+
uses: actions/cache@v4
26+
with:
27+
# This path is specific to Ubuntu
28+
path: ${{ env.pythonLocation }}
29+
# Look to see if there is a cache hit for the setup file
30+
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-new3
33+
${{ runner.os }}-new3
34+
- name: Install dependencies
35+
run: pip install --upgrade --upgrade-strategy eager .[all]
36+
- name: pip list packages
37+
run: pip list
38+
- name: show pip dependencies
39+
run: |
40+
pip install pipdeptree
41+
pipdeptree -fl
42+
- name: run tests
43+
env:
44+
WATSONX_PROJECT_ID: ${{ secrets.WATSONX_PROJECT_ID }}
45+
WATSONX_APIKEY: ${{ secrets.WATSONX_APIKEY }}
46+
WATSONX_URL: ${{ secrets.WATSONX_URL }}
47+
run: py.test -v --capture=tee-sys tests/test_examples_run.py

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@ pdl-live/package-lock.json
152152
*_trace.json
153153

154154
# Built docs
155-
_site
155+
_site
156+
157+
# Generated version
158+
src/pdl/_version.py

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ default_language_version:
55
repos:
66
# check some basic stuff
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.5.0
8+
rev: v4.6.0
99
hooks:
1010
# Check for files that would conflict in case-insensitive filesystems
1111
- id: check-case-conflict
@@ -22,12 +22,12 @@ repos:
2222
args: [--filter-files, --profile, black]
2323
# Format the python code with black
2424
- repo: https://github.com/psf/black
25-
rev: 23.12.1
25+
rev: 24.8.0
2626
hooks:
2727
- id: black
2828
# Lint the python code with flake
2929
- repo: https://github.com/PyCQA/flake8
30-
rev: 7.0.0
30+
rev: 7.1.1
3131
hooks:
3232
- id: flake8
3333
# Type check the Python code with pylint
@@ -38,7 +38,7 @@ repos:
3838
entry: pylint
3939
language: python
4040
types: [python]
41-
additional_dependencies: ['pylint==3.0.3']
41+
additional_dependencies: ['pylint==3.3.0']
4242
args:
4343
[
4444
"-rn", # Only display messages
@@ -47,7 +47,7 @@ repos:
4747
]
4848
# Type check the Python code with MyPy
4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: 'v1.8.0'
50+
rev: 'v1.11.2'
5151
hooks:
5252
- id: mypy
5353
verbose: true
@@ -61,4 +61,4 @@ repos:
6161
language: node
6262
pass_filenames: false
6363
types: [python]
64-
additional_dependencies: ['[email protected].345']
64+
additional_dependencies: ['[email protected].381']

.vscode/launch.json

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,47 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Python Debugger: Module",
9-
"type": "debugpy",
8+
"name": "Python: Module",
9+
"type": "python",
1010
"request": "launch",
11-
"module": "pdl.pdl",
12-
"args": "examples/prompt_library/tools.pdl"
11+
"module": "src.pdl.pdl",
12+
"justMyCode": true,
13+
"args": [
14+
// "/Users/lmandel/ml4code/pdl-internal/talks/2024-0819-pdl-examples/03_chatbot.pdl",
15+
// "-i", "ast",
16+
"examples/tutorial/include.pdl",
17+
// "examples/hello/hello.pdl",
18+
// "examples/arith/Arith.pdl"
19+
// "examples/hello/weather.pdl"
20+
// "examples/joke/Joke.yaml"
21+
// "examples/thing/Thing.yaml"
22+
// "examples/teacher/teacher.pdl"
23+
// "examples/talk/5-hello.pdl",
24+
// "/tmp/a.pdl",
25+
// "a.pdl"
26+
// "--stream", "none",
27+
"--trace",
28+
]
1329
}
1430
]
31+
// "configurations": [
32+
// {
33+
// "name": "Python: Module",
34+
// "type": "debugpy",
35+
// "request": "launch",
36+
// "program": "examples/sdk/hello_str.py",
37+
// // "justMyCode": true,
38+
// }
39+
// ]
40+
// "configurations": [
41+
// {
42+
// "name": "Python: Module",
43+
// "type": "python",
44+
// "request": "launch",
45+
// "module": "pdl.benchmark",
46+
// "justMyCode": true,
47+
// "args": [ "-b", "gsm8k"
48+
// ]
49+
// }
50+
// ]
1551
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"yaml.schemas": {
3-
"./pdl-schema.json": "*.pdl"
3+
"./src/pdl/pdl-schema.json": "*.pdl"
44
},
55
"files.associations": {
66
"*.pdl": "yaml",

0 commit comments

Comments
 (0)