Skip to content

Commit 265dfd5

Browse files
authored
Merge branch 'main' into feat/uk-driving-licence
2 parents 134d73c + 8d3d783 commit 265dfd5

39 files changed

+1324
-53
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
runs-on: ubuntu-slim
2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
2727
with:
2828
persist-credentials: false
2929

3030
- name: Set up Python
31-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
31+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3232
with:
3333
python-version: '3.11'
3434

@@ -47,12 +47,12 @@ jobs:
4747
pull-requests: write
4848
steps:
4949
- name: Checkout code
50-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
50+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
5151
with:
5252
persist-credentials: false
5353

5454
- name: Dependency Review
55-
uses: actions/dependency-review-action@c74b580d73376b7750d3d2a50bfb8adc2c937507 # v4.5.0
55+
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.5.0
5656
with:
5757
fail-on-severity: low
5858
allow-licenses: MIT, Apache-2.0, BSD-3-Clause, 0BSD, 0BSD AND Apache-2.0 AND BSD-3-Clause AND MIT
@@ -94,13 +94,13 @@ jobs:
9494
PRIMARY_PYTHON: '3.13'
9595
steps:
9696
- name: Checkout code
97-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
97+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
9898
with:
9999
persist-credentials: true
100100
fetch-depth: 0
101101

102102
- name: Set up Python ${{ matrix.python-version }}
103-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
103+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
104104
with:
105105
python-version: ${{ matrix.python-version }}
106106
cache: 'pip'
@@ -202,12 +202,12 @@ jobs:
202202
runner: ubuntu-24.04-arm
203203
steps:
204204
- name: Checkout code
205-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
205+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
206206
with:
207207
persist-credentials: false
208208

209209
- name: Azure Login using OIDC
210-
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.3.0
210+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
211211
with:
212212
client-id: ${{ secrets.AZURE_CLIENT_ID }}
213213
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -217,7 +217,7 @@ jobs:
217217
run: az acr login --name ${{ secrets.ACR_NAME }}
218218

219219
- name: Set up Docker Buildx
220-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
220+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
221221

222222
- name: Build and Push ${{ matrix.image }} for ${{ matrix.platform }}
223223
run: |
@@ -246,7 +246,7 @@ jobs:
246246
contents: read
247247
steps:
248248
- name: Azure Login using OIDC
249-
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.3.0
249+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
250250
with:
251251
client-id: ${{ secrets.AZURE_CLIENT_ID }}
252252
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -256,7 +256,7 @@ jobs:
256256
run: az acr login --name ${{ secrets.ACR_NAME }}
257257

258258
- name: Set up Docker Buildx
259-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
259+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
260260

261261
- name: Create all multi-platform manifests
262262
run: |
@@ -290,12 +290,12 @@ jobs:
290290
runner: ubuntu-24.04-arm
291291
steps:
292292
- name: Checkout code
293-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
293+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
294294
with:
295295
persist-credentials: false
296296

297297
- name: Azure Login using OIDC
298-
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.3.0
298+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
299299
with:
300300
client-id: ${{ secrets.AZURE_CLIENT_ID }}
301301
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -321,12 +321,12 @@ jobs:
321321
TAG: :${{ env.TAG }}
322322

323323
- name: Set up Python
324-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
324+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
325325
with:
326326
python-version: '3.10'
327327

328328
- name: Cache E2E dependencies
329-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v5.0.0
329+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.0
330330
with:
331331
path: |
332332
~/.cache/pip
@@ -383,12 +383,12 @@ jobs:
383383
runner: ubuntu-24.04-arm
384384
steps:
385385
- name: Checkout code
386-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
386+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
387387
with:
388388
persist-credentials: false
389389

390390
- name: Set up Docker Buildx
391-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
391+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
392392

393393
- name: Build Presidio images locally
394394
run: |
@@ -408,12 +408,12 @@ jobs:
408408
TAG: gha${{ github.run_number }}
409409

410410
- name: Set up Python
411-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
411+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
412412
with:
413413
python-version: '3.10'
414414

415415
- name: Cache E2E dependencies
416-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v5.0.0
416+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.0
417417
with:
418418
path: |
419419
~/.cache/pip

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5656
steps:
5757
- name: Checkout repository
58-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
58+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
5959

6060
# Add any setup steps before running the `github/codeql-action/init` action.
6161
# This includes steps like installing compilers or runtimes (`actions/setup-node`
@@ -65,7 +65,7 @@ jobs:
6565

