Skip to content

Commit 8fb3bf7

Browse files
authored
Merge pull request #283 from joe733/workshop
feat: refactoring; updates; fixes; bump version
2 parents e1c0419 + 2e0d0ec commit 8fb3bf7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2613
-2384
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/docs.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Documentation
2+
name: docs
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: ["master"]
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
env:
15+
BUILD_PATH: "."
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
steps:
21+
# checkout repository
22+
- name: Checkout repository
23+
uses: actions/checkout@v3
24+
# set up specific python version
25+
- name: Set up Python v3.11
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.11"
29+
# building
30+
- name: Install 'documentation' dependencies
31+
run: pip install -r python/requirements.mkdocs.txt
32+
- name: Build documentation
33+
run: python src/export docs
34+
# set up Pages
35+
- name: Set up Pages
36+
uses: actions/configure-pages@v3
37+
# upload static page
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v1
40+
with:
41+
path: ${{ env.BUILD_PATH }}/site
42+
deploy:
43+
runs-on: ubuntu-latest
44+
needs: build
45+
environment:
46+
name: github-pages
47+
url: ${{ steps.deployment.outputs.page_url }}
48+
# deploy documentation
49+
name: Deploy
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
uses: actions/deploy-pages@v1

.github/workflows/main.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/package.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Publish to PyPI
2+
name: package
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
permissions:
8+
contents: read
9+
env:
10+
BUILD_PATH: "."
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# checkout repository
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
# set up specific python version
19+
- name: Set up Python v3.8
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.8"
23+
# install dependencies
24+
- name: Install dependencies
25+
run: |
26+
python -m venv .venv
27+
./.venv/Scripts/python -m pip install --upgrade pip
28+
./.venv/Scripts/pip install .
29+
./.venv/Scripts/pip install -r python/requirements.sphinx.txt
30+
./.venv/Scripts/pip install build
31+
# build package
32+
- name: Build package
33+
run: ./.venv/Scripts/python src/export package
34+
# upload package as artifact
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v1
37+
with:
38+
path: ${{ env.BUILD_PATH }}/dist
39+
publish:
40+
runs-on: ubuntu-latest
41+
needs: build
42+
steps:
43+
# download artifact
44+
- name: Download artifact
45+
uses: actions/download-artifact@v3
46+
with:
47+
path: ${{ env.BUILD_PATH }}/dist
48+
# publish package
49+
- name: Publish to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pages.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/pycqa.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Python Code Quality Analysis
2+
name: pycqa
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master]
7+
pull_request:
8+
branches: [master]
9+
jobs:
10+
tooling:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# checkout repository
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
# set up specific python version
17+
- name: Set up Python v3.8
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.8"
21+
# tooling
22+
- name: Install 'tooling' dependencies
23+
run: pip install -r python/requirements.tooling.txt
24+
- name: Tooling
25+
run: |
26+
black .
27+
ruff check .
28+
pyright .
29+
testing:
30+
strategy:
31+
fail-fast: true
32+
matrix:
33+
os: [ubuntu-latest, macos-latest, windows-latest]
34+
python-version: ["3.8", "3.9", "3.10", "3.11"]
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
# checkout repository again!
38+
# ref: https://github.com/actions/checkout/issues/19
39+
- name: Checkout repository
40+
uses: actions/checkout@v3
41+
# set up specific python version
42+
- name: Set up Python v${{ matrix.python-version }}
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: ${{ matrix.python-version }}
46+
cache: "pip"
47+
# testing
48+
- name: Install 'testing' dependencies
49+
run: pip install pytest
50+
- name: Testing
51+
run: pytest .
Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
6-
# Bandit is a security linter designed to find common security issues in Python code.
7-
# This action will run Bandit on your codebase.
8-
# The results of the scan will be found under the Security tab of your repository.
9-
10-
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname
11-
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA
12-
13-
name: Bandit
1+
# Static Application Security Testing
2+
name: sast
143
on:
154
workflow_dispatch:
165
push:
176
branches: ["master"]
187
pull_request:
19-
# The branches below must be a subset of the branches above
208
branches: ["master"]
219
schedule:
22-
- cron: "28 12 * * 2"
23-
10+
- cron: "00 00 * * 0"
2411
jobs:
25-
bandit:
12+
sast:
2613
permissions:
2714
contents: read # for actions/checkout to fetch code
2815
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
2916
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
30-
3117
runs-on: ubuntu-latest
3218
steps:
3319
- uses: actions/checkout@v2
34-
- name: Bandit Scan
35-
uses: shundor/python-bandit-scan@9cc5aa4a006482b8a7f91134412df6772dbda22c
36-
with: # optional arguments
20+
- name: Bandit
21+
uses: mdegis/bandit-action@85fcc340c3b0bf5d86029abb49b9aac916d807b2
22+
with:
3723
# exit with 0, even with results found
38-
exit_zero: true # optional, default is DEFAULT
24+
# exit_zero: true # optional, default is DEFAULT
3925
# Github token of the repository (automatically created by Github)
4026
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
4127
# File or directory to run bandit on
42-
path: ./validators # optional, default is .
28+
path: ./src/validators # optional, default is .
4329
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
4430
# level: # optional, default is UNDEFINED
4531
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
4632
# confidence: # optional, default is UNDEFINED
4733
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
48-
excluded_paths: tests,docs,.github # optional, default is DEFAULT
34+
excluded_paths: .github,.pytest_cache,.venv,.vscode,site,tests # optional, default is DEFAULT
4935
# comma-separated list of test IDs to skip
5036
# skips: # optional, default is DEFAULT
5137
# path to a .bandit file that supplies command line arguments
5238
# ini_path: # optional, default is DEFAULT
39+
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname
40+
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ ipython_config.py
111111
# in version control.
112112
# https://pdm.fming.dev/#use-with-ide
113113
.pdm.toml
114+
.pdm-python
115+
.pdm-build/
114116

115117
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116118
__pypackages__/
@@ -167,3 +169,6 @@ cython_debug/
167169

168170
# asdf
169171
.tool-versions
172+
173+
# ruff
174+
.ruff_cache

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ repos:
1414
args: ["--branch", "master"]
1515
- id: trailing-whitespace
1616
- repo: https://github.com/psf/black
17-
rev: 23.3.0
17+
rev: 23.7.0
1818
hooks:
1919
- id: black
20-
- repo: https://github.com/PyCQA/isort
21-
rev: 5.12.0
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.0.282
2222
hooks:
23-
- id: isort
24-
- repo: https://github.com/PyCQA/flake8
25-
rev: 6.0.0
23+
- id: ruff
24+
- repo: https://github.com/RobertCraigie/pyright-python
25+
rev: v1.1.320
2626
hooks:
27-
- id: flake8
27+
- id: pyright

0 commit comments

Comments
 (0)