pyannotators-patterns 0.7.1__tar.gz → 1.6.27__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/.gitignore +6 -0
  2. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/.pre-commit-config.yaml +6 -9
  3. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/Dockerfile +4 -4
  4. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/Jenkinsfile +105 -23
  5. pyannotators_patterns-1.6.27/MIGRATION.md +166 -0
  6. pyannotators_patterns-1.6.27/PKG-INFO +157 -0
  7. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/README.md +52 -12
  8. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/conf.py +0 -1
  9. pyannotators_patterns-1.6.27/pyproject.toml +88 -0
  10. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/src/pyannotators_patterns/__init__.py +2 -1
  11. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/src/pyannotators_patterns/named_pattern_recognizer.py +30 -24
  12. pyannotators_patterns-1.6.27/src/pyannotators_patterns/patterns.py +260 -0
  13. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/assertions.py +4 -12
  14. pyannotators_patterns-1.6.27/tests/test_annotator.py +172 -0
  15. pyannotators_patterns-1.6.27/tests/test_coords.py +42 -0
  16. pyannotators_patterns-1.6.27/tests/test_credit_cards.py +111 -0
  17. pyannotators_patterns-1.6.27/tests/test_emails.py +75 -0
  18. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/test_mgrs.py +7 -10
  19. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/test_tel.py +12 -11
  20. pyannotators_patterns-1.6.27/tests/test_zip.py +60 -0
  21. pyannotators_patterns-1.6.27/trivy-html-template.tpl +148 -0
  22. pyannotators_patterns-0.7.1/PKG-INFO +0 -97
  23. pyannotators_patterns-0.7.1/pyproject.toml +0 -90
  24. pyannotators_patterns-0.7.1/setup.py +0 -54
  25. pyannotators_patterns-0.7.1/src/pyannotators_patterns/patterns.py +0 -219
  26. pyannotators_patterns-0.7.1/tests/test_coords.py +0 -40
  27. pyannotators_patterns-0.7.1/tests/test_credit_cards.py +0 -58
  28. pyannotators_patterns-0.7.1/tests/test_emails.py +0 -58
  29. pyannotators_patterns-0.7.1/tests/test_zip.py +0 -52
  30. pyannotators_patterns-0.7.1/tox.ini +0 -51
  31. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/.bumpversion.cfg +0 -0
  32. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/.github/workflows/main.yml +0 -0
  33. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/.readthedocs.yml +0 -0
  34. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/AUTHORS.md +0 -0
  35. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/CHANGELOG.md +0 -0
  36. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/LICENSE +0 -0
  37. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/RELEASE.md +0 -0
  38. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/bumpversion.py +0 -0
  39. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/.gitignore +0 -0
  40. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/CHANGELOG.md +0 -0
  41. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/LICENSE +0 -0
  42. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/_static/.gitkeep +0 -0
  43. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/_templates/.gitkeep +0 -0
  44. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/docs/index.rst +0 -0
  45. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/mypy.ini +0 -0
  46. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/coords-document.json +0 -0
  47. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/coords.json +0 -0
  48. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/mgrs-document.json +0 -0
  49. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/mgrs.json +0 -0
  50. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/tel-document.json +0 -0
  51. {pyannotators_patterns-0.7.1 → pyannotators_patterns-1.6.27}/tests/data/tel.json +0 -0
@@ -129,3 +129,9 @@ dmypy.json
129
129
  .idea/
130
130
  .groovylintrc.json
131
131
  .emailNotif
132
+ uv.lock
133
+
134
+ # SBOMs
135
+ **/sbom*.json
136
+ **/trivy*.html
137
+ **/audit*.json
@@ -1,17 +1,14 @@
1
1
  repos:
2
- - repo: https://github.com/ambv/black
3
- rev: 19.3b0
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.3.0
4
4
  hooks:
5
- - id: black
6
- language_version: python3.8
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
7
8
  - repo: https://github.com/pre-commit/pre-commit-hooks
8
- rev: v2.1.0
9
+ rev: v4.5.0
9
10
  hooks:
10
11
  - id: end-of-file-fixer
11
12
  exclude: '.bumpversion.cfg'
