Skip to content

Commit a9dc5e1

Browse files
committed
Add tooling/config files and update repo settings
Add and expand repository configuration for linting, formatting, CI and packaging: new Bandit, Black, isort, hadolint, coverage, Docker ignore, EditorConfig, gitattributes, gitconfig, .github auto-assign workflow, pre-commit and various other config files. Update CI/dev environment Python target to 3.15 (devcontainer README and pypi-publish workflow). Update SECURITY.md contact/org to Scape Press and info@scape.press. These changes standardize developer tooling, enforce consistent formatting, improve security scans, and reduce Docker build context size.
1 parent 089e47b commit a9dc5e1

46 files changed

Lines changed: 7166 additions & 172 deletions

Some content is hidden

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

.bandit.yaml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# =============================================================================
2+
# Bandit Configuration
3+
# =============================================================================
4+
#
5+
# Python security linter for finding common security issues.
6+
# Documentation: https://bandit.readthedocs.io/
7+
#
8+
# This file is portable - copy to other repos without modification.
9+
#
10+
# -----------------------------------------------------------------------------
11+
# Usage
12+
# -----------------------------------------------------------------------------
13+
#
14+
# Scan source directory:
15+
# bandit -r src/ -c .bandit.yaml
16+
#
17+
# Scan with verbose output:
18+
# bandit -r src/ -c .bandit.yaml -v
19+
#
20+
# Generate report (JSON):
21+
# bandit -r src/ -c .bandit.yaml -f json -o bandit-report.json
22+
#
23+
# List all available tests:
24+
# bandit --list
25+
#
26+
# -----------------------------------------------------------------------------
27+
# Severity Levels
28+
# -----------------------------------------------------------------------------
29+
#
30+
# LOW: Informational, low impact
31+
# MEDIUM: Possible security issue, should investigate
32+
# HIGH: Likely security vulnerability, requires attention
33+
#
34+
# -----------------------------------------------------------------------------
35+
# Confidence Levels
36+
# -----------------------------------------------------------------------------
37+
#
38+
# LOW: Uncertain detection, may be false positive
39+
# MEDIUM: Likely correct, review recommended
40+
# HIGH: Very likely a real issue
41+
#
42+
# =============================================================================
43+
44+
# =============================================================================
45+
# Excluded Directories
46+
# =============================================================================
47+
#
48+
# Directories to skip during scanning.
49+
# Typically excludes tests, dependencies, and development artifacts.
50+
#
51+
# -----------------------------------------------------------------------------
52+
53+
exclude_dirs:
54+
# Test directories (assertions and test data are expected)
55+
- tst
56+
- tests
57+
58+
# Development scratch directories
59+
- bup
60+
- wip
61+
- tmp
62+
63+
# Django migrations (auto-generated, not security-relevant)
64+
- migrations
65+
66+
# Dependencies (scanned separately or not our code)
67+
- node_modules
68+
- .venv
69+
- venv
70+
71+
# =============================================================================
72+
# Skipped Tests
73+
# =============================================================================
74+
#
75+
# Test IDs to skip globally. Use sparingly - prefer inline # nosec comments
76+
# for specific false positives.
77+
#
78+
# Test ID Reference: https://bandit.readthedocs.io/en/latest/plugins/
79+
#
80+
# Format: B### where ### is the test number
81+
#
82+
# Common categories:
83+
# B1xx: Miscellaneous tests
84+
# B2xx: Application/framework-specific
85+
# B3xx: Blacklists (dangerous function calls)
86+
# B4xx: Cryptographic issues
87+
# B5xx: Shell injection risks
88+
# B6xx: SSH/XML issues
89+
# B7xx: Django/Flask-specific
90+
#
91+
# -----------------------------------------------------------------------------
92+
93+
skips:
94+
# -------------------------------------------------------------------------
95+
# B101: assert_used
96+
# -------------------------------------------------------------------------
97+
# Using assert statements for validation.
98+
# Asserts are stripped in optimized bytecode (python -O), but we use them
99+
# intentionally in tests and for internal invariant checks.
100+
# Skip: Tests use assert; non-test asserts should use proper validation.
101+
- B101
102+
103+
# -------------------------------------------------------------------------
104+
# B311: random
105+
# -------------------------------------------------------------------------
106+
# Using pseudo-random generators (random module).
107+
# The random module is NOT cryptographically secure, but is fine for:
108+
# - Test data generation
109+
# - UI shuffling
110+
# - Non-security randomness
111+
# Skip: We don't use random for security-sensitive operations.
112+
- B311
113+
114+
# -------------------------------------------------------------------------
115+
# B601: paramiko_calls
116+
# -------------------------------------------------------------------------
117+
# Paramiko SSH library usage.
118+
# Skip: This project doesn't use Paramiko.
119+
- B601
120+
121+
# =============================================================================
122+
# Per-File Ignores (Alternative to skips)
123+
# =============================================================================
124+
#
125+
# Instead of global skips, you can use inline comments:
126+
#
127+
# # nosec B101
128+
# assert user.is_authenticated
129+
#
130+
# result = random.choice(items) # nosec B311 - not security-sensitive
131+
#
132+
# Or configure per-file in pyproject.toml:
133+
#
134+
# [tool.bandit.assert_used]
135+
# skips = ["**/test_*.py", "**/conftest.py"]
136+
#
137+
# =============================================================================

