Skip to content

Commit 08ae930

Browse files
ds-filipknefelFilip Knefel
andauthored
chore: drop support for python 3.9 (#572)
Dropped support for python `3.9` in lights of upcoming EOL in October (https://devguide.python.org/versions/). Upgraded dependencies. --------- Co-authored-by: Filip Knefel <[email protected]>
1 parent bad218c commit 08ae930

File tree

11 files changed

+2196
-3027
lines changed

11 files changed

+2196
-3027
lines changed

.github/workflows/unit_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
lint:
1818
strategy:
1919
matrix:
20-
python-version: [ "3.9","3.10","3.11", "3.12" ]
20+
python-version: [ "3.10","3.11", "3.12" ]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v4
@@ -79,7 +79,7 @@ jobs:
7979
environment: ci
8080
strategy:
8181
matrix:
82-
python-version: [ "3.9","3.10","3.11", "3.12" ]
82+
python-version: [ "3.10","3.11", "3.12" ]
8383
runs-on: ubuntu-latest
8484
needs: [ lint ]
8585
steps:
@@ -100,7 +100,7 @@ jobs:
100100
environment: ci
101101
strategy:
102102
matrix:
103-
python-version: [ "3.9","3.10","3.11", "3.12" ]
103+
python-version: [ "3.10","3.11", "3.12" ]
104104
runs-on: ubuntu-latest
105105
needs: [ lint ]
106106
steps:
@@ -119,7 +119,7 @@ jobs:
119119
test_ingest_unit:
120120
strategy:
121121
matrix:
122-
python-version: [ "3.9","3.10","3.11", "3.12" ]
122+
python-version: [ "3.10","3.11", "3.12" ]
123123
runs-on: ubuntu-latest
124124
needs: [ lint ]
125125
steps:
@@ -144,7 +144,7 @@ jobs:
144144
strategy:
145145
matrix:
146146
# TODO include 3.13 when unstructured supports it
147-
python-version: [ "3.9","3.10","3.11", "3.12"]
147+
python-version: [ "3.10","3.11", "3.12"]
148148
runs-on: ubuntu-latest
149149
env:
150150
NLTK_DATA: ${{ github.workspace }}/nltk_data

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.2.0
2+
* **Drop Python 3.9 support**
3+
14
## 1.1.3
25

36
* **Fix: Remove unnecessary deletion operation in ES connector**

examples/sql.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
SQLITE_DB_PATH = "test-sql-db.sqlite"
3232

3333
if __name__ == "__main__":
34-
3534
configs = {
3635
"context": ProcessorConfig(work_dir=str(work_dir.resolve()), verbose=True),
3736
"indexer_config": LocalIndexerConfig(input_path=str(docs_path.resolve()) + "/multisimple/"),
@@ -56,8 +55,7 @@
5655

5756
query = None
5857
script_path = (
59-
Path(__file__).parent.parent
60-
/ Path("test_e2e/env_setup/sql/sqlite-schema.sql")
58+
Path(__file__).parent.parent / Path("test_e2e/env_setup/sql/sqlite-schema.sql")
6159
).resolve()
6260
with open(script_path) as f:
6361
query = f.read()

pyproject.toml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "unstructured_ingest"
33
description = "Local ETL data pipeline to get data RAG ready"
4-
requires-python = ">=3.9, <3.13"
4+
requires-python = ">=3.10, <3.13"
55
authors = [{name = "Unstructured Technologies", email = "[email protected]"}]
66
classifiers = [
77
"Development Status :: 4 - Beta",
@@ -11,7 +11,6 @@ classifiers = [
1111
"License :: OSI Approved :: Apache Software License",
1212
"Operating System :: OS Independent",
1313
"Programming Language :: Python :: 3",
14-
"Programming Language :: Python :: 3.9",
1514
"Programming Language :: Python :: 3.10",
1615
"Programming Language :: Python :: 3.11",
1716
"Programming Language :: Python :: 3.12",
@@ -147,21 +146,13 @@ test = [
147146
]
148147
# Add constraints needed for CI
149148
ci = [
150-
# consistency with local-inference-pin
151-
"protobuf<4.24",
152149
"grpcio>=1.65.5",
153150
# TODO: Pinned in transformers package, remove when that gets updated
154151
"tokenizers>=0.19,<0.20",
155-
# TODO: Constaint due to boto, with python before 3.10 not requiring openssl 1.1.1, remove when that gets
156-
# updated or we drop support for 3.9
157-
"urllib3<1.27",
158152
# TODO: Constriant due to aiobotocore, remove when that gets updates:
159153
"botocore<1.34.132",
160154
# TODO: Constriant due to both 8.5.0 and 8.4.0 being installed during pip-compile
161155
"importlib-metadata>=8.5.0",
162-
# TODO: Constraint due to boto, with python before 3.10 not requiring openssl 1.1.1, remove when that gets
163-
# updated or we drop support for 3.9
164-
"urllib3<1.27",
165156
"unstructured-client>= 0.25.8",
166157
"fsspec==2024.5.0",
167158
# python 3.12 support

scripts/pip-compile.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
set -e
44

5-
# python version must match lowest supported (3.9)
6-
python_version=${UV_PYTHON_VERSION:-"3.9"}
5+
# python version must match lowest supported (3.10)
6+
python_version=${UV_PYTHON_VERSION:-"3.10"}
77

88
# if major and minor python version (x.y) is not equal to current python_version, error out
99
if [[ $(python --version | cut -d ' ' -f 2 | cut -d '.' -f 1-2) != $(echo "$python_version" | cut -d '.' -f 1-2) ]]; then

unstructured_ingest/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.3" # pragma: no cover
1+
__version__ = "1.2.0" # pragma: no cover

unstructured_ingest/otel.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
3232
self.log_out(self.formatter(span))
3333
return SpanExportResult.SUCCESS
3434

35+
3536
def get_log_out() -> Callable:
3637
level_names_mapping = {
37-
'CRITICAL': logging.CRITICAL,
38-
'FATAL': logging.FATAL,
39-
'ERROR': logging.ERROR,
40-
'WARN': logging.WARNING,
41-
'WARNING': logging.WARNING,
42-
'INFO': logging.INFO,
43-
'DEBUG': logging.DEBUG,
44-
'NOTSET': logging.NOTSET,
38+
"CRITICAL": logging.CRITICAL,
39+
"FATAL": logging.FATAL,
40+
"ERROR": logging.ERROR,
41+
"WARN": logging.WARNING,
42+
"WARNING": logging.WARNING,
43+
"INFO": logging.INFO,
44+
"DEBUG": logging.DEBUG,
45+
"NOTSET": logging.NOTSET,
4546
}
4647
log_level = os.getenv("OTEL_LOG_LEVEL", "DEBUG").upper()
4748
log_level_int = level_names_mapping.get(log_level, logging.DEBUG)
4849
return lambda message: logger.log(log_level_int, message)
4950

51+
5052
@dataclass
5153
class OtelHandler:
5254
otel_endpoint: Optional[str] = None

unstructured_ingest/processes/connectors/elasticsearch/elasticsearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class ElasticsearchUploadStager(UploadStager):
335335

336336
def conform_dict(self, element_dict: dict, file_data: FileData) -> dict:
337337
data = element_dict.copy()
338-
# when _op_type is not specified, it defaults to "index":
338+
# when _op_type is not specified, it defaults to "index":
339339
# Overwrites if exists, creates if not.
340340
resp = {
341341
"_index": self.upload_stager_config.index_name,

unstructured_ingest/processes/connectors/fsspec/fsspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def fs(self) -> "AbstractFileSystem":
385385

386386
def __post_init__(self):
387387
super().__post_init__()
388-
# TODO once python3.9 no longer supported and kw_only is allowed in dataclasses, remove:
388+
# TODO: Consider using `kw_only` instead
389389
if not self.upload_config:
390390
raise TypeError(
391391
f"{self.__class__.__name__}.__init__() "

unstructured_ingest/utils/filesystem.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
def mkdir_concurrent_safe(path: Path) -> None:
1212
"""
1313
Create directory safely in concurrent environments, handling race conditions.
14-
14+
1515
This addresses the issue where Path.mkdir(parents=True, exist_ok=True) can still
16-
raise FileExistsError when multiple processes attempt to create overlapping
16+
raise FileExistsError when multiple processes attempt to create overlapping
1717
directory structures simultaneously. In this codebase, this occurs when multiple
1818
files are being downloaded in parallel and archive extraction is happening in parallel.
19-
19+
2020
Related: https://github.com/python/cpython/pull/112966/files
2121
Python core team used the same approach to fix zipfile race conditions.
2222
"""
2323
try:
2424
path.mkdir(parents=True, exist_ok=True)
2525
except FileExistsError:
2626
if not (path.exists() and path.is_dir()):
27-
raise
27+
raise

0 commit comments

Comments
 (0)