Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defaults:
run:
shell: bash
env:
POETRY_VERSION: 1.8.2
POETRY_VERSION: 2.1.2

jobs:
tests:
Expand Down
272 changes: 136 additions & 136 deletions .github/workflows/docs-build.yaml
Original file line number Diff line number Diff line change
@@ -1,148 +1,148 @@
name: docs-build

on:
pull_request:
branches: [develop]
types: [opened, synchronize]
paths:
- "docs/**"
- "**/*.md"
- "**/*.rst"
push:
branches: [develop]
tags:
- docs-v*
- v*
workflow_dispatch:
pull_request:
branches: [develop]
types: [opened, synchronize]
paths:
- "docs/**"
- "**/*.md"
- "**/*.rst"
push:
branches: [develop]
tags:
- docs-v*
- v*
workflow_dispatch:

defaults:
run:
shell: bash
run:
shell: bash

env:
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.8.2"
PYTHON_VERSION: "3.10"
POETRY_VERSION: "2.1.2"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Bootstrap poetry (Linux and macOS)
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install --only docs
- name: Build documentation
run: make docs
- name: Delete unnecessary files
run: |
sudo find _build -name .doctrees -prune -exec rm -rf {} \;
sudo find _build -name .buildinfo -exec rm {} \;
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: html-build-artifact
path: _build/docs
if-no-files-found: error
retention-days: 1
- name: Store PR information
if: github.event_name == 'pull_request'
run: |
mkdir ./pr
echo ${{ github.event.number }} > ./pr/pr.txt
echo ${{ github.event.pull_request.merged }} > ./pr/merged.txt
echo ${{ github.event.action }} > ./pr/action.txt
- name: Upload PR information
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr
path: pr/
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Bootstrap poetry (Linux and macOS)
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install --only docs
- name: Build documentation
run: make docs
- name: Delete unnecessary files
run: |
sudo find _build -name .doctrees -prune -exec rm -rf {} \;
sudo find _build -name .buildinfo -exec rm {} \;
- name: Upload HTML
uses: actions/upload-artifact@v4
with:
name: html-build-artifact
path: _build/docs
if-no-files-found: error
retention-days: 1
- name: Store PR information
if: github.event_name == 'pull_request'
run: |
mkdir ./pr
echo ${{ github.event.number }} > ./pr/pr.txt
echo ${{ github.event.pull_request.merged }} > ./pr/merged.txt
echo ${{ github.event.action }} > ./pr/action.txt
- name: Upload PR information
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr
path: pr/

