Skip to content

Commit 7d8b035

Browse files
committed
maint: misc changes to dev and ci
- moves `pre-commit` to `hooks` group - uses `isort` to add grouping comments, instead of ignoring them - `__init__.py` is ignored by `isort` for documentation - fix missing `-*- coding: utf-8 -*-` annotations - in GitHub actions, `main.yml`: - changed CI job name to `PreflightChecks` - updated poetry version to `1.4.1` - runs `tox` with strategy-matrix - makes flake8 ignore `.venv`
1 parent 24675a3 commit 7d8b035

File tree

7 files changed

+41
-45
lines changed

7 files changed

+41
-45
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,32 @@ on:
88
branches: [master]
99

1010
jobs:
11-
DevOps:
11+
PreflightChecks:
1212
runs-on: ubuntu-latest
1313
strategy:
14-
fail-fast: true
1514
matrix:
1615
python-version: ["3.8", "3.9", "3.10", "3.11"]
1716
steps:
18-
#----------------------------------------------
19-
# check-out repo and set-up python
20-
#----------------------------------------------
17+
# checkout repository
2118
- name: Checkout repository
2219
uses: actions/checkout@v3
20+
# setup specific python version
2321
- name: Setup Python v${{ matrix.python-version }}
24-
# id: setup-python
2522
uses: actions/setup-python@v4
2623
with:
2724
python-version: ${{ matrix.python-version }}
28-
#----------------------------------------------
29-
# install & configure poetry
30-
#----------------------------------------------
25+
# install & configure poetry
3126
- name: Install Poetry
3227
uses: snok/install-poetry@v1
3328
with:
34-
version: 1.3.2
29+
version: 1.4.1
3530
virtualenvs-create: true
3631
virtualenvs-in-project: true
37-
#----------------------------------------------
38-
# load cached venv if cache exists
39-
#----------------------------------------------
40-
# - name: Load cached venv
41-
# id: cached-poetry-dependencies
42-
# uses: actions/cache@v3
43-
# with:
44-
# path: .venv
45-
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
46-
#----------------------------------------------
47-
# install dependencies if cache does not exist
48-
#----------------------------------------------
49-
- name: Install test dependencies
50-
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
51-
run: poetry install --no-interaction --no-root --no-ansi --only tests
52-
#----------------------------------------------
53-
# run test suite
54-
#----------------------------------------------
55-
- name: Run tests
32+
# install dependencies
33+
- name: Install dependencies
34+
run: poetry install --no-interaction --no-ansi --without docs,hooks,sast
35+
# run preflight checks
36+
- name: Preflight checks with tox
5637
run: |
5738
source .venv/bin/activate
58-
pytest tests/
39+
tox

docs/gen_docs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Generate docs."""
2+
# -*- coding: utf-8 -*-
23

34
# standard
45
from shutil import rmtree, move, copy

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ include = ["CHANGES.md", "docs/*"]
2828
python = "^3.8"
2929

3030
[tool.poetry.group.dev.dependencies]
31-
pre-commit = "^3.2.0"
3231
tox = "^4.4.7"
3332

3433
[tool.poetry.group.docs.dependencies]
@@ -37,6 +36,9 @@ mkdocs-material = "^9.1.3"
3736
mkdocstrings = { extras = ["python"], version = "^0.20.0" }
3837
pyaml = "^21.10.1"
3938

39+
[tool.poetry.group.hooks.dependencies]
40+
pre-commit = "^3.2.0"
41+
4042
[tool.poetry.group.sast.dependencies]
4143
bandit = "^1.7.5"
4244

@@ -71,7 +73,9 @@ ensure_newline_before_comments = true
7173
extend_skip_glob = ["**/i18n/*"]
7274
force_grid_wrap = 0
7375
force_sort_within_sections = true
74-
ignore_comments = true
76+
import_heading_stdlib = "standard"
77+
import_heading_thirdparty = "external"
78+
import_heading_localfolder = "local"
7579
include_trailing_comma = true
7680
known_local_folder = ["validators"]
7781
length_sort = true

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
[flake8]
44
docstring-convention = google
5-
exclude = __pycache__,.github,.pytest_cache,.tox,.vscode,site,i18n
5+
exclude = __pycache__,.github,.pytest_cache,.tox,.venv,.vscode,site,i18n
66
max-line-length = 100

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
"""Tests."""
2+
# -*- coding: utf-8 -*-
3+
4+
# isort: skip_file

validators/__init__.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
"""Validate Anything!"""
22
# -*- coding: utf-8 -*-
33

4-
from .card import card_number, mastercard, unionpay, discover, diners, visa, amex, jcb
5-
from .hashes import sha512, sha256, sha224, sha1, md5
6-
from .utils import validator, ValidationFailure
7-
from .i18n import fi_business_id, fi_ssn
8-
from .mac_address import mac_address
9-
from .btc_address import btc_address
10-
from .ip_address import ipv6, ipv4
11-
from .hostname import hostname
4+
# isort: skip_file
5+
6+
# The following imports are sorted alphabetically, manually.
7+
# Each line is grouped based first or type, then sorted alphabetically.
8+
# This is for the reference documentation.
9+
10+
# local
1211
from .between import between
13-
from .length import length
12+
from .btc_address import btc_address
13+
from .card import amex, card_number, diners, discover, jcb, mastercard, unionpay, visa
1414
from .domain import domain
1515
from .email import email
16-
from .uuid import uuid
17-
from .slug import slug
16+
from .hashes import md5, sha1, sha224, sha256, sha512
17+
from .hostname import hostname
18+
from .i18n import fi_business_id, fi_ssn
1819
from .iban import iban
20+
from .ip_address import ipv4, ipv6
21+
from .length import length
22+
from .mac_address import mac_address
23+
from .slug import slug
1924
from .url import url
25+
from .utils import validator, ValidationFailure
26+
from .uuid import uuid
2027

2128
__all__ = (
2229
"amex",

0 commit comments

Comments
 (0)