Skip to content

Commit

Permalink
The main branch merged with the feature branch
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-qb committed Nov 12, 2023
2 parents 0ae09ff + 135a94a commit 2e4c47a
Show file tree
Hide file tree
Showing 98 changed files with 1,458 additions and 732 deletions.
2 changes: 1 addition & 1 deletion .github/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pre-commit
coverage[toml]>=6.5
pytest
dash[testing]
chromedriver-autoinstaller
chromedriver-autoinstaller-fix
toml
pyyaml
openpyxl
3 changes: 1 addition & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
cd ..
pip download vizro==${{needs.check-version.outputs.package_version}} -d . --no-deps --timeout 300
pypi=$(md5sum vizro-${{needs.check-version.outputs.package_version}}-py3-none-any.whl)
if [ $local = $pypi ]; then; echo "md5 hash is the same"; else; echo "md5 hash is not the same" exit 1; fi;
if [[ $local = $pypi ]]; then echo "md5 hash is the same"; else echo "md5 hash is not the same"; exit 1; fi
version-bump:
needs: [check-version, build-publish]
Expand All @@ -109,7 +109,6 @@ jobs:
hatch version patch,dev
hatch run changelog:add
hatch run schema
hatch run lint || hatch run lint
git config user.email "145135826+vizro-svc@users.noreply.github.com"
git config user.name "Vizro Team"
git add -A
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/checks-vizro-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:

concurrency:
group: checks-ai-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/checks-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ on:

concurrency:
group: checks-core-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/lint-vizro-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

concurrency:
group: lint-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand All @@ -40,8 +39,5 @@ jobs:
- name: Install Hatch
run: pip install --upgrade hatch

- name: List dependencies
run: hatch run all.py${{ matrix.python-version }}:pip freeze

- name: Lint
run: hatch run all.py${{ matrix.python-version }}:lint
run: hatch run lint:lint
111 changes: 56 additions & 55 deletions .github/workflows/test-integration-vizro-ai.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
#name: test-integration-vizro-ai
#
#defaults:
# run:
# working-directory: vizro-core
#
##### TODO: adjust below according to other scripts
#on:
# # push:
# # branches: [main]
# pull_request:
# # branches:
# # - "main"
#
#concurrency:
# group: test-integration-${{ github.head_ref }}
# cancel-in-progress: true
#
#env:
# PYTHONUNBUFFERED: "1"
# FORCE_COLOR: "1"
#
#jobs:
# run:
# name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest]
# python-version: ["3.9", "3.10", "3.11"]
#
# steps:
# - uses: actions/checkout@v4
# - name: Get branch name
# id: branch-name
# uses: tj-actions/branch-names@v7
#
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
#
# - uses: actions/cache@v3
# with:
# path: ${{ env.pythonLocation }}
# key: ${{ matrix.os }}-${{ matrix.python-version }}-${{ steps.branch-name.outputs.current_branch }}-pip-${{ hashFiles('hatch.toml') }}-${{ hashFiles('pyproject.toml') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.python-version }}-${{ steps.branch-name.outputs.current_branch }}-pip-
#
# - name: Run ubuntu integration tests
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: |
# pip install --upgrade hatch
# hatch run all.py${{ matrix.python-version }}:test-integration
name: test-integration-vizro-ai

defaults:
run:
working-directory: vizro-ai

on:
push:
branches: [main]
pull_request:
branches:
- "main"

concurrency:
group: test-integration-${{ github.head_ref }}

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
run:
name: Python ${{ matrix.python-version }} on Linux
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade hatch

- name: Run vizro-ai integration tests with pypi vizro
run: |
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
export OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE }}
hatch run all.py${{ matrix.python-version }}:test-integration
- name: Run vizro-ai integration tests with local vizro
run: |
export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
export OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE }}
cd ../vizro-core
hatch build
cd ../vizro-ai
hatch run all.py${{ matrix.python-version }}:pip install ../vizro-core/dist/vizro*.tar.gz
hatch run all.py${{ matrix.python-version }}:test-integration
1 change: 0 additions & 1 deletion .github/workflows/test-integration-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

concurrency:
group: test-integration-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-unit-vizro-ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

concurrency:
group: test-unit-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-unit-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:

concurrency:
group: test-unit-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
Expand Down
2 changes: 1 addition & 1 deletion tools/tools_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
werkzeug
werkzeug>=3.0.1
requests
16 changes: 16 additions & 0 deletions vizro-ai/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Read the Docs configuration file for MkDocs projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
commands:
- pip install hatch
- cd vizro-ai/ && hatch run docs:mkdocs build
- mkdir --parents $READTHEDOCS_OUTPUT
- mv vizro-ai/site/ $READTHEDOCS_OUTPUT/html
8 changes: 6 additions & 2 deletions vizro-ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ Vizro-AI is a tool for generating visualizations.

## Disclaimer

