pyannotators-entityfishing 1.6.28__tar.gz → 1.6.34__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.
@@ -28,6 +28,8 @@ share/python-wheels/
28
28
  MANIFEST
29
29
 
30
30
  # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
33
  *.manifest
32
34
  *.spec
33
35
 
@@ -83,6 +85,13 @@ ipython_config.py
83
85
  # pyenv
84
86
  .python-version
85
87
 
88
+ # pipenv
89
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
91
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
92
+ # install all needed dependencies.
93
+ #Pipfile.lock
94
+
86
95
  # celery beat schedule file
87
96
  celerybeat-schedule
88
97
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyannotators-entityfishing
3
- Version: 1.6.28
3
+ Version: 1.6.34
4
4
  Summary: Annotator based on entity-fishing
5
5
  Project-URL: Homepage, https://github.com/oterrier/pyannotators_entityfishing/
6
6
  Author-email: Olivier Terrier <olivier.terrier@kairntech.com>
@@ -20,7 +20,7 @@ Requires-Python: >=3.12
20
20
  Requires-Dist: collections-extended
21
21
  Requires-Dist: mongoquery
22
22
  Requires-Dist: pydantic<3.0,>=2.0
23
- Requires-Dist: pymultirole-plugins<0.7.0,>=0.6.0
23
+ Requires-Dist: pymultirole-plugins<1.7.0,>=1.6.0
24
24
  Requires-Dist: python-singleton-metaclasses
25
25
  Requires-Dist: requests
26
26
  Requires-Dist: requests-cache
@@ -29,13 +29,14 @@ Provides-Extra: dev
29
29
  Requires-Dist: bump2version; extra == 'dev'
30
30
  Requires-Dist: pre-commit; extra == 'dev'
31
31
  Provides-Extra: docs
32
- Requires-Dist: jupyter-sphinx; extra == 'docs'
33
32
  Requires-Dist: lxml-html-clean; extra == 'docs'
34
33
  Requires-Dist: m2r2; extra == 'docs'
35
- Requires-Dist: nbconvert>=7.17.0; extra == 'docs'
36
34
  Requires-Dist: sphinx; extra == 'docs'
37
35
  Requires-Dist: sphinx-rtd-theme; extra == 'docs'
38
36
  Requires-Dist: sphinxcontrib-apidoc; extra == 'docs'
37
+ Provides-Extra: sbom
38
+ Requires-Dist: cyclonedx-bom; extra == 'sbom'
39
+ Requires-Dist: pip-audit; extra == 'sbom'
39
40
  Provides-Extra: spacy
40
41
  Requires-Dist: spacy>=3.0; extra == 'spacy'
41
42
  Provides-Extra: test
@@ -109,3 +110,29 @@ uv run pytest
109
110
  ```bash
110
111
  uv run pytest --cov=src --cov-report=term-missing
111
112
  ```
113
+
114
+ ## SBOM & vulnerability check
115
+
116
+ Install the SBOM dependencies:
117
+
118
+ ```
119
+ uv sync --extra sbom
120
+ ```
121
+
122
+ Generate a CycloneDX SBOM from the current environment:
123
+
124
+ ```
125
+ uv run cyclonedx-py environment -o sbom.cdx.json --output-format json
126
+ ```
127
+
128
+ Audit dependencies for known vulnerabilities:
129
+
130
+ ```
131
+ uv run pip-audit --format json --output audit-report.json
132
+ ```
133
+
134
+ To fail on any known vulnerability (useful in CI):
135
+
136
+ ```
137
+ uv run pip-audit --strict
138
+ ```
@@ -62,3 +62,29 @@ uv run pytest
62
62
  ```bash
63
63
  uv run pytest --cov=src --cov-report=term-missing
64
64
  ```
65
+
66
+ ## SBOM & vulnerability check
67
+
68
+ Install the SBOM dependencies:
69
+
70
+ ```
71
+ uv sync --extra sbom
72
+ ```
73
+
74
+ Generate a CycloneDX SBOM from the current environment:
75
+
76
+ ```
77
+ uv run cyclonedx-py environment -o sbom.cdx.json --output-format json
78
+ ```
79
+
80
+ Audit dependencies for known vulnerabilities:
81
+
82
+ ```
83
+ uv run pip-audit --format json --output audit-report.json
84
+ ```
85
+
86
+ To fail on any known vulnerability (useful in CI):
87
+
88
+ ```
89
+ uv run pip-audit --strict
90
+ ```
@@ -28,7 +28,7 @@ classifiers = [
28
28
  "Programming Language :: Python :: 3.12",
29
29
  ]
