pyspark-testframework 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyspark_testframework-0.1.0/.github/labeler.yml +12 -0
- pyspark_testframework-0.1.0/.github/release.yml +20 -0
- pyspark_testframework-0.1.0/.github/workflows/cicd.yml +57 -0
- pyspark_testframework-0.1.0/.github/workflows/cicd_woonstad_rotterdam.yml +60 -0
- pyspark_testframework-0.1.0/.github/workflows/labeler.yml +12 -0
- pyspark_testframework-0.1.0/.github/workflows/publish-to-pypi.yml +143 -0
- pyspark_testframework-0.1.0/.gitignore +165 -0
- pyspark_testframework-0.1.0/.pre-commit-config.yaml +74 -0
- pyspark_testframework-0.1.0/LICENSE +21 -0
- pyspark_testframework-0.1.0/PKG-INFO +104 -0
- pyspark_testframework-0.1.0/README.md +57 -0
- pyspark_testframework-0.1.0/pyproject.toml +51 -0
- pyspark_testframework-0.1.0/setup.cfg +4 -0
- pyspark_testframework-0.1.0/src/pyspark_testframework.egg-info/PKG-INFO +104 -0
- pyspark_testframework-0.1.0/src/pyspark_testframework.egg-info/SOURCES.txt +26 -0
- pyspark_testframework-0.1.0/src/pyspark_testframework.egg-info/dependency_links.txt +1 -0
- pyspark_testframework-0.1.0/src/pyspark_testframework.egg-info/requires.txt +9 -0
- pyspark_testframework-0.1.0/src/pyspark_testframework.egg-info/top_level.txt +1 -0
- pyspark_testframework-0.1.0/src/testframework/__init__.py +0 -0
- pyspark_testframework-0.1.0/src/testframework/_version.py +16 -0
- pyspark_testframework-0.1.0/src/testframework/base.py +88 -0
- pyspark_testframework-0.1.0/src/testframework/tests.py +21 -0
- pyspark_testframework-0.1.0/src/testframework/utils/__init__.py +0 -0
- pyspark_testframework-0.1.0/src/testframework/utils/decorators.py +71 -0
- pyspark_testframework-0.1.0/tests/conftest.py +9 -0
- pyspark_testframework-0.1.0/tests/tests/test_regex_test.py +168 -0
- pyspark_testframework-0.1.0/tests/utils/decorators/test_account_for_nullable.py +196 -0
- pyspark_testframework-0.1.0/tests/utils/decorators/test_allowed_col_types.py +124 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Add 'Documentation' label to any changes within 'docs' folder or any subfolders
|
|
2
|
+
documentation:
|
|
3
|
+
- changed-files:
|
|
4
|
+
- any-glob-to-any-file:
|
|
5
|
+
- docs/**
|
|
6
|
+
- "**/*.md"
|
|
7
|
+
enhancement:
|
|
8
|
+
- head-branch: ["^feature", "feature"]
|
|
9
|
+
bug:
|
|
10
|
+
- head-branch: ["^bug", "bug", "^fix"]
|
|
11
|
+
chore:
|
|
12
|
+
- head-branch: ["^chore", "chore"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
exclude:
|
|
3
|
+
labels:
|
|
4
|
+
- ignore for release notes
|
|
5
|
+
categories:
|
|
6
|
+
- title: Breaking Changes 💥
|
|
7
|
+
labels:
|
|
8
|
+
- breaking change
|
|
9
|
+
- title: New Features 🎉
|
|
10
|
+
labels:
|
|
11
|
+
- enhancement
|
|
12
|
+
- title: Bugfixes 🐛
|
|
13
|
+
labels:
|
|
14
|
+
- bug
|
|
15
|
+
- title: Documentation 📚
|
|
16
|
+
labels:
|
|
17
|
+
- documentation
|
|
18
|
+
- title: Other Changes ✨
|
|
19
|
+
labels:
|
|
20
|
+
- "*"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: CICD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
CI:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Cache pre-commit environment
|
|
27
|
+
uses: actions/cache@v4
|
|
28
|
+
with:
|
|
29
|
+
path: |
|
|
30
|
+
~/.cache/pre-commit
|
|
31
|
+
./.pre-commit
|
|
32
|
+
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}-${{ matrix.python-version }}
|
|
33
|
+
restore-keys: |
|
|
34
|
+
${{ runner.os }}-precommit-${{ matrix.python-version }}-
|
|
35
|
+
${{ runner.os }}-precommit-
|
|
36
|
+
|
|
37
|
+
- name: Set up Java
|
|
38
|
+
uses: actions/setup-java@v4
|
|
39
|
+
with:
|
|
40
|
+
distribution: "temurin"
|
|
41
|
+
java-version: "11" # PySpark works well with Java 8 or 11
|
|
42
|
+
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: |
|
|
45
|
+
python -m pip install --upgrade pip
|
|
46
|
+
pip install ".[test]"
|
|
47
|
+
env:
|
|
48
|
+
PYTHONPATH: src # Ensure src is in the PYTHONPATH
|
|
49
|
+
|
|
50
|
+
- name: Run pre-commit hooks
|
|
51
|
+
run: pre-commit run --all-files
|
|
52
|
+
|
|
53
|
+
- name: Run pytest
|
|
54
|
+
env:
|
|
55
|
+
SPARK_LOCAL_IP: 127.0.0.1
|
|
56
|
+
PYTHONPATH: src # Ensure src is in the PYTHONPATH
|
|
57
|
+
run: python -m pytest
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# This CICD is specifically for the dependency versioning used by Woonstad Rotterdam (python3.9, pyspark3.3.4)
|
|
2
|
+
|
|
3
|
+
name: CICD_Woonstad_Rotterdam
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches: [main]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
CI:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.9"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Cache pre-commit environment
|
|
29
|
+
uses: actions/cache@v4
|
|
30
|
+
with:
|
|
31
|
+
path: |
|
|
32
|
+
~/.cache/pre-commit
|
|
33
|
+
./.pre-commit
|
|
34
|
+
key: ${{ runner.os }}-precommit-${{ hashFiles('.pre-commit-config.yaml') }}-${{ matrix.python-version }}
|
|
35
|
+
restore-keys: |
|
|
36
|
+
${{ runner.os }}-precommit-${{ matrix.python-version }}-
|
|
37
|
+
${{ runner.os }}-precommit-
|
|
38
|
+
|
|
39
|
+
- name: Set up Java
|
|
40
|
+
uses: actions/setup-java@v4
|
|
41
|
+
with:
|
|
42
|
+
distribution: "temurin"
|
|
43
|
+
java-version: "11" # PySpark works well with Java 8 or 11
|
|
44
|
+
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: |
|
|
47
|
+
python -m pip install --upgrade pip
|
|
48
|
+
pip install ".[test]"
|
|
49
|
+
pip install pyspark==3.3.4
|
|
50
|
+
env:
|
|
51
|
+
PYTHONPATH: src # Ensure src is in the PYTHONPATH
|
|
52
|
+
|
|
53
|
+
- name: Run pre-commit hooks
|
|
54
|
+
run: pre-commit run --all-files
|
|
55
|
+
|
|
56
|
+
- name: Run pytest
|
|
57
|
+
env:
|
|
58
|
+
SPARK_LOCAL_IP: 127.0.0.1
|
|
59
|
+
PYTHONPATH: src # Ensure src is in the PYTHONPATH
|
|
60
|
+
run: python -m pytest
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
name: Publish Python distribution
|
|
2
|
+
run-name: Publish release ${{ github.ref_name }}
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build distribution 📦
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ">=3.9"
|
|
19
|
+
- name: Install pypa/build
|
|
20
|
+
run: >-
|
|
21
|
+
python3 -m
|
|
22
|
+
pip install
|
|
23
|
+
build
|
|
24
|
+
--user
|
|
25
|
+
- name: Build a binary wheel and a source tarball
|
|
26
|
+
run: python3 -m build
|
|
27
|
+
- name: Store the distribution packages
|
|
28
|
+
uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: python-package-distributions
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish-to-testpypi:
|
|
34
|
+
name: Publish to TestPyPI
|
|
35
|
+
needs:
|
|
36
|
+
- build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: testpypi
|
|
40
|
+
url: https://test.pypi.org/p/pyspark-testframework
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download all the dists
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: python-package-distributions
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Publish distribution 📦 to TestPyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
52
|
+
with:
|
|
53
|
+
repository-url: https://test.pypi.org/legacy/
|
|
54
|
+
skip-existing: true
|
|
55
|
+
|
|
56
|
+
publish-to-pypi:
|
|
57
|
+
name: Publish to PyPI
|
|
58
|
+
needs:
|
|
59
|
+
- build
|
|
60
|
+
- publish-to-testpypi
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
environment:
|
|
63
|
+
name: pypi
|
|
64
|
+
url: https://pypi.org/p/pyspark-testframework
|
|
65
|
+
permissions:
|
|
66
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
67
|
+
|
|
68
|
+
steps:
|
|
69
|
+
- name: Download all the dists
|
|
70
|
+
uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: python-package-distributions
|
|
73
|
+
path: dist/
|
|
74
|
+
- name: Publish distribution 📦 to PyPI
|
|
75
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
76
|
+
with:
|
|
77
|
+
skip-existing: true
|
|
78
|
+
|
|
79
|
+
github-release:
|
|
80
|
+
name: >-
|
|
81
|
+
Sign the Python distribution with Sigstore
|
|
82
|
+
and upload them to GitHub Release
|
|
83
|
+
needs:
|
|
84
|
+
- publish-to-pypi
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
|
|
87
|
+
permissions:
|
|
88
|
+
contents: write # IMPORTANT: mandatory for making GitHub Releases
|
|
89
|
+
id-token: write # IMPORTANT: mandatory for sigstore
|
|
90
|
+
|
|
91
|
+
steps:
|
|
92
|
+
- name: Download all the dists
|
|
93
|
+
uses: actions/download-artifact@v4
|
|
94
|
+
with:
|
|
95
|
+
name: python-package-distributions
|
|
96
|
+
path: dist/
|
|
97
|
+
- name: Sign the dists with Sigstore
|
|
98
|
+
uses: sigstore/gh-action-sigstore-python@v2.1.1
|
|
99
|
+
with:
|
|
100
|
+
inputs: >-
|
|
101
|
+
./dist/*.tar.gz
|
|
102
|
+
./dist/*.whl
|
|
103
|
+
- name: Determine latest Release
|
|
104
|
+
env:
|
|
105
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
106
|
+
run: |
|
|
107
|
+
set +e
|
|
108
|
+
creatingPrerelease=${{ (contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc')) }}
|
|
109
|
+
|
|
110
|
+
echo "getting latest stable release"
|
|
111
|
+
latestTagName=$(gh release view --repo '${{ github.repository }}' --jq .tagName --json tagName)
|
|
112
|
+
|
|
113
|
+
# Determine if there are stable releases
|
|
114
|
+
stableReleasesFound=false
|
|
115
|
+
if [[ -n "$latestTagName" ]]; then
|
|
116
|
+
stableReleasesFound=true
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
if [[ "$creatingPrerelease" == true ]] || [[ "$stableReleasesFound" == false ]]; then
|
|
120
|
+
echo "getting latest release"
|
|
121
|
+
latestTagName=$(gh release list -L1 --repo '${{ github.repository }}' --json tagName --jq .[].tagName)
|
|
122
|
+
fi
|
|
123
|
+
echo "LATEST_TAG_NAME=$latestTagName" >> "$GITHUB_ENV"
|
|
124
|
+
- name: Create GitHub Release
|
|
125
|
+
env:
|
|
126
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
127
|
+
run: >-
|
|
128
|
+
gh release create
|
|
129
|
+
'${{ github.ref_name }}'
|
|
130
|
+
--repo '${{ github.repository }}'
|
|
131
|
+
${{ (contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc')) && '--prerelease' || ''}}
|
|
132
|
+
--generate-notes
|
|
133
|
+
${{ env.LATEST_TAG_NAME != '' && '--notes-start-tag $LATEST_TAG_NAME' || ''}}
|
|
134
|
+
- name: Upload artifact signatures to GitHub Release
|
|
135
|
+
env:
|
|
136
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
137
|
+
# Upload to GitHub Release using the `gh` CLI.
|
|
138
|
+
# `dist/` contains the built packages, and the
|
|
139
|
+
# sigstore-produced signatures and certificates.
|
|
140
|
+
run: >-
|
|
141
|
+
gh release upload
|
|
142
|
+
'${{ github.ref_name }}' dist/**
|
|
143
|
+
--repo '${{ github.repository }}'
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
110
|
+
.pdm.toml
|
|
111
|
+
.pdm-python
|
|
112
|
+
.pdm-build/
|
|
113
|
+
|
|
114
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
115
|
+
__pypackages__/
|
|
116
|
+
|
|
117
|
+
# Celery stuff
|
|
118
|
+
celerybeat-schedule
|
|
119
|
+
celerybeat.pid
|
|
120
|
+
|
|
121
|
+
# SageMath parsed files
|
|
122
|
+
*.sage.py
|
|
123
|
+
|
|
124
|
+
# Environments
|
|
125
|
+
.env
|
|
126
|
+
.venv
|
|
127
|
+
env/
|
|
128
|
+
venv/
|
|
129
|
+
ENV/
|
|
130
|
+
env.bak/
|
|
131
|
+
venv.bak/
|
|
132
|
+
|
|
133
|
+
# Spyder project settings
|
|
134
|
+
.spyderproject
|
|
135
|
+
.spyproject
|
|
136
|
+
|
|
137
|
+
# Rope project settings
|
|
138
|
+
.ropeproject
|
|
139
|
+
|
|
140
|
+
# mkdocs documentation
|
|
141
|
+
/site
|
|
142
|
+
|
|
143
|
+
# mypy
|
|
144
|
+
.mypy_cache/
|
|
145
|
+
.dmypy.json
|
|
146
|
+
dmypy.json
|
|
147
|
+
|
|
148
|
+
# Pyre type checker
|
|
149
|
+
.pyre/
|
|
150
|
+
|
|
151
|
+
# pytype static type analyzer
|
|
152
|
+
.pytype/
|
|
153
|
+
|
|
154
|
+
# Cython debug symbols
|
|
155
|
+
cython_debug/
|
|
156
|
+
|
|
157
|
+
# PyCharm
|
|
158
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
159
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
160
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
161
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
162
|
+
#.idea/
|
|
163
|
+
|
|
164
|
+
.python-version
|
|
165
|
+
src/testframework/_version.py
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
minimum_pre_commit_version: 3.0.0
|
|
2
|
+
|
|
3
|
+
exclude: (wettelijke-documenten|docs)
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
6
|
+
# Ruff version.
|
|
7
|
+
rev: v0.3.4
|
|
8
|
+
hooks:
|
|
9
|
+
# Run the linter.
|
|
10
|
+
- id: ruff
|
|
11
|
+
types_or: [python, pyi, jupyter]
|
|
12
|
+
args: [--fix]
|
|
13
|
+
# Run the formatter.
|
|
14
|
+
- id: ruff-format
|
|
15
|
+
types_or: [python, pyi, jupyter]
|
|
16
|
+
|
|
17
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
18
|
+
rev: v4.0.0-alpha.8
|
|
19
|
+
hooks:
|
|
20
|
+
- id: prettier
|
|
21
|
+
description: "Prettier is an opinionated code formatter for various languages, including JSON, YAML, Markdown, and more."
|
|
22
|
+
additional_dependencies:
|
|
23
|
+
- prettier@2.8.1
|
|
24
|
+
|
|
25
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
26
|
+
rev: v4.5.0
|
|
27
|
+
hooks:
|
|
28
|
+
- id: end-of-file-fixer
|
|
29
|
+
description: "Ensures that a file is either empty, or ends with one newline."
|
|
30
|
+
- id: mixed-line-ending
|
|
31
|
+
description: "Replaces or checks mixed line ending."
|
|
32
|
+
- id: trailing-whitespace
|
|
33
|
+
description: "Trims trailing whitespace."
|
|
34
|
+
exclude: '\.md$'
|
|
35
|
+
- id: debug-statements
|
|
36
|
+
description: "Check for debugger imports and py37+ `breakpoint()` calls in Python."
|
|
37
|
+
- id: detect-private-key
|
|
38
|
+
description: "Check for the existence of private keys."
|
|
39
|
+
|
|
40
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
41
|
+
rev: v1.9.0
|
|
42
|
+
hooks:
|
|
43
|
+
- id: mypy
|
|
44
|
+
additional_dependencies:
|
|
45
|
+
[
|
|
46
|
+
pydantic==2.*,
|
|
47
|
+
types-requests==2.*,
|
|
48
|
+
unidecode==1.*,
|
|
49
|
+
PyYAML==6.*,
|
|
50
|
+
types-pyyaml==6.*,
|
|
51
|
+
libcst==1.*,
|
|
52
|
+
types-python-dateutil==2.*,
|
|
53
|
+
]
|
|
54
|
+
description: "Mypy is an optional static type checker for Python."
|
|
55
|
+
args:
|
|
56
|
+
["--strict", "--ignore-missing-imports", "--allow-untyped-decorators"]
|
|
57
|
+
exclude: "tests"
|
|
58
|
+
|
|
59
|
+
- repo: https://github.com/PyCQA/bandit
|
|
60
|
+
rev: 1.7.8
|
|
61
|
+
hooks:
|
|
62
|
+
- id: bandit
|
|
63
|
+
description: "Bandit is a tool for finding common security issues in Python code."
|
|
64
|
+
entry: bandit
|
|
65
|
+
language: python
|
|
66
|
+
language_version: python3
|
|
67
|
+
types: [python]
|
|
68
|
+
require_serial: true
|
|
69
|
+
exclude: "tests"
|
|
70
|
+
- repo: https://github.com/jsh9/pydoclint
|
|
71
|
+
rev: 0.4.1
|
|
72
|
+
hooks:
|
|
73
|
+
- id: pydoclint
|
|
74
|
+
args: [--style=google]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Woonstad Rotterdam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyspark-testframework
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Testframework for PySpark DataFrames
|
|
5
|
+
Author-email: Woonstad Rotterdam <info@woonstadrotterdam.nl>, Tomer Gabay <tomer.gabay@woonstadrotterdam.nl>, Vincent van der Meij <vincent.van.der.meij@woonstadrotterdam.nl>, Tiddo Loos <tiddo.loos@woonstadrotterdam.nl>, Ben Verhees <ben.verhees@woonstadrotterdam.nl>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Woonstad Rotterdam
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/woonstadrotterdam/pyspark-testframework
|
|
29
|
+
Project-URL: Issues, https://github.com/woonstadrotterdam/pyspark-testframework/issues
|
|
30
|
+
Keywords: pyspark,dataframe,test,testframework
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Requires-Python: >=3.9.5
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: pyspark>=3.3.4
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pre-commit==3.7.1; extra == "test"
|
|
43
|
+
Requires-Dist: pytest==8.2.2; extra == "test"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pyspark-testframework[test]; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff==0.4.8; extra == "dev"
|
|
47
|
+
|
|
48
|
+
[](https://github.com/astral-sh/ruff)
|
|
49
|
+

|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
# pyspark-testframework
|
|
53
|
+
|
|
54
|
+
⏳ **Work in progress**
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+

|
|
58
|
+

|
|
59
|
+

|
|
60
|
+

|
|
61
|
+

|
|
62
|
+

|
|
63
|
+
&width=145>)
|
|
64
|
+
|
|
65
|
+
The goal of the `pyspark-testframework` is to provide a simple way to create tests for PySpark DataFrames. The test results are returned in DataFrame format as well.
|
|
66
|
+
|
|
67
|
+
## Example
|
|
68
|
+
|
|
69
|
+
Input DataFrame:
|
|
70
|
+
|
|
71
|
+
| primary_key | email |
|
|
72
|
+
| ----------- | ------------------------- |
|
|
73
|
+
| 1 | info@woonstadrotterdam.nl |
|
|
74
|
+
| 2 | infowoonstadrotterdam.nl |
|
|
75
|
+
| 3 | @woonstadrotterdam.nl |
|
|
76
|
+
| 4 | dev@woonstadrotterdam.nl |
|
|
77
|
+
| 5 | Null |
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from testframework.tests import RegexTest
|
|
81
|
+
|
|
82
|
+
email_regex = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
|
|
83
|
+
|
|
84
|
+
mail_tester = RegexTest(
|
|
85
|
+
name="ValidEmail",
|
|
86
|
+
pattern=email_regex
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
test_result = mail_tester.test(
|
|
90
|
+
df=df,
|
|
91
|
+
col="email",
|
|
92
|
+
nullable=False
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
test_result.show()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| primary_key | email\_\_ValidEmail |
|
|
99
|
+
| ----------- | ------------------- |
|
|
100
|
+
| 1 | True |
|
|
101
|
+
| 2 | False |
|
|
102
|
+
| 3 | False |
|
|
103
|
+
| 4 | True |
|
|
104
|
+
| 5 | False |
|