Skip to content

Commit

Permalink
Merge pull request #1 from Luanee/github-workflows
Browse files Browse the repository at this point in the history
GitHub workflows
  • Loading branch information
Luanee committed Sep 20, 2023
2 parents c6ca806 + 6d3d3b3 commit 25f8cc6
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 27 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Pipeline

on:
push:
branches:
- main
- dev
- bugfix
- "release/*"
pull_request:
branches:
- main
- dev
- bugfix
- "release/*"

jobs:
linting:
name: Linter (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements/requirements-dev.txt') }}-test-v05
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -r requirements/requirements-dev.txt
- name: Pip info
run: python -m pip list
- name: iSort
run: pre-commit run isort --all-files
- name: Black
if: always()
run: pre-commit run black --all-files
- name: Pylint
if: always()
run: pre-commit run pylint --all-files

testing:
runs-on: ubuntu-latest
env:
PYTEST_FLAGS: --cov=pandera_report --cov=tests --cov-report=term-missing --cov-report=xml:coverage/coverage.xml --cov-append --cov-branch
strategy:
matrix:
python-version: [ "3.9","3.10", "3.11" ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
fail-fast: false
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Issue ref: https://github.com/actions/setup-python/issues/436
# cache: "pip"
# cache-dependency-path: pyproject.toml
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements/requirements-dev.txt') }}-test-v05
- name: Install Dependencies
run: python -m pip install --upgrade pip
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: python -m pip install -r requirements/requirements-dev.txt
- run: mkdir coverage
- name: Test
run: python -m pytest tests ${{ env.PYTEST_FLAGS }}
- name: Store coverage files
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage/coverage.xml
36 changes: 23 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.11
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -30,18 +28,30 @@ repos:
rev: 23.3.0
hooks:
- id: black
- repo: local
- repo: https://github.com/pycqa/pylint
rev: v2.17.3
hooks:
- id: pylint
name: pylint
entry: poetry run pylint
language: system
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=pyproject.toml"
]
args: ["--disable=import-error", "--rcfile=pyproject.toml"]

- repo: local
hooks:
- id: update-requirements-txt
name: update-requirements-txt
description: 'Generate requirements.txt based on poetry.lock'
entry: poetry
args: [export, --without-hashes, --without, dev, --format, requirements.txt, --output, requirements/requirements.txt]
language: system
pass_filenames: false
- repo: local
hooks:
- id: update-requirements-txt
name: update-requirements-txt
description: 'Generate requirements.txt based on poetry.lock'
entry: poetry
args: [export, --without-hashes, --with, dev, --format, requirements.txt, --output, requirements/requirements-dev.txt]
language: system
pass_filenames: false
ci:
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
autoupdate_commit_msg: ⬆️ [pre-commit.ci] pre-commit autoupdate
autoupdate_commit_msg: ⬆️ [pre-commit.ci] Auto update from pre-commit hooks
3 changes: 2 additions & 1 deletion pandera_report/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Optional,
Type,
TypedDict,
Union,
)

import pandas as pd
Expand Down Expand Up @@ -56,7 +57,7 @@ def columns(self) -> TypedDict:
"""
return self._columns

def validate(self, schema: Type[pa.DataFrameModel] | pa.DataFrameSchema, df: pd.DataFrame) -> pd.DataFrame:
def validate(self, schema: Union[Type[pa.DataFrameModel], pa.DataFrameSchema], df: pd.DataFrame) -> pd.DataFrame:
"""
Validate a DataFrame using a Pandera schema and generate a quality report.
Expand Down
100 changes: 90 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Homepage = "https://github.com/Luanee/pandera-report"


[tool.poetry.dependencies]
python = "^3.11, <3.13"
python = "^3.9, <3.13"
pandas = "^2.1.0"
pandera = "0.16.1"
pre-commit = "^3.4.0"
Expand Down Expand Up @@ -99,6 +99,8 @@ addopts = '''
-p no:warnings
--strict-markers
--tb=short
--cov-report=xml:coverage/coverage.xml
--cov-report term-missing
--cov=pandera_report
--cov=tests
--cov-branch
Expand All @@ -122,12 +124,15 @@ fail_under=80

[tool.coverage.run]
branch = true
source = ["pandera_report"]
source = ["pandera_report", "tests"]
omit = [
"__init__.py", # Exclude test files from coverage analysis
"tests/*", # Exclude test files from coverage analysis
]

[tool.coverage.html]
directory = "coverage"


[tool.pylint.MASTER]
ignore-patterns = 'tests/,test_(.)*\.py,conftest.py'
Expand Down

0 comments on commit 25f8cc6

Please sign in to comment.