Skip to content

Commit 6816c8a

Browse files
authored
Merge pull request #826 from NVIDIA/feature/poetry
Feature: migrate to poetry
2 parents 8321685 + 0be86a4 commit 6816c8a

27 files changed

+6546
-398
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Bug Report
22
description: File a bug/issue
33
title: "bug: "
4-
labels: [bug]
4+
labels: ["bug", "status: needs triage"]
55
body:
66
- type: markdown
77
attributes:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Documentation Issue"
2+
labels: ["documentation", "status: needs triage"]
3+
title: "doc: "
4+
description: "Did you find any errors, omissions, or unclear sections in the documentation?"
5+
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thank you for taking the time to file a complete bug report.
11+
12+
Before submitting your issue, please review the [relevant section](https://github.com/NVIDIA/NeMo-Guardrails/tree/develop/CONTRIBUTING.md#suggesting-enhancements-and-new-features) of our documentation.
13+
14+
- type: checkboxes
15+
attributes:
16+
label: Please also confirm the following
17+
options:
18+
- label: I have searched the [main issue tracker](https://github.com/NVIDIA/NeMo-Guardrails/issues) of NeMo Guardrails repository and believe that this is not a duplicate
19+
required: true
20+
- type: dropdown
21+
attributes:
22+
label: Issue Kind
23+
description: |
24+
What best describes the issue?
25+
options:
26+
- "Improving documentation"
27+
- "Error in existing documentation"
28+
- "Missing documentation"
29+
- "Unclear documentation"
30+
- "Other concerns with documentation"
31+
validations:
32+
required: true
33+
34+
- type: input
35+
attributes:
36+
label: Existing Link
37+
description: |
38+
If the documentation in question exists, please provide a link to it.
39+
placeholder: "https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/docs/"
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
attributes:
45+
label: Description
46+
description: |
47+
Please provide a detailed description of the feature, including any relevant information. You can use markdown syntax.
48+
validations:
49+
required: true

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Feature Request
22
description: Suggest a new feature
33
title: "feature: "
4-
labels: [enhancement]
4+
labels: ["enhancement", "status: needs triage"]
55
body:
66
- type: checkboxes
77
attributes:

.github/scripts/build.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status.
4+
set -e
5+
6+
# Define variables for paths
7+
PACKAGE_DIR="nemoguardrails"
8+
CHAT_UI_SRC="chat-ui"
9+
EXAMPLES_SRC="examples"
10+
CHAT_UI_DST="$PACKAGE_DIR/chat-ui"
11+
EXAMPLES_DST="$PACKAGE_DIR/examples"
12+
13+
# Copy the directories into the package directory
14+
cp -r "$CHAT_UI_SRC" "$CHAT_UI_DST"
15+
cp -r "$EXAMPLES_SRC" "$EXAMPLES_DST"
16+
17+
# Build the wheel using Poetry
18+
poetry build
19+
20+
# Remove the copied directories after building
21+
rm -rf "$CHAT_UI_DST"
22+
rm -rf "$EXAMPLES_DST"

.github/workflows/_test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Reusable Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
description: "Operating system name"
8+
required: true
9+
default: Ubuntu
10+
type: string
11+
image:
12+
description: "Runner image"
13+
required: true
14+
default: ubuntu-latest
15+
type: string
16+
python-version:
17+
description: "Python version to test against"
18+
required: true
19+
default: "3.10"
20+
type: string
21+
22+
defaults:
23+
run:
24+
shell: bash
25+
env:
26+
POETRY_VERSION: 1.8.2
27+
28+
jobs:
29+
tests:
30+
name: ${{ inputs.os }} / Python ${{ inputs.python-version }}
31+
runs-on: ${{ inputs.image }}
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up Python ${{ inputs.python-version }}
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ inputs.python-version }}
40+
41+
- name: Get full Python version
42+
id: full-python-version
43+
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
44+
45+
- name: Bootstrap poetry (Linux and macOS)
46+
run: |
47+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
48+
49+
- name: Update PATH (Linux and macOS)
50+
if: runner.os != 'Windows'
51+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
52+
53+
- name: Update PATH for Windows
54+
if: runner.os == 'Windows'
55+
run: echo "$APPDATA\\Python\\Scripts" >> $GITHUB_PATH
56+
57+
- name: Configure poetry
58+
run: poetry config virtualenvs.in-project true
59+
60+
- name: Set up cache
61+
uses: actions/cache@v4
62+
id: cache
63+
with:
64+
path: .venv
65+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
66+
67+
- name: Ensure cache is healthy
68+
if: steps.cache.outputs.cache-hit == 'true'
69+
run: timeout 10s poetry run pip --version || rm -rf .venv
70+
71+
- name: Check Poetry .lock
72+
run: poetry check --lock
73+
74+
- name: Install dependencies
75+
run: poetry install --with dev
76+
77+
- name: Run pre-commit hooks
78+
run: poetry run make pre_commit
79+
80+
- name: Run pytest
81+
run: poetry run pytest -v

