Skip to content

Commit 9dde64e

Browse files
authored
Merge branch 'main' into 300-ant-1
2 parents 52b94c5 + 8939abe commit 9dde64e

37 files changed

Lines changed: 511 additions & 327 deletions

.claude/CLAUDE.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
sz-python-tools is a collection of command-line utilities for the Senzing entity resolution platform (V4). This is a Senzing Garage project (experimental/tinkering), not production-ready software.
8+
9+
## Common Commands
10+
11+
```bash
12+
# Setup development environment (one-time)
13+
make dependencies-for-development
14+
15+
# Run all linters (pylint, mypy, bandit, black, flake8, isort)
16+
make lint
17+
18+
# Run individual linters
19+
make pylint
20+
make mypy
21+
make black
22+
make flake8
23+
make isort
24+
make bandit
25+
26+
# Run tests
27+
make test
28+
29+
# Run tests with coverage (opens HTML report)
30+
make coverage
31+
32+
# Clean build artifacts
33+
make clean
34+
35+
# Build documentation
36+
make documentation
37+
38+
# Build wheel package
39+
make package
40+
```
41+
42+
To run a single test file:
43+
44+
```bash
45+
source .venv/bin/activate
46+
pytest tests/example_test.py
47+
```
48+
49+
## Architecture
50+
51+
### Source Organization
52+
53+
All source code is in `sz_tools/` directory. Each tool is a standalone executable Python script (no .py extension):
54+
55+
**Interactive Shell Tools** (using Python's `cmd.Cmd`):
56+
57+
- `sz_command` - Main CLI shell for Senzing engine operations
58+
- `sz_configtool` - Configuration management shell
59+
- `sz_explorer` - Entity/database explorer with prettytable output
60+
61+
**Data Processing Tools**:
62+
63+
- `sz_file_loader` - Multi-threaded data file loading (JSON/JSONL)
64+
- `sz_export` - Entity data export (CSV/JSONL)
65+
- `sz_snapshot` - Database state snapshots with multi-process support
66+
- `sz_audit` - Data comparison and auditing
67+
- `sz_json_analyzer` - JSON/JSONL file analysis
68+
69+
**Project Management**:
70+
71+
- `sz_create_project` - Create new Senzing project instances
72+
- `sz_update_project` - V3→V4 and V4→V4 project upgrades
73+
- `sz_setup_config` - Initialize Senzing configuration
74+
75+
### Shared Modules
76+
77+
- `_tool_helpers.py` - Comprehensive utilities: color theming (Colors class with ANSI codes), engine configuration, JSON formatting, terminal I/O, concurrent execution
78+
- `_project_helpers.py` - Project file management, version comparison (SzBuildDetails class), Senzing paths
79+
- `_sz_database.py` - Database abstraction layer supporting SQLite, PostgreSQL, Oracle, MSSQL, DB2, MySQL
80+
81+
### Key Patterns
82+
83+
- Color output uses the `Colors` class with themes: DEFAULT, LIGHT, DARK, TERMINAL
84+
- JSON parsing uses `orjson` if available, with fallback to standard `json`
85+
- Configuration stored in `sz_engine_config.ini`
86+
- Interactive shells provide command history via readline
87+
88+
## Code Style
89+
90+
- **Line length**: 120 characters (Black formatter)
91+
- **Import sorting**: isort with "black" profile
92+
- **Type hints**: Gradual typing (mypy configured with relaxed checking)
93+
- Python 3.10+ required
94+
95+
## Dependencies
96+
97+
Core runtime dependencies:
98+
99+
- `senzing >= 4.0.2`
100+
- `senzing-core >= 1.0.0`
101+
102+
Optional (with graceful fallbacks):
103+
104+
- `orjson` - Fast JSON parsing
105+
- `prettytable` - ASCII table output
106+
- `pyclip` - Clipboard integration
107+
- `pygments` - Syntax highlighting
108+
109+
## Environment
110+
111+
The Senzing C library must be installed:
112+
113+
- `/opt/senzing/er/lib` - Shared objects
114+
- `/opt/senzing/er/sdk/c` - SDK headers
115+
- `/etc/opt/senzing` - Configuration

.claude/commands/senzing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Senzing
2+
3+
- Perform the steps specified by <https://raw.githubusercontent.com/senzing-factory/claude/refs/tags/v1/commands/senzing.md>

.claude/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"includeCoAuthoredBy": false
3+
}