Please review the [Disclaimer](docs/pages/explanation/disclaimer.md) before using `vizro-ai` package.
Please review the [Disclaimer](https://vizro-ai.readthedocs.io/en/latest/pages/explanation/disclaimer/) before using `vizro-ai` package.

## Documentation

Here is the link to the [Documentation](docs/pages).
For more information, please refer to our [Documentation](https://vizro-ai.readthedocs.io/en/latest/).

## Acknowledgment

Vizro-AI is powered by [LangChain](https://github.com/langchain-ai/langchain).
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- Release of the Vizro Dash DataTable. Visit the [user guide on tables](https://vizro.readthedocs.io/en/stable/pages/user_guides/table/) to learn more. ([#114](https://github.com/mckinsey/vizro/pull/114))
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!-- ### Added
<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#114](https://github.com/mckinsey/vizro/pull/114)) -->
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
Expand Down
4 changes: 2 additions & 2 deletions vizro-ai/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Vizro-AI is a tool for generating data visualizations.
before using the `vizro-ai` package.

Since users must connect to Large Language Models (LLMs) in order to use Vizro-AI,
please also ensure that you review [usage of LLMs](pages/explanation/safety_in_vizro_ai.md)
and required [safeguarding for dynamic code evaluation](pages/explanation/safeguard.md).
please also ensure that you review our guides on the [usage of LLMs](pages/explanation/safety_in_vizro_ai.md)
and the required [safeguarding for dynamic code evaluation](pages/explanation/safeguard.md).


<div class="card-section-wrapper" style="display: block;">
Expand Down
10 changes: 10 additions & 0 deletions vizro-ai/docs/pages/explanation/safety_in_vizro_ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ These models can be exploited for various malicious activities. Users should be

It's crucial for users to remain informed, cautious, and ethical in their applications.

## Dependencies, Code Scanners and Infosec

It may occur that dependencies of `vizro-ai` get flagged by code scanners and other infosec tools. As a consequence it may happen that
`vizro-ai` also get flagged.

While we aim to resolve any flagged issues as soon as possible, there may not always be an immediate available fix, especially in a very dynamic environment such as generative AI. We encourage users to investigate if any flagged infosec issues are actually related
to any functionality used in our code base or if they only concern functionality outside the scope of `vizro-ai`.

In case those issues are related to code execution, note that `vizro-ai` has its own process of executing dynamic code (see [Safeguard Execution of Dynamic Code](safeguard.md)), and does not rely on its dependencies to do so.

## Execution of Dynamic Code in Vizro-AI

The `exec()` statement is used in `vizro-ai`. It allows for dynamic execution of Python programs which can be powerful, but can also pose security risk
Expand Down
4 changes: 4 additions & 0 deletions vizro-ai/docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@
td:not([class]):not(:last-child) {
border-right: 1px solid lightgrey;
}

.md-source__fact--version {
display: none;
}
16 changes: 11 additions & 5 deletions vizro-ai/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ scripts = {add = "scriv create --add"}
[envs.default]
dependencies = [
"devtools[pygments]",
"pre-commit",
"coverage[toml]>=6.5",
"pytest",
"toml",
"nbformat>=4.2.0"
"nbformat>=4.2.0",
"pyhamcrest"
]

[envs.default.env-vars]
Expand All @@ -30,11 +30,10 @@ cov-report = [
"- coverage combine",
"coverage report"
]
lint = "SKIP=gitleaks pre-commit run {args} --all-files"
lint = "hatch run lint:lint {args:--all-files}"
prep-release = [
"hatch version release",
"hatch run changelog:scriv collect --add",
"hatch run lint || hatch run lint",
"hatch run changelog:add",
'echo "Now raise a PR to merge into main with title: Release of vizro-ai $(hatch version)"'
]
Expand All @@ -46,7 +45,7 @@ test = [
]
test-cov = "coverage run -m pytest tests/unit {args}"
test-integration = [
"pytest tests/integration {args}"
"pytest -v tests/integration"
]
test-unit = "pytest tests/unit {args}"
update-snyk-requirements = "python ../tools/generate_snyk_requirements.py {args}"
Expand All @@ -61,5 +60,12 @@ dependencies = [
detached = true
scripts = {serve = "mkdocs serve"}

[envs.lint]
dependencies = [
"pre-commit"
]
detached = true
scripts = {lint = "SKIP=gitleaks pre-commit run {args:--all-files}"}

[version]
path = "src/vizro_ai/__init__.py"
6 changes: 3 additions & 3 deletions vizro-ai/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ nav:
# - Contributing: pages/contribute/contributing.md
- Authors: pages/contribute/authors.md

#TODO: this infers the version number of the latest release of whole repo
#repo_url: https://github.com/mckinsey/vizro/tree/main/vizro-ai
#repo_name: mckinsey/vizro-ai
# This infers the version number of the latest release of whole repo, so we're hiding it for sub-packed in extra.css
repo_url: https://github.com/mckinsey/vizro/tree/main/vizro-ai
repo_name: mckinsey/vizro-ai

theme:
name: material
Expand Down
4 changes: 2 additions & 2 deletions vizro-ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ classifiers = [
dependencies = [
"pandas",
"tabulate",
"openai>=0.27.8",
"langchain==0.0.317",
"openai>=0.27.8,<1.0.0", # TODO add support for openai>=1.0.0
"langchain==0.0.325",
"python-dotenv>=1.0.0", # TODO decide env var management to see if we need this
"vizro>=0.1.4", # TODO set upper bound later
"ipython>=8.10.0", # not directly required, pinned by Snyk to avoid a vulnerability: https://app.snyk.io/vuln/SNYK-PYTHON-IPYTHON-3318382
Expand Down
4 changes: 2 additions & 2 deletions vizro-ai/snyk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandas
tabulate
openai>=0.27.8
langchain==0.0.317
openai>=0.27.8,<1.0.0
langchain==0.0.325
python-dotenv>=1.0.0
vizro>=0.1.4
ipython>=8.10.0
Expand Down
2 changes: 1 addition & 1 deletion vizro-ai/src/vizro_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

__all__ = ["VizroAI"]

__version__ = "0.1.0.dev0"
__version__ = "0.1.0.dev2"

logging.basicConfig(level=os.getenv("VIZRO_AI_LOG_LEVEL", "INFO"))
Loading

0 comments on commit 2e4c47a

Please sign in to comment.