6666
# Initializes the CodeQL tools for scanning.
6767
- name: Initialize CodeQL
68-
uses: github/codeql-action/init@f5c2471be782132e47a6e6f9c725e56730d6e9a3 # v3.32.3
68+
uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
6969
with:
7070
languages: ${{ matrix.language }}
7171
build-mode: ${{ matrix.build-mode }}
@@ -96,6 +96,6 @@ jobs:
9696
exit 1
9797
9898
- name: Perform CodeQL Analysis
99-
uses: github/codeql-action/analyze@f5c2471be782132e47a6e6f9c725e56730d6e9a3 # v3.32.3
99+
uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
100100
with:
101101
category: "/language:${{matrix.language}}"

.github/workflows/defender-for-devops.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ jobs:
3838
security-events: write
3939

4040
steps:
41-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
42-
- uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v5.0.0
41+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
42+
- uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.0.0
4343
with:
4444
dotnet-version: |
4545
5.0.x
4646
6.0.x
4747
- name: Run Microsoft Security DevOps
48-
uses: microsoft/security-devops-action@cc007d020261b84193ccd49fa298eb8ba2408893 # v1.11.0
48+
uses: microsoft/security-devops-action@08976cb623803b1b36d7112d4ff9f59eae704de0 # v1.12.0
4949
id: msdo
5050
env:
5151
GDN_CHECKOV_SKIPPATH: 'docs'
@@ -55,6 +55,6 @@ jobs:
5555
tools: checkov, templateanalyzer, trivy
5656

5757
- name: Upload results to Security tab
58-
uses: github/codeql-action/upload-sarif@f5c2471be782132e47a6e6f9c725e56730d6e9a3 # v3.32.3
58+
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
5959
with:
6060
sarif_file: ${{ steps.msdo.outputs.sarifFile }}

.github/workflows/label-external.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-slim
1515
steps:
1616
- name: Label PRs from contributors without write access
17-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v8.0.0
17+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
1818
with:
1919
github-token: ${{ secrets.GITHUB_TOKEN }}
2020
script: |

.github/workflows/release-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616

1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
2020
with:
2121
fetch-depth: 0 # Fetch all history for proper gh-pages deployment
2222
persist-credentials: true # So that the token is available for pushing
2323

2424
- name: Set up Python
25-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
25+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2626
with:
2727
python-version: '3.x'
2828

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
image-version: ${{ steps.set-image-version.outputs.image-version }}
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
21+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
2222
with:
2323
persist-credentials: false
2424

@@ -47,7 +47,7 @@ jobs:
4747
continue-on-error: true
4848
steps:
4949
- name: Checkout code
50-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
50+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
5151
with:
5252
persist-credentials: false
5353

@@ -71,6 +71,8 @@ jobs:
7171
fail-fast: false
7272
matrix:
7373
package:
74+
- name: "Presidio"
75+
path: "presidio"
7476
- name: "Analyzer"
7577
path: "presidio-analyzer"
7678
- name: "Anonymizer"
@@ -81,12 +83,12 @@ jobs:
8183
path: "presidio-structured"
8284
steps:
8385
- name: Checkout code
84-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
86+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
8587
with:
8688
persist-credentials: false
8789

8890
- name: Set up Python
89-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
91+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
9092
with:
9193
python-version: '3.10'
9294

@@ -119,12 +121,12 @@ jobs:
119121

120122
steps:
121123
- name: Checkout code
122-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6.0.0
124+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.0
123125
with:
124126
persist-credentials: false
125127

126128
- name: Azure Login using OIDC
127-
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.3.0
129+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
128130
with:
129131
client-id: ${{ secrets.AZURE_CLIENT_ID }}
130132
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
@@ -134,7 +136,7 @@ jobs:
134136
run: az acr login --name ${{ secrets.ACR_NAME }}
135137

136138
- name: Set up Docker Buildx
137-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
139+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
138140

139141
- name: Build and Push ${{ matrix.image }}
140142
run: |

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
All notable changes to this project will be documented in this file.
44

