Skip to content

Commit 11f5eb7

Browse files
authored
#409 Support Python 3.13 (#414)
* #409 Savepoint * #409 Add claude commands * #409 Prepare for versioned release * #409 Prepare for versioned release * #409 Update to template * #409 Fix Lint issues * #409 Fix Lint issues * #409 Fix Lint issues
1 parent 86898c5 commit 11f5eb7

40 files changed

Lines changed: 511 additions & 215 deletions

.claude/CLAUDE.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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+
This is `sz-sdk-python`, the Senzing Python SDK containing abstract base classes from which concrete implementations (Core and gRPC) are derived. The package is published to PyPI as `senzing`.
8+
9+
## Development Commands
10+
11+
### Setup and Dependencies
12+
13+
```bash
14+
# Create virtual environment and install all development dependencies
15+
make dependencies-for-development
16+
17+
# Install package dependencies only
18+
make dependencies
19+
```
20+
21+
### Linting
22+
23+
```bash
24+
# Run all linters (pylint, mypy, bandit, black, flake8, isort)
25+
make lint
26+
27+
# Run individual linters
28+
make pylint
29+
make mypy
30+
make black
31+
make flake8
32+
make isort
33+
make bandit
34+
```
35+
36+
### Testing
37+
38+
```bash
39+
# Run full test suite (requires Senzing C library installed)
40+
make clean setup test
41+
42+
# Run unit tests only
43+
pytest tests/ --verbose --capture=no
44+
45+
# Run a single test file
46+
pytest tests/szengine_test.py --verbose
47+
48+
# Run a specific test
49+
pytest tests/szengine_test.py::test_add_record --verbose
50+
51+
# Run tests with coverage
52+
make coverage
53+
```
54+
55+
### Build and Package
56+
57+
```bash
58+
make package # Build wheel file
59+
make publish-test # Publish to Test PyPI
60+
```
61+
62+
### Documentation
63+
64+
```bash
65+
make documentation # Build and view Sphinx docs
66+
```
67+
68+
## Architecture
69+
70+
### Package Structure
71+
72+
- `src/senzing/` - Main package with abstract base classes defining the SDK interface
73+
- `src/senzing_mock/` - Mock implementations for testing
74+
- `src/senzing_truthset/` - Sample test data (customers, references, watchlist)
75+
76+
### Core Abstract Classes
77+
78+
The SDK defines abstract base classes that implementations must fulfill:
79+
80+
- **SzAbstractFactory** - Factory pattern for creating SDK objects. Concrete implementations:
81+
- `SzAbstractFactoryCore` (in sz-sdk-python-core)
82+
- `SzAbstractFactoryGrpc` (in sz-sdk-python-grpc)
83+
84+
- **SzEngine** - Main entity resolution engine with methods like:
85+
- `add_record()`, `delete_record()` - Record management
86+
- `get_entity_by_*()` - Entity retrieval
87+
- `find_path_by_*()`, `find_network_by_*()` - Relationship discovery
88+
- `why_*()` - Explain entity resolution decisions
89+
- `search_by_attributes()` - Search functionality
90+
91+
- **SzConfig** - Configuration management
92+
- **SzConfigManager** - Configuration versioning and registry
93+
- **SzDiagnostic** - System diagnostics
94+
- **SzProduct** - License and version info
95+
96+
### Error Hierarchy
97+
98+
`src/senzing/szerror.py` contains the exception hierarchy (auto-generated):
99+
100+
- `SzError` - Base exception
101+
- `SzBadInputError` - User input errors (SzNotFoundError, SzUnknownDataSourceError)
102+
- `SzRetryableError` - Transient errors that can be retried
103+
- `SzUnrecoverableError` - Fatal errors (SzDatabaseError, SzLicenseError)
104+
105+
### Engine Flags
106+
107+
`SzEngineFlags` in `szengineflags.py` controls what information is returned from SDK methods.
108+
109+
## Code Style
110+
111+
- Line length: 120 characters (black, flake8)
112+
- Type hints: Required (`mypy --strict`)
113+
- Import sorting: isort with black profile
114+
- Security: bandit for security checks (B101 skipped for assert usage)
115+
116+
## Testing Approach
117+
118+
Tests use pytest with mock implementations from `senzing_mock`. The mock classes implement all abstract methods with minimal return values, allowing interface verification without requiring the actual Senzing engine.
119+
120+
- Tests in `tests/` verify the abstract interface.
121+
- Tests in `examples/` serve as both documentation and integration tests.
122+
123+
## Prerequisites
124+
125+
The Senzing C library must be installed at `/opt/senzing/er/lib` for running tests against actual implementations.

.claude/commands/senzing-code-review.md

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

.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>

.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/.jscpd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

.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/bandit.yaml

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

33
on:
4-
push:
5-
branches-ignore: [main]
64
pull_request:
75
branches: [main]
86

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

1113
jobs:
@@ -16,7 +18,8 @@ jobs:
1618
strategy:
1719
fail-fast: false
1820
matrix:
19-
python-version: ["3.12"]
21+
python-version: ["3.13"]
22+
timeout-minutes: 10
2023

2124
steps:
2225
- name: Run Bandit Scan

.github/workflows/bearer.yaml

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

33
on:
4-
push:
5-
branches-ignore: [main]
64
pull_request:
75
branches: [main]
86

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

1113
jobs:
1214
rule_check:
1315
permissions:
1416
contents: read
1517
runs-on: ubuntu-latest
18+
timeout-minutes: 10
1619

1720
steps:
1821
- name: Checkout repository

.github/workflows/black.yaml

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

33
on:
4-
push:
5-
branches-ignore: [main]
64
pull_request:
75
branches: [main]
86

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

1113
jobs:
1214
black:
13-
name: black Python ${{ matrix.python-version }}
15+
name: Black Python ${{ matrix.python-version }}
1416
permissions:
1517
contents: read
1618
runs-on: ubuntu-latest
1719
strategy:
1820
fail-fast: false
1921
matrix:
20-
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
2124

2225
steps:
2326
- name: Checkout repository

0 commit comments

Comments
 (0)