Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linting
Browse files Browse the repository at this point in the history
petar-qb committed Nov 12, 2023
2 parents 7812345 + bc9129e commit 0ae09ff
Showing 140 changed files with 5,433 additions and 825 deletions.
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
- [ ] I have not referenced individuals, products or companies in any commits, directly or indirectly
- [ ] I have not added data or restricted code in any commits, directly or indirectly
- [ ] I have updated the docstring of any public function/class/model changed
- [ ] I have added the PR number to the change description in the changelog fragment, e.g. `Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))` (if applicable)
- [ ] I have added tests to cover my changes (if applicable)

## Types of changes
4 changes: 2 additions & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ jobs:
run: |
cd "${{ needs.check-version.outputs.package_name }}/dist"
local=$(md5sum vizro-${{needs.check-version.outputs.package_version}}-py3-none-any.whl)
cd "${{ needs.check-version.outputs.package_name }}"
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;
@@ -107,7 +107,7 @@ jobs:
cd "${{ needs.check-version.outputs.package_name }}"
git checkout -b "release/version_bump_next_minor/${formatted_date}"
hatch version patch,dev
hatch run docs:changelog
hatch run changelog:add
hatch run schema
hatch run lint || hatch run lint
git config user.email "145135826+vizro-svc@users.noreply.github.com"
71 changes: 71 additions & 0 deletions .github/workflows/checks-vizro-ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: checks-vizro-ai
defaults:
run:
working-directory: vizro-ai

on:
push:
branches: [main]
paths:
- "vizro-ai/**"
pull_request:
branches:
- "main"
paths:
- "vizro-ai/**"

concurrency:
group: checks-ai-${{ 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: Check requirements for Snyk are up to date
run: hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check

- name: Find added changelog fragments
id: added-files
run: |
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 changelog:add' 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 is."
exit 1
else
echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!";
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lint-vizro-core
name: checks-vizro-core

defaults:
run:
@@ -7,12 +7,16 @@ defaults:
on:
push:
branches: [main]
paths:
- "vizro-core/**"
pull_request:
branches:
- "main"
paths:
- "vizro-core/**"

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

env:
@@ -43,21 +47,15 @@ jobs:
- 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 schema is up to date
run: hatch run all.py${{ matrix.python-version }}:schema --check

- name: Check requirements for Snyk are up to date
run: |
pwd
hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check
run: 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
@@ -68,9 +66,9 @@ jobs:
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 "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' 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."
echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is."
exit 1
else
echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!";
47 changes: 47 additions & 0 deletions .github/workflows/lint-vizro-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: lint-vizro-all

defaults:
run:
working-directory: vizro-core # but could be any folder

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.8"]

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
55 changes: 55 additions & 0 deletions .github/workflows/test-integration-vizro-ai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#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
48 changes: 48 additions & 0 deletions .github/workflows/test-unit-vizro-ai.yml
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
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ target-version = ["py38"]

[tool.codespell]
builtin = "clear,rare,en-GB_to_en-US"
ignore-words-list = "grey,ned"
ignore-words-list = "grey,ned,sav"

[tool.mypy]
# strict checks : strict = true
@@ -74,3 +74,6 @@ known-first-party = ["vizro"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.pylint]
max-args = 6
12 changes: 12 additions & 0 deletions vizro-ai/CHANGELOG.md
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 -->
Loading

0 comments on commit 0ae09ff

Please sign in to comment.