.dockerignore

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

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
version: 2
55
updates:
66
- package-ecosystem: github-actions
7-
directory: /
8-
schedule:
9-
interval: daily
10-
- package-ecosystem: docker
7+
cooldown:
8+
default-days: 21
119
directory: /
1210
schedule:
1311
interval: daily
1412
- package-ecosystem: pip
13+
cooldown:
14+
default-days: 21
1515
directory: /
1616
schedule:
1717
interval: daily

.github/linters/README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Linters
22

3+
## .checkov.yaml
4+
5+
- [.checkov.yaml]
6+
- Used by [lint-workflows.yaml]
7+
- [checkov]
8+
- [checkov configuration]
9+
310
## .jscpd.json
411

512
- [.jscpd.json]
@@ -10,7 +17,7 @@
1017

1118
```json
1219
{
13-
"ignore": ["**/*.go,**/go-test*.yaml"],
20+
"ignore": ["**/*.py,**/python-test*.yaml"],
1421
"threshold": 10
1522
}
1623
```
@@ -22,10 +29,31 @@
2229
- [yaml-lint]
2330
- [yaml-lint configuration]
2431

32+
## bearer.yml
33+
34+
- [bearer.yml]
35+
- Used by [bearer.yaml]
36+
- [bearer]
37+
- [bearer repository]
38+
- [bearer configuration]
39+
40+
## zizmor.yaml
41+
42+
- [zizmor.yaml]
43+
44+
[.checkov.yaml]: .checkov.yaml
2545
[.jscpd.json]: .jscpd.json
2646
[.yaml-lint.yml]: .yaml-lint.yml
47+
[bearer configuration]: https://docs.bearer.com/reference/config/
48+
[bearer repository]: https://github.com/Bearer/bearer/tree/main
49+
[bearer.yaml]: ../workflows/README.md#beareryaml
50+
[bearer.yml]: bearer.yml
51+
[bearer]: https://docs.bearer.com/
52+
[checkov configuration]: https://www.checkov.io/2.Basics/CLI%20Command%20Reference.html
53+
[checkov]: https://www.checkov.io/
2754
[jscpd configuration]: https://github.com/kucherenko/jscpd/tree/master/apps/jscpd#options
2855
[jscpd]: https://github.com/kucherenko/jscpd
2956
[lint-workflows.yaml]: ../workflows/README.md#lint-workflowsyaml
3057
[yaml-lint configuration]: https://yamllint.readthedocs.io/en/stable/configuration.html
3158
[yaml-lint]: https://github.com/adrienverge/yamllint
59+
[zizmor.yaml]: zizmor.yaml

.github/workflows/README.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,6 @@ this action runs [Fast Python Vulnerability Scanner] and [pip-audit].
5959
- [Fast Python Vulnerability Scanner]
6060
- [pypa/gh-action-pip-audit]
6161

62-
## docker-build-container.yaml
63-
64-
When a Pull Request is made against the `main` branch,
65-
this action verifies that the `Dockerfile` can be successfully built.
66-
67-
_Note:_ The Docker image is **not** pushed to [DockerHub].
68-
69-
- [Docker Build Container GitHub Action]
70-
- Uses: [senzing-factory/github-action-docker-buildx-build]
71-
72-
## docker-push-containers-to-dockerhub.yaml
73-
74-
After a [Semantic Version] release is created,
75-
this action builds Docker images on multiple architectures and pushes the Docker images to [DockerHub].
76-
77-
- [Docker Push Containers to DockerHub GitHub Action]
78-
- Uses: [senzing-factory/github-action-docker-buildx-build]
79-
8062
## flake8.yaml
8163

