forked from mckinsey/vizro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37a494c
commit 93ce0d4
Showing
8 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: lint-vizro-ai | ||
defaults: | ||
run: | ||
working-directory: vizro-ai | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
concurrency: | ||
group: lint-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
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"] | ||
|
||
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: List dependencies | ||
run: hatch run all.py${{ matrix.python-version }}:pip freeze | ||
|
||
- name: Lint | ||
run: hatch run all.py${{ matrix.python-version }}:lint | ||
|
||
- name: Check requirements for Snyk are up to date | ||
run: | | ||
pwd | ||
hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check | ||
- name: Find added changelog fragments | ||
id: added-files | ||
run: | | ||
pwd | ||
if ${{ github.event_name == 'pull_request' }}; then | ||
echo "added_files=$(git diff --name-only --diff-filter=A -r HEAD^1 HEAD -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT | ||
else | ||
echo "added_files=$(git diff --name-only --diff-filter=A ${{ github.event.before }} ${{ github.event.after }} -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Fail if no fragment added in PR | ||
run: | | ||
if [ -z "${{ steps.added-files.outputs.added_files }}" ]; | ||
then | ||
echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run docs:changelog' to create such a fragment."; | ||
echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user." | ||
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as." | ||
exit 1 | ||
else | ||
echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!"; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#name: test-integration-vizro-ai | ||
# | ||
#defaults: | ||
# run: | ||
# working-directory: vizro-core | ||
# | ||
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: test-unit-vizro-ai | ||
|
||
defaults: | ||
run: | ||
working-directory: vizro-ai | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: | ||
- "main" | ||
|
||
concurrency: | ||
group: test-unit-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHONUNBUFFERED: "1" | ||
FORCE_COLOR: "1" | ||
|
||
jobs: | ||
run: | ||
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- 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: List dependencies | ||
run: hatch run all.py${{ matrix.python-version }}:pip freeze | ||
|
||
- name: Run unit tests | ||
run: | | ||
hatch run all.py${{ matrix.python-version }}:cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ repos: | |
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
args: [-L sav] | ||
additional_dependencies: | ||
- tomli | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,6 @@ known-first-party = ["vizro"] | |
|
||
[tool.ruff.pydocstyle] | ||
convention = "google" | ||
|
||
[tool.ruff.pylint] | ||
max-args = 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
<!-- All enhancements and patches to vizro will be documented | ||
in this file. It adheres to the structure of http://keepachangelog.com/. | ||
This project adheres to Semantic Versioning (http://semver.org/). --> | ||
|
||
## Unreleased | ||
|
||
See the fragment files in the [changelog.d directory](https://github.com/mckinsey/vizro/tree/main/vizro-ai/changelog.d). | ||
|
||
<!-- scriv-insert-here --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[envs.all] | ||
|
||
[[envs.all.matrix]] | ||
python = ["3.9", "3.10", "3.11"] | ||
|
||
[envs.changelog] | ||
dependencies = ["scriv"] | ||
detached = true | ||
scripts = {add = "scriv create --add"} | ||
|
||
[envs.default] | ||
dependencies = [ | ||
"devtools[pygments]", | ||
"pre-commit", | ||
"coverage[toml]>=6.5", | ||
"pytest", | ||
"toml", | ||
"nbformat>=4.2.0" | ||
] | ||
|
||
[envs.default.env-vars] | ||
VIZRO_AI_LOG_LEVEL = "DEBUG" | ||
|
||
[envs.default.scripts] | ||
cov = [ | ||
"test-cov", | ||
"cov-report" | ||
] | ||
cov-report = [ | ||
"- coverage combine", | ||
"coverage report" | ||
] | ||
lint = "SKIP=gitleaks pre-commit run {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)"' | ||
] | ||
pypath = "hatch run python -c 'import sys; print(sys.executable)'" | ||
secrets = "pre-commit run gitleaks --all-files" | ||
test = [ | ||
"test-unit", | ||
"test-integration" | ||
] | ||
test-cov = "coverage run -m pytest tests/unit {args}" | ||
test-integration = [ | ||
"pytest tests/integration {args}" | ||
] | ||
test-unit = "pytest tests/unit {args}" | ||
update-snyk-requirements = "python ../tools/generate_snyk_requirements.py {args}" | ||
|
||
[envs.docs] | ||
dependencies = [ | ||
"mkdocs", | ||
"mkdocs-material", | ||
"mkdocs-git-revision-date-localized-plugin", | ||
"mkdocstrings[python]" | ||
] | ||
detached = true | ||
|
||
[envs.docs.scripts] | ||
serve = "mkdocs serve" | ||
|
||
[version] | ||
path = "src/vizro_ai/__init__.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
site_name: Vizro-AI | ||
site_url: https://mckinsey.github.io/vizro-ai/ | ||
nav: | ||
- Vizro-AI: index.md | ||
- Get started: | ||
- Quickstart: pages/tutorials/quickstart.md | ||
- User Guides: | ||
- Fundamentals: | ||
- Installation: pages/user_guides/install.md | ||
- API Setup: pages/user_guides/api_setup.md | ||
- Run Methods: pages/user_guides/run_vizro_ai.md | ||
- Model Configuration: pages/user_guides/model_config.md | ||
- Explanation: | ||
- Disclaimer: pages/explanation/disclaimer.md | ||
- Safeguard Code Execution: pages/explanation/safeguard.md | ||
- Safety in Vizro AI: pages/explanation/safety_in_vizro_ai.md | ||
- Contribute: | ||
# - Contributing: pages/contribute/contributing.md | ||
- Authors: pages/contribute/authors.md | ||
|
||
repo_url: https://github.com/mckinsey/vizro/tree/main/vizro-ai | ||
repo_name: mckinsey/vizro-ai #TODO: this infers the version number of the latest release... | ||
|
||
theme: | ||
name: material | ||
language: en | ||
palette: | ||
- scheme: default | ||
font: | ||
text: Roboto | ||
code: Roboto Mono | ||
icon: | ||
repo: fontawesome/brands/github | ||
features: | ||
- navigation.instant | ||
- navigation.tabs | ||
- navigation.tabs.sticky | ||
- navigation.sections | ||
- navigation.tracking | ||
- search.suggest | ||
- search.highlight | ||
- content.tabs.link | ||
- content.code.annotation | ||
- content.code.copy | ||
- content.code.annotate | ||
|
||
watch: | ||
- src | ||
|
||
markdown_extensions: | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- admonition | ||
- pymdownx.arithmatex: | ||
generic: true | ||
- footnotes | ||
- pymdownx.details | ||
- pymdownx.superfences | ||
- pymdownx.tabbed: | ||
alternate_style: true | ||
- pymdownx.mark | ||
- attr_list | ||
- md_in_html | ||
|
||
plugins: | ||
- search | ||
- autorefs | ||
- mkdocstrings: | ||
handlers: | ||
python: | ||
options: | ||
show_source: false #currently doesn't show source at correct level, and not for pydantic models | ||
docstring_style: google | ||
merge_init_into_class: true | ||
docstring_section_style: list | ||
separate_signature: true | ||
# filters: ["!^_"] | ||
show_root_heading: true | ||
docstring_options: | ||
ignore_init_summary: true | ||
paths: [src] | ||
- git-revision-date-localized: | ||
enable_creation_date: false | ||
|
||
extra_css: | ||
- stylesheets/extra.css |