.github/workflows/build-wheel.yml

Lines changed: 0 additions & 98 deletions
This file was deleted.

.github/workflows/full-tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Full Tests
2+
3+
on:
4+
pull_request:
5+
types: [review_requested, ready_for_review]
6+
paths-ignore:
7+
- "**/*.md"
8+
push:
9+
tags:
10+
- "v*"
11+
workflow_dispatch:
12+
13+
jobs:
14+
call-tests:
15+
strategy:
16+
matrix:
17+
os: [Windows, macOS] # exclude Ubuntu as it is available in pr-tests
18+
python-version: ["3.9", "3.10", "3.11"]
19+
include:
20+
- os: Ubuntu
21+
image: ubuntu-latest
22+
- os: Windows
23+
image: windows-2022
24+
- os: macOS
25+
image: macos-14
26+
fail-fast: false
27+
28+
uses: ./.github/workflows/_test.yml
29+
with:
30+
os: ${{ matrix.os }}
31+
image: ${{ matrix.image }}
32+
python-version: ${{ matrix.python-version }}

.github/workflows/lock-threads.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Lock Closed Threads"
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # 12:00 midnight UTC, daily
6+
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}
11+
12+
jobs:
13+
lock-issues:
14+
if: github.repository_owner == 'NVIDIA'
15+
runs-on: ubuntu-latest
16+
permissions:
17+
issues: write
18+
steps:
19+
- uses: dessant/lock-threads@v5
20+
with:
21+
process-only: issues
22+
issue-inactive-days: 30
23+
issue-comment: >
24+
This issue has been automatically locked since there
25+
has not been any recent activity after it was closed.
26+
Please open a new issue for related bugs and reference this issue there.
27+
28+
lock-prs:
29+
if: github.repository_owner == 'NVIDIA'
30+
runs-on: ubuntu-latest
31+
permissions:
32+
issues: write
33+
pull-requests: write
34+
steps:
35+
- uses: dessant/lock-threads@v5
36+
with:
37+
process-only: prs
38+
pr-inactive-days: 30
39+
pr-comment: >
40+
This pull request has been automatically locked since there
41+
has not been any recent activity after it was closed.
42+
Please open a new issue and reference this PR there.

.github/workflows/pr-tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PR Tests
2+
3+
# we don't ignore markdkowns to run pre-commits
4+
on:
5+
push:
6+
paths-ignore:
7+
- ".github/workflows/**"
8+
9+
jobs:
10+
call-tests:
11+
strategy:
12+
matrix:
13+
os: [Ubuntu]
14+
python-version: ["3.9", "3.10", "3.11"]
15+
include:
16+
- os: Ubuntu
17+
image: ubuntu-latest
18+
fail-fast: false
19+
uses: ./.github/workflows/_test.yml
20+
with:
21+
os: ${{ matrix.os }}
22+
image: ${{ matrix.image }}
23+
python-version: ${{ matrix.python-version }}

0 commit comments

Comments
 (0)