.black.toml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# =============================================================================
2+
# Black Configuration
3+
# =============================================================================
4+
#
5+
# The uncompromising Python code formatter.
6+
# Documentation: https://black.readthedocs.io/
7+
#
8+
# This file is portable - copy to other repos without modification.
9+
#
10+
# -----------------------------------------------------------------------------
11+
# Usage
12+
# -----------------------------------------------------------------------------
13+
#
14+
# Format all Python files:
15+
# black src/ tst/ exe/
16+
#
17+
# Check without modifying (CI mode):
18+
# black --check src/ tst/ exe/
19+
#
20+
# Show diff of changes:
21+
# black --diff src/
22+
#
23+
# Format single file:
24+
# black src/swing/package/module.py
25+
#
26+
# -----------------------------------------------------------------------------
27+
# Philosophy
28+
# -----------------------------------------------------------------------------
29+
#
30+
# Black is opinionated by design - it has very few configuration options.
31+
# This reduces bikeshedding and ensures consistent formatting across projects.
32+
#
33+
# "Any color you like, as long as it's black."
34+
#
35+
# -----------------------------------------------------------------------------
36+
# Integration
37+
# -----------------------------------------------------------------------------
38+
#
39+
# Black works well with:
40+
# - isort: Import sorting (configure with profile = "black")
41+
# - flake8: Linting (disable E501 line length, let Black handle it)
42+
# - pre-commit: Auto-format on commit
43+
#
44+
# =============================================================================
45+
46+
47+
[tool.black]
48+
49+
50+
# =============================================================================
51+
# Line Length
52+
# =============================================================================
53+
#
54+
# Maximum line length. Black defaults to 88, but we use 79 to match PEP 8.
55+
#
56+
# PEP 8 recommends 79 for code, 72 for docstrings/comments.
57+
# This works well for side-by-side diffs and smaller screens.
58+
#
59+
# -----------------------------------------------------------------------------
60+
61+
line-length = 79
62+
63+
64+
# =============================================================================
65+
# Target Python Version
66+
# =============================================================================
67+
#
68+
# Python versions to target. Black uses this to determine which syntax
69+
# features are available (e.g., walrus operator :=, match statements).
70+
#
71+
# Format: List of "pyXY" strings
72+
# Include all supported versions from pyproject.toml
73+
# Note: py314 not yet supported by Black
74+
#
75+
# -----------------------------------------------------------------------------
76+
77+
target-version = ["py312", "py313", "py314", "py315"]
78+
79+
80+
# =============================================================================
81+
# File Selection
82+
# =============================================================================
83+
#
84+
# include: Regex pattern for files to format (default: \.pyi?$)
85+
# extend-exclude: Patterns to exclude in addition to defaults
86+
#
87+
# Black's defaults already exclude:
88+
# .git, .hg, .mypy_cache, .tox, .venv, _build, buck-out, build, dist
89+
#
90+
# -----------------------------------------------------------------------------
91+
92+
include = '\.pyi?$'
93+
94+
95+
# =============================================================================
96+
# Exclusions
97+
# =============================================================================
98+
#
99+
# Extended regex pattern for directories to exclude.
100+
# Uses verbose regex (can span multiple lines with comments).
101+
#
102+
# Note: Use extend-exclude instead of exclude to keep Black's defaults.
103+
#
104+
# -----------------------------------------------------------------------------
105+
106+
exclude = '''
107+
/(
108+
# Version control
109+
\.git
110+
| \.hg
111+
112+
# Python tooling caches
113+
| \.mypy_cache
114+
| \.tox
115+
| \.venv
116+
| __pycache__
117+
118+
# Build outputs
119+
| _build
120+
| buck-out
121+
| build
122+
| dist
123+
124+
# Coverage reports
125+
| htmlcov
126+
127+
# Development scratch directories
128+
| bup
129+
| wip
130+
| tmp
131+
132+
# Django auto-generated files
133+
| migrations
134+
)/
135+
'''
136+
137+
138+
# =============================================================================
139+
# Additional Options (Usually Left as Defaults)
140+
# =============================================================================
141+
#
142+
# skip-string-normalization:
143+
# false (default): Prefer double quotes "
144+
# true: Keep original quote style
145+
#
146+
# skip-magic-trailing-comma:
147+
# false (default): Respect trailing commas as "expand this" hints
148+
# true: Ignore trailing commas, Black decides formatting
149+
#
150+
# preview:
151+
# false (default): Stable formatting only
152+
# true: Enable preview style (may change between versions)
153+
#
154+
# -----------------------------------------------------------------------------
155+
156+
# Uncomment to keep single quotes:
157+
# skip-string-normalization = true
158+
159+
# Uncomment to enable preview features:
160+
# preview = true

0 commit comments

Comments
 (0)