30
30
  dependencies = [
31
- "pymultirole-plugins>=0.6.0,<0.7.0",
31
+ "pymultirole-plugins>=1.6.0,<1.7.0",
32
32
  "pydantic>=2.0,<3.0",
33
33
  "requests",
34
34
  "requests-cache",
@@ -59,8 +59,6 @@ docs = [
59
59
  "sphinx-rtd-theme",
60
60
  "m2r2",
61
61
  "sphinxcontrib.apidoc",
62
- "jupyter_sphinx",
63
- "nbconvert>=7.17.0",
64
62
  "lxml_html_clean",
65
63
  ]
66
64
  dev = [
@@ -68,12 +66,29 @@ dev = [
68
66
  "bump2version",
69
67
  ]
70
68
 
69
+ sbom = ["cyclonedx-bom", "pip-audit"]
70
+
71
71
  [tool.hatch.version]
72
72
  path = "src/pyannotators_entityfishing/__init__.py"
73
73
 
74
74
  [tool.hatch.build.targets.wheel]
75
75
  packages = ["src/pyannotators_entityfishing"]
76
76
 
77
+ [tool.hatch.build]
78
+ exclude = [
79
+ "/tests",
80
+ "/docs",
81
+ "Jenkinsfile",
82
+ "Dockerfile",
83
+ "bumpversion.py",
84
+ "mypy.ini",
85
+ "hgnc_cache.sqlite",
86
+ "trivy-html-template.tpl",
87
+ "MIGRATION.md",
88
+ ".gitignore",
89
+ ".dockerignore"
90
+ ]
91
+
77
92
  [tool.pytest.ini_options]
78
93
  addopts = "--durations=5"
79
94
  norecursedirs = ["docs"]
@@ -1,3 +1,3 @@
1
1
  """Annotator based on entity-fishing"""
2
2
 
3
- __version__ = "1.6.28"
3
+ __version__ = "1.6.34"
@@ -148,12 +148,12 @@ def _enrich_concepts_with_properties(concepts: dict, wiki_props: list[str], mult
148
148
  """Enrich concept dicts with extracted wikidata_properties."""
149
149
  for concept in concepts.values():
150
150
  if concept is not None and "statements" in concept:
151
- fingerprint = defaultdict(list)
151
+ fingerprint = defaultdict(set)
152
152
  for wp in wiki_props:
153
- fingerprint[wp] = []
153
+ fingerprint[wp] = set()
154
154
  for st in concept["statements"]:
155
155
  if st["propertyId"] in wiki_props:
156
- fingerprint[st["propertyId"]].append(st["value"])
156
+ fingerprint[st["propertyId"]].add(st["value"])
157
157
  if sum(len(v) for v in fingerprint.values()) > 0:
158
158
  concept["wikidata_properties"] = dict(fingerprint)
159
159
 
@@ -184,7 +184,7 @@ def _build_annotation(entity: dict, label: str, concept: dict | None, lang: str,
184
184
  if fingerprints:
185
185
  fp_parts = []
186
186
  for f in fingerprints:
187
- fvals = concept["wikidata_properties"].get(f, [])
187
+ fvals = list(concept["wikidata_properties"].get(f, []))
188
188
  if fvals:
189
189
  fingers = [f"{f}:{v}" for v in sorted(fvals) if isinstance(v, str)]
190
190
  if multivalued_props:
@@ -194,7 +194,7 @@ def _build_annotation(entity: dict, label: str, concept: dict | None, lang: str,
194
194
  ann_term.properties["fingerprint"] = ",".join(fp_parts)
195
195
  if wikidata_properties:
196
196
  for wp in wikidata_properties:
197
- fvals = concept["wikidata_properties"].get(wp, [])
197
+ fvals = list(concept["wikidata_properties"].get(wp, []))
198
198
  if len(fvals) == 1:
199
199
  ann_term.properties[wp] = fvals[0]
200
200
  elif len(fvals) > 1:
@@ -1,18 +0,0 @@
1
- FROM python:3.12-slim-bookworm
2
- # Install prerequisites
3
- RUN apt-get update -y && \
4
- apt-get install -y \
5
- gcc && \
6
- apt-get install -y --no-install-recommends \
7
- g++ \
8
- git && \
9
- # Final upgrade + clean
10
- apt-get update -y && \
11
- apt-get clean all -y
12
-
13
- # Install uv
14
- RUN pip install uv
15
-
16
- # Add pyproject.toml + README.md for uv install
17
- ADD pyproject.toml pyproject.toml
18
- ADD README.md README.md