8264
When a change is committed to GitHub or a Pull Request is made against the `main` branch,
@@ -181,9 +163,6 @@ this action runs [pytest] on the Windows platform to perform unit tests and code
181163
[Black]: https://github.com/psf/black
182164
[Dependabot Approve and Merge GitHub Action]: dependabot-approve-and-merge.yaml
183165
[dependency-scan.yaml]: dependency-scan.yaml
184-
[Docker Build Container GitHub Action]: docker-build-container.yaml
185-
[Docker Push Containers to DockerHub GitHub Action]: docker-push-containers-to-dockerhub.yaml
186-
[DockerHub]: https://hub.docker.com/
187166
[Fast Python Vulnerability Scanner]: https://github.com/vanschelven/fpvs/
188167
[flake8.yaml]: flake8.yaml
189168
[flake8]: https://flake8.pycqa.org/en/latest/
@@ -205,13 +184,11 @@ this action runs [pytest] on the Windows platform to perform unit tests and code
205184
[pytest-linux.yaml]: pytest-linux.yaml
206185
[pytest-windows.yaml]: pytest-windows.yaml
207186
[pytest]: https://docs.pytest.org/en/stable/
208-
[Semantic Version]: https://semver.org/
209187
[senzing-factory/build-resources/.../add-labels-to-issue.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/add-labels-to-issue.yaml
210188
[senzing-factory/build-resources/.../add-to-project-dependabot.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/add-to-project-dependabot.yaml
211189
[senzing-factory/build-resources/.../add-to-project.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/add-to-project.yaml
212190
[senzing-factory/build-resources/.../dependabot-approve-and-merge.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/dependabot-approve-and-merge.yaml
213191
[senzing-factory/build-resources/.../lint-workflows.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/lint-workflows.yaml
214192
[senzing-factory/build-resources/.../move-pr-to-done-dependabot.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/move-pr-to-done-dependabot.yaml
215-
[senzing-factory/github-action-docker-buildx-build]: https://github.com/senzing-factory/github-action-docker-buildx-build
216193
[senzing-factory/github-action-install-senzing-sdk]: https://github.com/senzing-factory/github-action-install-senzing-sdk
217194
[super-linter]: https://github.com/super-linter/super-linter

.github/workflows/bandit.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
name: bandit
1+
name: Bandit
22

33
on:
44
pull_request:
55
branches: [main]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
9+
cancel-in-progress: true
10+
711
permissions: {}
812

913
jobs:
@@ -14,7 +18,8 @@ jobs:
1418
strategy:
1519
fail-fast: false
1620
matrix:
17-
python-version: ["3.12"]
21+
python-version: ["3.13"]
22+
timeout-minutes: 10
1823

1924
steps:
2025
- name: Run Bandit Scan

.github/workflows/bearer.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
name: bearer
1+
name: Bearer
22

33
on:
44
pull_request:
55
branches: [main]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
9+
cancel-in-progress: true
10+
711
permissions: {}
812

913
jobs:
1014
rule_check:
1115
permissions:
1216
contents: read
1317
runs-on: ubuntu-latest
18+
timeout-minutes: 10
1419

1520
steps:
1621
- name: Checkout repository

.github/workflows/black.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
name: black
1+
name: Black
22

33
on:
44
pull_request:
55
branches: [main]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
9+
cancel-in-progress: true
10+
711
permissions: {}
812

913
jobs:
1014
black:
11-
name: black Python ${{ matrix.python-version }}
15+
name: Black Python ${{ matrix.python-version }}
1216
permissions:
1317
contents: read
1418
runs-on: ubuntu-latest
1519
strategy:
1620
fail-fast: false
1721
matrix:
18-
python-version: ["3.9", "3.10", "3.11", "3.12"]
22+
python-version: ["3.10", "3.11", "3.12", "3.13"]
23+
timeout-minutes: 10
1924

2025
steps:
2126
- name: Checkout repository

0 commit comments

Comments
 (0)