55
## [unreleased]
6+
### General
7+
#### Added
8+
- Published `presidio` as a PyPI meta-package that installs `presidio-analyzer` and `presidio-anonymizer`, making `pip install presidio` work as expected. Inspired by and thanks to Sakthi Santhosh Anumand and Harsha Vardhan for the original idea.
9+
610
### Analyzer
711
#### Added
8-
- UK Driving Licence Number (UK_DRIVING_LICENCE) recognizer with pattern matching and context support
12+
- Nigerian National Identification Number (NG_NIN) recognizer with Verhoeff checksum validation
13+
- Nigerian Vehicle Registration (NG_VEHICLE_REGISTRATION) recognizer for current format plates (2011+)
914
- US_NPI recognizer for National Provider Identifier with Luhn checksum validation and context support (#1847) (Thanks @stevenelliottjr)
15+
- UK Driving Licence Number (UK_DRIVING_LICENCE) recognizer with pattern matching and context support
1016
- UK Postcode (UK_POSTCODE) recognizer with pattern matching and context support
17+
- UK Passport Number (UK_PASSPORT) recognizer for 2-letter + 7-digit format passports issued from 2015 onwards
18+
- UK Vehicle Registration Number (UK_VEHICLE_REGISTRATION) recognizer for current (2001+), prefix (1983-2001), and suffix (1963-1983) plate formats
1119

1220
### Analyzer
1321
#### Changed

docs/api-docs/api-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ components:
551551
type: string
552552
description: "The context word which helped increase the score"
553553
validation_result:
554-
type: number
555-
format: double
554+
type: boolean
555+
nullable: true
556556
description: "Result of a validation (e.g. checksum)"
557557

558558
Pattern:

docs/samples/python/gliner.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,31 @@ results = analyzer_engine.analyze(
7474

7575
print(results)
7676
```
77+
78+
## ONNX Runtime Support
79+
80+
GLiNERRecognizer supports using ONNX Runtime as a backend, which provides better CPU compatibility and can prevent crashes on older CPUs without AVX2 instruction set support (e.g., Intel Sandy Bridge).
81+
82+
### Using ONNX Runtime Backend
83+
84+
To use ONNX Runtime with GLiNER:
85+
86+
```python
87+
from presidio_analyzer.predefined_recognizers import GLiNERRecognizer
88+
89+
# Enable ONNX Runtime backend
90+
gliner_recognizer = GLiNERRecognizer(
91+
model_name="urchade/gliner_multi_pii-v1",
92+
entity_mapping=entity_mapping,
93+
load_onnx_model=True, # Enable ONNX Runtime
94+
map_location="cpu",
95+
)
96+
```
97+
98+
**Benefits of using ONNX Runtime:**
99+
- Works on older CPUs without AVX2 support
100+
- Prevents "Illegal instruction (core dumped)" crashes on incompatible hardware
101+
- Can provide better performance on certain CPU architectures
102+
103+
**Note:** Make sure `onnxruntime` is installed when using this feature. It's included in the `gliner` extra dependencies.
104+

docs/supported_entities.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ For more information, refer to the [adding new recognizers documentation](analyz
4242

4343
|Entity Type|Description|Detection Method|
4444
|--- |--- |--- |
45+
|UK_DRIVING_LICENCE|UK driving licence number issued by the DVLA. A 16-character alphanumeric string encoding surname, date of birth, and initials.|Pattern match, context and validation|
4546
|UK_NHS|A UK NHS number is 10 digits.|Pattern match, context and checksum|
4647
|UK_NINO|UK [National Insurance Number](https://en.wikipedia.org/wiki/National_Insurance_number) is a unique identifier used in the administration of National Insurance and tax.|Pattern match and context|
47-
|UK_DRIVING_LICENCE|UK driving licence number issued by the DVLA. A 16-character alphanumeric string encoding surname, date of birth, and initials.|Pattern match, context and validation|
48+
|UK_PASSPORT|A UK passport number consists of 2 letters followed by 7 digits (e.g., AB1234567), used in passports issued from 2015 onwards.|Pattern match and context|
4849
|UK_POSTCODE|A UK [postcode](https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom) is a 5-8 character alphanumeric code used by the Royal Mail for mail sorting.|Pattern match and context|
50+
|UK_VEHICLE_REGISTRATION|A UK vehicle registration number (number plate) in current (2001+), prefix (1983-2001), or suffix (1963-1983) format.|Pattern match, context and validation|
4951

5052
### Spain
5153

@@ -111,6 +113,12 @@ For more information, refer to the [adding new recognizers documentation](analyz
111113
| KR_RRN | The Korean Resident Registration Number (RRN) is a 13-digit number issued to all Korean residents. | Pattern match, context and custom logic. |
112114

113115

116+
### Nigeria
117+
| FieldType | Description | Detection Method |
118+
|------------|---------------------------------------------------------------------------------------------------------|------------------------------------------|
119+
| NG_NIN | The Nigerian National Identification Number (NIN) is a unique 11-digit number issued by the National Identity Management Commission (NIMC). | Pattern match, context, and checksum |
120+
| NG_VEHICLE_REGISTRATION | Nigerian vehicle registration plate number in the current format (2011+): 3 letters (LGA code), 3 digits (serial), 2 letters (year/batch). | Pattern match and context |
121+
114122
### Thai
115123
| FieldType | Description | Detection Method |
116124
|------------|---------------------------------------------------------------------------------------------------------|------------------------------------------|

0 commit comments

Comments
 (0)