Skip to content

Commit c4bdeb2

Browse files
authored
600 Release (#1798)
* Bump versions and update docs * deprecate pkg-resources (#1782) * More robust shared pyspark ml param import (#1796) * deprecate pkg-resources * more robust import of _shared_pyspark_ml_param * enterprise NLP 600, import BertForAssertionClassification and FhirDeIdentification (#1797)
1 parent d636a5e commit c4bdeb2

File tree

10 files changed

+45
-25
lines changed

10 files changed

+45
-25
lines changed

docs/en/jsl/jsl_release_notes.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ sidebar:
1616
See [Github Releases](https://github.com/JohnSnowLabs/johnsnowlabs/releases) for detailed information on Release History and Features
1717

1818

19+
## 6.0.0
20+
Release date: 5-4-2025
21+
22+
The John Snow Labs 6.0.0 Library released with the following pre-installed and recommended dependencies
23+
24+
{:.table-model-big}
25+
| Library | Version |
26+
|-----------------------------------------------------------------------------------------|------------|
27+
| [Visual NLP](https://nlp.johnsnowlabs.com/docs/en/spark_ocr_versions/ocr_release_notes) | `6.0.0` |
28+
| [Enterprise NLP](https://nlp.johnsnowlabs.com/docs/en/licensed_annotators) | `6.0.0` |
29+
| [Finance NLP](https://nlp.johnsnowlabs.com/docs/en/financial_release_notes) | `1.X.X` |
30+
| [Legal NLP](https://nlp.johnsnowlabs.com/docs/en/legal_release_notes) | `1.X.X` |
31+
| [NLU](https://github.com/JohnSnowLabs/nlu/releases) | `5.4.1` |
32+
| [Spark-NLP-Display](https://sparknlp.org/docs/en/display) | `5.0` |
33+
| [Spark-NLP](https://github.com/JohnSnowLabs/spark-nlp/releases/) | `6.0.0` |
34+
| [Pyspark](https://spark.apache.org/docs/latest/api/python/) | `3.4.0` |
35+
36+
1937

2038
## 5.5.5
2139
Release date: 3-14-2025

johnsnowlabs/abstract_base/software_product.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from abc import ABC
44
from typing import List, Set, Optional
55

6-
import pkg_resources
6+
from importlib.metadata import version
77

88
from johnsnowlabs import settings
99
from johnsnowlabs.abstract_base.lib_resolver import Py4JJslLibDependencyResolverABC
@@ -93,17 +93,10 @@ def check_installed_correct_version(
9393
):
9494
return False
9595
try:
96-
if (
97-
pkg_resources.get_distribution(cls.pypi_name).version
98-
== cls.latest_version.as_str()
99-
):
96+
if version(cls.pypi_name) == cls.latest_version.as_str():
10097
# print(f'👌 Installed version for {cls.logo + cls.name} is correct, no changes made.')
10198
return True
10299
else:
103-
# print(f'🤓 Installed version for {cls.logo + cls.name} is incorrect, '
104-
# f'should be {cls.latest_version.as_str()} but is {pkg_resources.get_distribution(cls.pypi_name).version} '
105-
# f'upgrading the package')
106-
107100
return False
108101
except Exception as err:
109102
v = get_pip_lib_version(lib=cls.pypi_name, py_exec=python_exec_path)
@@ -118,11 +111,11 @@ def get_installed_version(
118111
download_folder: str = None,
119112
prefer_pip=False,
120113
fallback_import=False,
121-
) -> bool:
114+
) -> str:
122115
# Only supported for current Py Exec Path, return True otherwise
123116
if not prefer_pip:
124117
try:
125-
return pkg_resources.get_distribution(cls.pypi_name).version
118+
return version(cls.pypi_name)
126119
except:
127120
pass
128121
v = get_pip_lib_version(lib=cls.pypi_name, py_exec=python_exec_path)

johnsnowlabs/auto_install/health_checks/ocr_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ def run_test():
5353
]
5454
)
5555

56-
import pkg_resources
56+
pdf_example = str(files("sparkocr").joinpath("resources/ocr/pdfs/tabular-pdf/data.pdf"))
5757

58-
pdf_example = pkg_resources.resource_filename(
59-
"sparkocr", "resources/ocr/pdfs/tabular-pdf/data.pdf"
60-
)
6158
pdf_example_df = spark.read.format("binaryFile").load(pdf_example).cache()
6259
pipeline.transform(pdf_example_df).show()
6360

johnsnowlabs/finance.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
ContextualEntityRuler,
129129
PretrainedZeroShotNER,
130130
StructuredJsonConverter,
131+
BertForAssertionClassification,
132+
FhirDeIdentification
131133
)
132134

133135
from sparknlp_jsl.modelTracer import ModelTracer

johnsnowlabs/legal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@
126126
ContextualEntityRuler,
127127
PretrainedZeroShotNER,
128128
StructuredJsonConverter,
129+
BertForAssertionClassification,
130+
FhirDeIdentification
129131
)
130132
from sparknlp_jsl.modelTracer import ModelTracer
131133
from sparknlp_jsl.pipeline_tracer import PipelineTracer

johnsnowlabs/medical.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
ContextualEntityRuler,
104104
PretrainedZeroShotNER,
105105
StructuredJsonConverter,
106+
BertForAssertionClassification,
107+
FhirDeIdentification
106108
)
107109
from sparknlp_jsl.structured_deidentification import StructuredDeidentification
108110
from sparknlp_jsl.text_to_documents_columns import TextToDocumentsColumns

johnsnowlabs/nlp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@
4141

4242

4343
if try_import_lib("pyspark"):
44-
import pyspark.ml.param.shared as _shared_pyspark_ml_param
44+
try:
45+
import pyspark.ml.param.shared as _shared_pyspark_ml_param
46+
except Exception as e:
47+
try:
48+
from pyspark.ml.param import shared as _shared_pyspark_ml_param
49+
except Exception as e:
50+
_shared_pyspark_ml_param = None
51+
4552
import pyspark.sql as SQL
4653
import pyspark.sql.functions as F
4754
import pyspark.sql.types as T

johnsnowlabs/settings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
# These versions are used for auto-installs and version checks
1212

13-
raw_version_jsl_lib = "5.5.5"
13+
raw_version_jsl_lib = "6.0.0"
1414

15-
raw_version_nlp = "5.5.3"
15+
raw_version_nlp = "6.0.0"
1616

1717
raw_version_nlu = "5.4.1"
1818

1919

2020
raw_version_pyspark = "3.4.0"
2121
raw_version_nlp_display = "5.0"
2222

23-
raw_version_medical = "5.5.3"
24-
raw_version_secret_medical = "5.5.3"
23+
raw_version_medical = "6.0.0"
24+
raw_version_secret_medical = "6.0.0"
2525

26-
raw_version_secret_ocr = "5.5.0"
27-
raw_version_ocr = "5.5.0"
26+
raw_version_secret_ocr = "6.0.0"
27+
raw_version_ocr = "6.0.0"
2828

2929
raw_version_pydantic = "2"
3030

johnsnowlabs/utils/pip_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
import json
1818
import sys
1919
from urllib import request
20-
from pkg_resources import parse_version
20+
from packaging.version import parse
2121

2222

2323
def get_all_lib_version_on_pypi(pkg_name):
2424
url = f"https://pypi.python.org/pypi/{pkg_name}/json"
2525
releases = json.loads(request.urlopen(url).read())["releases"]
26-
return sorted(releases, key=parse_version, reverse=True)
26+
return sorted(releases, key=parse, reverse=True)
2727

2828

2929
def get_latest_lib_version_on_pypi(pkg_name):

johnsnowlabs/visual.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from sparkocr.transformers import *
1111
from sparkocr.enums import *
12-
import pkg_resources
1312
import sparkocr
1413
from sparkocr.utils import *
1514
from sparkocr.schemas import *

0 commit comments

Comments
 (0)