12
13
  - id: trailing-whitespace
13
14
  exclude: '.bumpversion.cfg'
14
- - repo: https://gitlab.com/pycqa/flake8
15
- rev: 3.7.9
16
- hooks:
17
- - id: flake8
@@ -1,4 +1,4 @@
1
- FROM python:3.8-slim-bookworm
1
+ FROM python:3.12-slim-bookworm
2
2
  # Install prerequisites
3
3
  RUN apt-get update -y && \
4
4
  apt-get install -y \
@@ -11,9 +11,9 @@ RUN apt-get update -y && \
11
11
  apt-get update -y && \
12
12
  apt-get clean all -y
13
13
 
14
- # Enable Installing packages as root
15
- ENV FLIT_ROOT_INSTALL=1
14
+ # Install uv
15
+ RUN pip install uv
16
16
 
17
- # Add pyproject.toml + README.md for flit install
17
+ # Add pyproject.toml + README.md for uv install
18
18
  ADD pyproject.toml pyproject.toml
19
19
  ADD README.md README.md
@@ -6,6 +6,14 @@ pipeline {
6
6
 
7
7
  agent none
8
8
 
9
+ options {
10
+ throttleJobProperty(
11
+ categories: ['pyannotators'],
12
+ throttleEnabled: true,
13
+ throttleOption: 'category'
14
+ )
15
+ }
16
+
9
17
  triggers {
10
18
  upstream(upstreamProjects: 'pymultirole_plugins/' + BRANCH_NAME.replaceAll('/', '%2F'),\
11
19
  threshold: hudson.model.Result.SUCCESS)
@@ -18,16 +26,17 @@ pipeline {
18
26
  PYTHONPYCACHEPREFIX = '/tmp/.pytest_cache'
19
27
  PYTHONDONTWRITEBYTECODE = '1'
20
28
  JENKINS_UIDGID = '1004:1004'
29
+ SBOM_PROJECT_NAME = "sbom-${JOB_NAME.replaceAll('[^a-zA-Z0-9_.-]', '_')}"
21
30
 
22
- MAJOR_VERSION = '0'
23
- MINOR_VERSION = '7'
31
+ MAJOR_VERSION = "${MAJOR_VERSION_PY312}"
32
+ MINOR_VERSION = "${MINOR_VERSION_PY312}"
24
33
  }
25
34
 
26
35
  stages {
27
36
  stage('Catch build termination') {
28
37
  agent {
29
38
  node {
30
- label 'built-in'
39
+ label 'pre-build'
31
40
  customWorkspace "${PATH_HOME}/${JOB_NAME}"
32
41
  }
33
42
  }
@@ -58,7 +67,7 @@ pipeline {
58
67
  stage('Add credentials') {
59
68
  steps {
60
69
  script {
61
- // Add password file for flit publishing
70
+ // Add password file for uv publishing
62
71
  sh "cp ${PATH_HOME}/.passwd-pypi .env"
63
72
  }
64
73
  }
@@ -73,6 +82,7 @@ pipeline {
73
82
  withCredentials([gitUsernamePassword(credentialsId: 'bitbucket-user', gitToolName: 'git-tool')]) {
74
83
  sh 'git pull'
75
84
  sh "echo '\"\"\"Annotator based on Presidio pattern recognizer\"\"\"' > src/pyannotators_patterns/__init__.py"
85
+ sh "echo '' >> src/pyannotators_patterns/__init__.py"
76
86
  sh "echo '__version__ = \"${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_ID}\"' >> src/pyannotators_patterns/__init__.py"
77
87
  sh 'git commit src/pyannotators_patterns/__init__.py -m "[Jenkins CI] Commit on version files" || echo "No changes to commit"'
78
88
  sh 'git push'
@@ -95,7 +105,7 @@ pipeline {
95
105
  // - docker: /root/test-reports
96
106
  // - host : /tmp/_${JOB_NAME}/test-reports
97
107
  dockerfile {
98
- label 'built-in'
108
+ label 'docker-build'
99
109
  customWorkspace "${PATH_HOME}/${JOB_NAME}"
100
110
  filename 'Dockerfile'
101
111
  args "-u root --privileged -v /tmp/_${JOB_NAME}/test-reports:${TEST_REPORT_DIR}"
@@ -103,13 +113,11 @@ pipeline {
103
113
  }
104
114
 
105
115
  stages {
106
- stage('Install flit & flake8') {
116
+ stage('Install dependencies') {
107
117
  steps {
108
- // remove any previous tox env
109
- sh 'rm -rf .tox'
110
- sh 'python -m pip install pip==22.0.3'
111
- sh 'pip install --no-cache-dir flit==3.2.0 flake8==3.9.2 flakehell tox'
112
- sh 'flit install'
118
+ sh 'rm -f uv.lock'
119
+ sh 'pip install uv'
120
+ sh 'uv sync --no-cache --extra test'
113
121
  }
114
122
  }
115
123
 
@@ -117,20 +125,22 @@ pipeline {
117
125
  steps {
118
126
  // remove any previous results.xml file
119
127
  sh "rm -f ${TEST_REPORT_DIR}/results.xml"
120
- sh 'tox'
128
+ sh 'uv run ruff check .'
129
+ sh 'uv run ruff format --check .'
130
+ sh "uv run pytest --junit-xml=${TEST_REPORT_DIR}/results.xml"
121
131
  }
122
132
  }
123
133
 
124
134
  stage('Publish on PyPI') {
125
135
  environment {
126
- FLIT_USERNAME = getUserName '.env'
127
- FLIT_PASSWORD = getUserPass '.env'
136
+ UV_PUBLISH_USERNAME = getUserName '.env'
137
+ UV_PUBLISH_PASSWORD = getUserPass '.env'
128
138
  }
129
139
  steps {
130
140
  // remove any previous folder dist
131
141
  sh 'rm -rf dist'
132
- // create (as root) folder dist
133
- sh 'mkdir dist'
142
+ // remove any previous files used for sbom
143
+ sh 'rm -f sbom*.json trivy*.html syft trivy'
134
144
  // pull recent updates of file __init__.py
135
145
  withCredentials([gitUsernamePassword(credentialsId: 'bitbucket-user', gitToolName: 'git-tool')]) {
136
146
  sh 'git config --global pull.rebase false'
@@ -143,18 +153,90 @@ pipeline {
143
153
  sh "chown ${JENKINS_UIDGID} src/pyannotators_patterns/__init__.py"
144
154
  // get git status
145
155
  sh 'git status'
146
- // publish on PyPI
156
+ // build and publish on PyPI
147
157
  sh '''
148
158
  export COMMIT_VERSION=$( cat src/pyannotators_patterns/__init__.py|grep version|cut -d '"' -f2|tr -s '[:blank:]' )
149
159
  export BUILD_VERSION="${MAJOR_VERSION}"."${MINOR_VERSION}"."${BUILD_ID}"
150
- if [ "${COMMIT_VERSION}" = "${BUILD_VERSION}" ] ; then flit publish ; fi
160
+ if [ "${COMMIT_VERSION}" = "${BUILD_VERSION}" ] ; then uv build && uv publish ; fi
151
161
  '''
152
162
  // remove current folder dist
153
163
  sh 'rm -rf dist'
154
164
  // remove current folder .hypothesis
155
165
  sh 'rm -rf .hypothesis'
156
- // remove current folder .tox
157
- sh 'rm -rf .tox'
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ stage('Prepare SBOM') {
172
+ when {
173
+ beforeAgent true
174
+ environment name: 'SKIP_JOB', value: '0'
175
+ }
176
+ options {
177
+ timeout(time: 120, unit: 'SECONDS')
178
+ }
179
+
180
+ agent {
181
+ docker {
182
+ image 'alpine:3.19'
183
+ label 'docker-build'
184
+ customWorkspace "${PATH_HOME}/${JOB_NAME}"
185
+ args "-u 0 -v ${PATH_HOME}/.cache/trivy:/root/.cache/trivy"
186
+ }
187
+ }
188
+
189
+ stages {
190
+ stage('Generate SBOM') {
191
+ steps {
192
+ sh """
193
+ apk add --no-cache curl
194
+
195
+ curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b . v${SYFT_VERSION}
196
+
197
+ ./syft . \
198
+ --exclude '**/syft' \
199
+ --exclude '**/.pytest_cache' \
200
+ --exclude '**/.ruff_cache' \
201
+ --exclude '**/sbom.cdx.json' \
202
+ --exclude '**/sbom.spdx.json' \
203
+ --source-name "${JOB_NAME}" \
204
+ --source-version "${BUILD_NUMBER}" \
205
+ -o cyclonedx-json=${SBOM_PROJECT_NAME}.cdx.json \
206
+ -o spdx-json=${SBOM_PROJECT_NAME}.spdx.json
207
+
208
+ rm -f ./syft
209
+ """
210
+ }
211
+ }
212
+
213
+ stage('Analyse SBOM') {
214
+ steps {
215
+ sh """
216
+ curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b . v${TRIVY_VERSION}
217
+ if [ ! -f trivy-html-template.tpl ]; then
218
+ curl -L https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/html.tpl -o trivy-html-template.tpl
219
+ fi
220
+
221
+ ./trivy sbom ${SBOM_PROJECT_NAME}.cdx.json \
222
+ --cache-dir "/root/.cache/trivy" \
223
+ --severity HIGH,CRITICAL \
224
+ --exit-code 1 \
225
+ --no-progress \
226
+ --format template \
227
+ --template "@trivy-html-template.tpl" \
228
+ -o trivy-report-${SBOM_PROJECT_NAME}.html || EXIT_CODE=\$?
229
+
230
+ rm -f ./trivy
231
+
232
+ exit \${EXIT_CODE:-0}
233
+ """
234
+ }
235
+ }
236
+
237
+ stage('Archive SBOM & analysis') {
238
+ steps {
239
+ archiveArtifacts artifacts: 'sbom*.json, trivy*.html', excludes: 'sbom.cdx.json, sbom.spdx.json', fingerprint: true
158
240
  }
159
241
  }
160
242
  }
@@ -239,7 +321,7 @@ pipeline {
239
321
  }
240
322
  }
241
323
 
242
- // return FLIT_USERNAME from given file
324
+ // return UV_PUBLISH_USERNAME from given file (reads FLIT_USERNAME key)
243
325
  def getUserName(path) {
244
326
  def USERNAME = sh(
245
327
  script: "grep FLIT_USERNAME ${path}|cut -d '=' -f2",
@@ -248,7 +330,7 @@ def getUserName(path) {
248
330
  return USERNAME
249
331
  }
250
332
 
251
- // return FLIT_PASSWORD from given file
333
+ // return UV_PUBLISH_PASSWORD from given file (reads FLIT_PASSWORD key)
252
334
  def getUserPass(path) {
253
335
  def USERPASS = sh(
254
336
  script: "grep FLIT_PASSWORD ${path}|cut -d '=' -f2",
@@ -409,6 +491,6 @@ def analyseBuildCause() {
409
491
  println 'Skipping build because last commit has been done by CI'
410
492
  env.SKIP_JOB = '1'
411
493
  switchEmailNotif(false, 0)
412
- //currentBuild.result = 'NOT_BUILT'
494
+ currentBuild.result = 'NOT_BUILT'
413
495
  }
414
496
  }
@@ -0,0 +1,166 @@
1
+ # Migration to Python 3.12, Pydantic v2, and uv tooling
2
+
3
+ This document describes the migration steps to perform on this project according to past experience. Please apply all these changes if they make sense.
4
+
5
+ ## 0. Initial setup
6
+ - create a py312 git branch and switch to it
7
+ - change pyenv local to pymultirole312
8
+ - reset version in __init__.py to 0.6.0
9
+
10
+ ## 1. Build system: flit → hatchling/uv
11
+
12
+ The build system was migrated from **flit** to **hatchling** with **uv** as the package manager.
13
+
14
+ - `pyproject.toml`: rewritten from flit legacy format (`[tool.flit.metadata]`) to PEP 621
15
+ with `hatchling` backend and `[project]` table
16
+ - Version read dynamically from `src/pyconverters_pyword/__init__.py` via `[tool.hatch.version]`
17
+ - Entry point `pyconverters.plugins` moved from `[tool.flit.entrypoints]` to `[project.entry-points]`
18
+ - Replaced `flit` commands with `uv build` and `uv publish`
19
+ - Jenkinsfile updated to use `uv sync` and `uv build`/`uv publish`
20
+ - Dockerfile updated to install `uv` via `COPY --from=ghcr.io/astral-sh/uv:latest`
21
+
22
+ ## 2. Python version: 3.8+ → 3.12
23
+
24
+ - `requires-python` set to `>=3.12` in `pyproject.toml`
25
+ - `Dockerfile` base image changed from `python:3.8-slim-bookworm` to `python:3.12-slim-bookworm`
26
+ - `FLIT_ROOT_INSTALL=1` env var removed from Dockerfile (no longer needed)
27
+ - Classifiers updated from `Python :: 3.8` to `Python :: 3.12`
28
+
29
+ ## 3. Pydantic v1 → v2
30
+
31
+ Replaced deprecated Pydantic v1 APIs in `pyword.py` and `tests/test_pyword.py`:
32
+
33
+ - `.json(exclude_none=True, exclude_unset=True, indent=2)` → `.model_dump_json(...)` in tests
34
+ - `DocumentList(__root__=docs)` → `DocumentList(root=docs)` (Pydantic v2 `RootModel` API)
35
+ - `Field(extra="internal"/"advanced")` → `Field(json_schema_extra={"extra": "..."})` in `pyword.py`
36
+ - `params.dict()` → `params.model_dump()` in `pyword.py`
37
+
38
+ ## 4. Python 3.12 type modernization
39
+
40
+ Leveraged Python 3.12 builtins and modern syntax (enforced by ruff `UP` rules):
41
+
42
+ - `typing.List[Document]` → `list[Document]` (method signatures in `pyword.py` and tests)
43
+ - `typing.Type[BaseModel]` → `type[BaseModel]` (`get_model` return type in `pyword.py`)
44
+ - Removed unused `typing` imports: `List`, `Type`
45
+
46
+ ## 5. Linter: black + flake8 → ruff
47
+
48
+ - Removed `black`, `flake8`, `pytest-flake8`, `pytest-black`, `flakehell` dependencies
49
+ - Added `ruff` to `[project.optional-dependencies].test`
50
+ - Removed `[tool.flakehell]` configuration block from `pyproject.toml`
51
+ - Configured `[tool.ruff]` in `pyproject.toml`:
52
+ - `line-length = 120`
53
+ - `target-version = "py312"`
54
+ - Lint rules: `E`, `W`, `F`, `I`, `B`, `C4`, `UP`, `ARG`, `SIM`
55
+ - Format: double quotes, space indent
56
+ - Updated `.pre-commit-config.yaml`: replaced `black` and `flake8` hooks with `ruff` and `ruff-format`
57
+
58
+ ### Running the linter
59
+
60
+ ```
61
+ uv run ruff check .
62
+ uv run ruff format --check .
63
+ ```
64
+
65
+ To auto-fix formatting:
66
+
67
+ ```
68
+ uv run ruff format .
69
+ ```
70
+
71
+ ## 6. Test runner: tox → uv
72
+
73
+ **tox** was removed entirely. The project now uses `uv run` to execute tests and linting directly.
74
+
75
+ ### What changed
76
+
77
+ - Deleted `tox.ini`
78
+ - Removed `tox`, `flake8`, `pytest-flake8`, `pytest-black` from test dependencies
79
+ - Moved pytest configuration from `tox.ini` to `pyproject.toml`:
80
+
81
+ ```toml
82
+ [tool.pytest.ini_options]
83
+ addopts = "--durations=5"
84
+ norecursedirs = ["docs"]
85
+ ```
86
+
87
+ ### Running tests
88
+
89
+ ```
90
+ uv run pytest
91
+ ```
92
+
93
+ ### Why tox was unnecessary
94
+
95
+ - The project targets a single Python version (3.12)
96
+ - `uv run` provides virtual environment isolation without the extra layer
97
+
98
+ ## 7. Documentation generation
99
+
100
+ Sphinx is used for documentation with the `docs` optional dependency group.
101
+
102
+ ### Fix: added `lxml_html_clean` dependency
103
+
104
+ The `jupyter_sphinx` extension requires `lxml_html_clean` (split from `lxml` in recent versions).
105
+ This was added to `[project.optional-dependencies].docs`.
106
+
107
+ ### Generating docs
108
+
109
+ ```
110
+ uv run --extra docs sphinx-build docs docs/_build
111
+ ```
112
+
113
+ ## 8. Jenkinsfile updates
114
+
115
+ - `__init__.py` generation now includes a blank line between the docstring and `__version__`
116
+ to comply with `ruff format`
117
+ - Set `__version__ = "0.6.0"`
118
+ - In Jenkinsfile, set `MINOR_VERSION = "6"`
119
+ - Install step changed from `flit install` to `uv sync --extra test`
120
+ - Lint step added: `uv run ruff check .` + `uv run ruff format --check .`
121
+ - Test step changed from `tox` to `uv run pytest --junit-xml=...`
122
+ - Build/publish pipeline uses `uv build && uv publish` instead of `flit publish`
123
+ - Credentials: Jenkinsfile helper functions still read `FLIT_USERNAME` and `FLIT_PASSWORD`
124
+ from `.passwd-pypi`, but expose them as `UV_PUBLISH_USERNAME` and `UV_PUBLISH_PASSWORD`
125
+ for `uv publish`
126
+ - Removed `.tox` cleanup steps
127
+
128
+ ## 9. .gitignore updates
129
+
130
+ Added the following entry:
131
+ - `uv.lock` — generated lock file, not committed
132
+
133
+ (`docs/_build/` was already present.)
134
+
135
+ ## 10. Dependency cleanup and upgrades
136
+
137
+ ### Removed unused dependencies
138
+
139
+ - None
140
+
141
+ ### Upgraded pinned dependencies
142
+
143
+ - `pymultirole-plugins>=0.5.0,<0.6.0` → `pymultirole-plugins>=0.6.0,<0.7.0`
144
+ - update dependencies to latest versions if possible
145
+
146
+ ## 11. Starlette `UploadFile` API change
147
+
148
+ The `UploadFile` constructor signature changed in recent Starlette versions:
149
+
150
+ **Before (old API):**
151
+ ```python
152
+ UploadFile(filename, file, content_type) # positional args
153
+ ```
154
+
155
+ **After (new API):**
156
+ ```python
157
+ UploadFile(file=..., filename=..., headers=Headers({"content-type": "..."}))
158
+ ```
159
+
160
+ Updated in `tests/test_pyword.py` and added `Headers` import from `starlette.datastructures`.
161
+
162
+ ## 12. Additional unit tests
163
+
164
+ - Analyze src directory and extended `tests/` with tests covering previously untested behaviour
165
+
166
+ ## 13. Update README.md
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyannotators-patterns
3
+ Version: 1.6.27
4
+ Summary: Annotator based on Presidio pattern recognizer
5
+ Project-URL: Homepage, https://github.com/oterrier/pyannotators_patterns/
6
+ Author-email: Olivier Terrier <olivier.terrier@kairntech.com>
7
+ License: The MIT License (MIT)
8
+
9
+ Copyright (c) 2021 Olivier Terrier
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+ License-File: AUTHORS.md
29
+ License-File: LICENSE
30
+ Classifier: Development Status :: 4 - Beta
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: Intended Audience :: Information Technology
33
+ Classifier: Intended Audience :: System Administrators
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Topic :: Software Development
38
+ Classifier: Topic :: Software Development :: Libraries
39
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
40
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
41
+ Requires-Python: >=3.12
42
+ Requires-Dist: collections-extended
43
+ Requires-Dist: log-with-context
44
+ Requires-Dist: presidio-analyzer>=2.2.354
45
+ Requires-Dist: pymultirole-plugins<0.7.0,>=0.6.0
46
+ Requires-Dist: spacy[lookups]>=3.7.0
47
+ Requires-Dist: tldextract>=5.1.2
48
+ Requires-Dist: unidecode
49
+ Provides-Extra: dev
50
+ Requires-Dist: bump2version; extra == 'dev'
51
+ Requires-Dist: pre-commit; extra == 'dev'
52
+ Provides-Extra: docs
53
+ Requires-Dist: lxml-html-clean; extra == 'docs'
54
+ Requires-Dist: m2r2; extra == 'docs'
55
+ Requires-Dist: sphinx; extra == 'docs'
56
+ Requires-Dist: sphinx-rtd-theme; extra == 'docs'
57
+ Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
58
+ Provides-Extra: sbom
59
+ Requires-Dist: cyclonedx-bom; extra == 'sbom'
60
+ Requires-Dist: pip-audit; extra == 'sbom'
61
+ Provides-Extra: test
62
+ Requires-Dist: dirty-equals; extra == 'test'
63
+ Requires-Dist: pip; extra == 'test'
64
+ Requires-Dist: pytest; extra == 'test'
65
+ Requires-Dist: pytest-check; extra == 'test'
66
+ Requires-Dist: pytest-cov; extra == 'test'
67
+ Requires-Dist: ruff; extra == 'test'
68
+ Description-Content-Type: text/markdown
69
+
70
+ # pyannotators_patterns
71
+
72
+ [![license](https://img.shields.io/github/license/oterrier/pyannotators_patterns)](https://github.com/oterrier/pyannotators_patterns/blob/master/LICENSE)
73
+ [![tests](https://github.com/oterrier/pyannotators_patterns/workflows/tests/badge.svg)](https://github.com/oterrier/pyannotators_patterns/actions?query=workflow%3Atests)
74
+ [![codecov](https://img.shields.io/codecov/c/github/oterrier/pyannotators_patterns)](https://codecov.io/gh/oterrier/pyannotators_patterns)
75
+ [![docs](https://img.shields.io/readthedocs/pyannotators_patterns)](https://pyannotators_patterns.readthedocs.io)
76
+ [![version](https://img.shields.io/pypi/v/pyannotators_patterns)](https://pypi.org/project/pyannotators_patterns/)
77
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyannotators_patterns)](https://pypi.org/project/pyannotators_patterns/)
78
+
79
+ Annotator based on Presidio regex pattern recognizers.
80
+
81
+ ## Installation
82
+
83
+ ```
84
+ pip install pyannotators-patterns
85
+ ```
86
+
87
+ ## Developing
88
+
89
+ ### Prerequisites
90
+
91
+ You will need [uv](https://github.com/astral-sh/uv) (package manager) and Python 3.12+.
92
+
93
+ Clone the repository:
94
+
95
+ ```
96
+ git clone https://github.com/oterrier/pyannotators_patterns
97
+ cd pyannotators_patterns
98
+ ```
99
+
100
+ Install dependencies (including test extras):
101
+
102
+ ```
103
+ uv sync --extra test
104
+ ```
105
+
106
+ ### Running the test suite
107
+
108
+ ```
109
+ uv run pytest
110
+ ```
111
+
112
+ ### Linting and formatting
113
+
114
+ ```
115
+ uv run ruff check .
116
+ uv run ruff format --check .
117
+ ```
118
+
119
+ To auto-fix formatting:
120
+
121
+ ```
122
+ uv run ruff format .
123
+ ```
124
+
125
+ ### Building the documentation
126
+
127
+ ```
128
+ uv run --extra docs sphinx-build docs docs/_build
129
+ ```
130
+
131
+ The built documentation is available at `docs/_build/index.html`.
132
+
133
+ ## SBOM & vulnerability check
134
+
135
+ Install the SBOM dependencies:
136
+
137
+ ```
138
+ uv sync --extra sbom
139
+ ```
140
+
141
+ Generate a CycloneDX SBOM from the current environment:
142
+
143
+ ```
144
+ uv run cyclonedx-py environment -o sbom.cdx.json --output-format json
145
+ ```
146
+
147
+ Audit dependencies for known vulnerabilities:
148
+
149
+ ```
150
+ uv run pip-audit --format json --output audit-report.json
151
+ ```
152
+
153
+ To fail on any known vulnerability (useful in CI):
154
+
155
+ ```
156
+ uv run pip-audit --strict
157
+ ```