store-html:
if: github.event_name == 'push' && github.repository_owner == 'NVIDIA'
needs: [build-docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "gh-pages"
- name: Initialize Git configuration
run: |
git config user.name docs-build
git config user.email [email protected]
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: html-build-artifact
path: ${{ github.ref_name }}
- name: Copy HTML directories
run: |
ls -asl
for i in `ls -d *`
do
echo "Git adding ${i}"
git add "${i}"
done
- name: Check or create dot-no-jekyll file
run: |
if [ -f ".nojekyll" ]; then
echo "The dot-no-jekyll file already exists."
exit 0
fi
touch .nojekyll
git add .nojekyll
- name: Check or create redirect page
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
resp=$(grep 'http-equiv="refresh"' index.html 2>/dev/null) || true
if [ -n "${resp}" ]; then
echo "The redirect file already exists."
exit 0
fi
# If any of these commands fail, fail the build.
def_branch=$(gh api "repos/${GITHUB_REPOSITORY}" --jq ".default_branch")
html_url=$(gh api "repos/${GITHUB_REPOSITORY}/pages" --jq ".html_url")
# Beware ugly quotation mark avoidance in the foll lines.
echo '<!DOCTYPE html>' > index.html
echo '<html>' >> index.html
echo ' <head>' >> index.html
echo ' <title>Redirect to documentation</title>' >> index.html
echo ' <meta charset="utf-8">' >> index.html
echo ' <meta http=equiv="refresh" content="3; URL='${html_url}${def_branch}'/index.html">' >> index.html
echo ' <link rel="canonical" href="'${html_url}${def_branch}'/index.html">' >> index.html
echo ' <script language="javascript">' >> index.html
echo ' function redirect() {' >> index.html
echo ' window.location.assign("'${html_url}${def_branch}'/index.html")' >> index.html
echo ' }' >> index.html
echo ' </script>' >> index.html
echo ' </head>' >> index.html
echo ' <body onload="redirect()">' >> index.html
echo ' <p>Please follow the link to the <a href="'${html_url}${def_branch}'/index.html">' >> index.html
echo ${def_branch}'</a> branch documentation.</p>' >> index.html
echo ' </body>' >> index.html
echo '</html>' >> index.html
git add index.html
- name: Commit changes to the GitHub Pages branch
run: |
git status
if git commit -m 'Pushing changes to GitHub Pages.'; then
git push -f
else
echo "Nothing changed."
fi
store-html:
if: github.event_name == 'push' && github.repository_owner == 'NVIDIA'
needs: [build-docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "gh-pages"
- name: Initialize Git configuration
run: |
git config user.name docs-build
git config user.email [email protected]
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: html-build-artifact
path: ${{ github.ref_name }}
- name: Copy HTML directories
run: |
ls -asl
for i in `ls -d *`
do
echo "Git adding ${i}"
git add "${i}"
done
- name: Check or create dot-no-jekyll file
run: |
if [ -f ".nojekyll" ]; then
echo "The dot-no-jekyll file already exists."
exit 0
fi
touch .nojekyll
git add .nojekyll
- name: Check or create redirect page
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
resp=$(grep 'http-equiv="refresh"' index.html 2>/dev/null) || true
if [ -n "${resp}" ]; then
echo "The redirect file already exists."
exit 0
fi
# If any of these commands fail, fail the build.
def_branch=$(gh api "repos/${GITHUB_REPOSITORY}" --jq ".default_branch")
html_url=$(gh api "repos/${GITHUB_REPOSITORY}/pages" --jq ".html_url")
# Beware ugly quotation mark avoidance in the foll lines.
echo '<!DOCTYPE html>' > index.html
echo '<html>' >> index.html
echo ' <head>' >> index.html
echo ' <title>Redirect to documentation</title>' >> index.html
echo ' <meta charset="utf-8">' >> index.html
echo ' <meta http=equiv="refresh" content="3; URL='${html_url}${def_branch}'/index.html">' >> index.html
echo ' <link rel="canonical" href="'${html_url}${def_branch}'/index.html">' >> index.html
echo ' <script language="javascript">' >> index.html
echo ' function redirect() {' >> index.html
echo ' window.location.assign("'${html_url}${def_branch}'/index.html")' >> index.html
echo ' }' >> index.html
echo ' </script>' >> index.html
echo ' </head>' >> index.html
echo ' <body onload="redirect()">' >> index.html
echo ' <p>Please follow the link to the <a href="'${html_url}${def_branch}'/index.html">' >> index.html
echo ${def_branch}'</a> branch documentation.</p>' >> index.html
echo ' </body>' >> index.html
echo '</html>' >> index.html
git add index.html
- name: Commit changes to the GitHub Pages branch
run: |
git status
if git commit -m 'Pushing changes to GitHub Pages.'; then
git push -f
else
echo "Nothing changed."
fi
4 changes: 2 additions & 2 deletions .github/workflows/test-and-build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build-wheel:
runs-on: ubuntu-latest
env:
POETRY_VERSION: "1.8.2"
POETRY_VERSION: "2.1.2"
PYTHON_VERSION: "3.11"
outputs:
artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
- name: Install Wheel
run: |
pip install --upgrade pip
pip install poetry==1.8.2
pip install poetry==2.1.2
pip install ./*.whl

- name: Start server in the background
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include:

variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
POETRY_VERSION: "1.8.2"
POETRY_VERSION: "2.1.2"
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
LATEST_TAG: $CI_REGISTRY_IMAGE:latest

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ To get started quickly, follow the steps below.

This will run the test suite to ensure everything is set up correctly.

> **Note**: You should use `poetry run` to run commands within the virtual environment. If you want to avoid prefixing commands with `poetry run`, you can activate the environment using `poetry shell`. This will start a new shell with the virtual environment activated, allowing you to run commands directly.
> **Note**: You should use `poetry run` to run commands within the virtual environment. If you want to avoid prefixing commands with `poetry run`, you can activate the environment using `poetry shell` or follow the docs here if you are using poetry >2 . ForThis will start a new shell with the virtual environment activated, allowing you to run commands directly.

### Contribution Workflow

Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# syntax=docker/dockerfile:experimental

# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
Expand All @@ -21,7 +20,7 @@ FROM python:3.10
RUN apt-get update && apt-get install -y git gcc g++

# Set POETRY_VERSION environment variable
ENV POETRY_VERSION=1.8.2
ARG POETRY_VERSION=2.1.2

RUN if [ "$(uname -m)" = "x86_64" ]; then \
export ANNOY_COMPILER_ARGS="-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUILD,-march=x86-64"; \
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "NeMo Guardrails is an open-source toolkit for easily adding progr
authors = ["NVIDIA <[email protected]>"]
license = "LICENSE.md"
readme = "README.md"
version = "0.13.0"
version = "0.14.0-rc1"
packages = [{ include = "nemoguardrails" }]


Expand Down Expand Up @@ -163,5 +163,5 @@ log-level = "DEBUG"
log_cli = "False"

[build-system]
requires = ["poetry-core>=1.0.0,<2.0.0"]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
3 changes: 1 addition & 2 deletions qa/Dockerfile.qa
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# syntax=docker/dockerfile:experimental

# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
Expand All @@ -21,7 +20,7 @@ FROM python:3.10
RUN apt-get update && apt-get install -y git gcc g++

# Set POETRY_VERSION environment variable
ENV POETRY_VERSION=1.8.2
ARG POETRY_VERSION=2.1.2

ENV ANNOY_COMPILER_ARGS="-D_CRT_SECURE_NO_WARNINGS,-DANNOYLIB_MULTITHREADED_BUILD,-march=x86-64"

Expand Down
Loading