Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/support python 3.13 #331

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
lint:
strategy:
matrix:
python-version: [ "3.9","3.10","3.11" ]
python-version: [ "3.9","3.10","3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
environment: ci
strategy:
matrix:
python-version: [ "3.9","3.10","3.11" ]
python-version: [ "3.9","3.10","3.11", "3.12", "3.13" ]
runs-on: ubuntu-latest
needs: [ lint ]
steps:
Expand All @@ -86,7 +86,7 @@ jobs:
environment: ci
strategy:
matrix:
python-version: [ "3.9","3.10","3.11" ]
python-version: [ "3.9","3.10","3.11", "3.12", "3.13" ]
runs-on: ubuntu-latest
needs: [ lint ]
steps:
Expand All @@ -105,7 +105,27 @@ jobs:
test_ingest_unit:
strategy:
matrix:
python-version: [ "3.9","3.10" ]
python-version: [ "3.9","3.10","3.11", "3.12", "3.13" ]
runs-on: ubuntu-latest
needs: [ lint ]
steps:
# actions/checkout MUST come before auth
- uses: 'actions/checkout@v4'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test Ingest (unit)
run: |
make install-base
make install-test
make unit-test

test_ingest_unit_unstructured:
strategy:
matrix:
# TODO include 3.13 when unstructured supports it
python-version: [ "3.9","3.10","3.11", "3.12"]
runs-on: ubuntu-latest
env:
NLTK_DATA: ${{ github.workspace }}/nltk_data
Expand All @@ -122,4 +142,5 @@ jobs:
make install-base
make install-test
pip install unstructured
make unit-test
python -m nltk.downloader -d $NLTK_DATA punkt_tab averaged_perceptron_tagger_eng
make unit-test-unstructured
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.3.13-dev3
## 0.3.13-dev4

### Fixes

Expand All @@ -9,6 +9,7 @@
### Enhancements

* **Async support for all IO-bounded embedders**
* **Expand support to Python 3.13**

## 0.3.12

Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ check-version:
###########
.PHONY: unit-test
unit-test:
PYTHONPATH=. pytest -sv --cov unstructured_ingest/ test/unit
PYTHONPATH=. pytest -sv --cov unstructured_ingest/ test/unit --ignore test/unit/unstructured

.PHONY: unit-test-unstructured
unit-test-unstructured:
PYTHONPATH=. pytest -sv --cov unstructured_ingest/ test/unit/unstructured

.PHONY: integration-test
integration-test:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def load_requirements(file: Union[str, Path]) -> List[str]:
long_description_content_type="text/markdown",
keywords="NLP PDF HTML CV XML parsing preprocessing",
url="https://github.com/Unstructured-IO/unstructured-ingest",
python_requires=">=3.9.0,<3.13",
python_requires=">=3.9.0,<3.14",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/embed/test_mixedbreadai.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def mock_embeddings(
)
)

raw_elements = [{"text": f"This is sentence {i+1}"} for i in range(2)]
raw_elements = [{"text": f"This is sentence {i + 1}"} for i in range(2)]
elements = encoder.embed_documents(
elements=raw_elements,
)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/embed/test_octoai.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_embed_documents_does_not_break_element_to_dict(mocker):
mocker.patch.object(OctoAiEmbeddingConfig, "get_client", return_value=mock_client)

encoder = OctoAIEmbeddingEncoder(config=OctoAiEmbeddingConfig(api_key="api_key"))
raw_elements = [{"text": f"This is sentence {i+1}"} for i in range(2)]
raw_elements = [{"text": f"This is sentence {i + 1}"} for i in range(2)]

elements = encoder.embed_documents(
elements=raw_elements,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/embed/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_embed_documents_does_not_break_element_to_dict(mocker):
mocker.patch.object(OpenAIEmbeddingConfig, "get_client", return_value=mock_client)

encoder = OpenAIEmbeddingEncoder(config=OpenAIEmbeddingConfig(api_key="api_key"))
raw_elements = [{"text": f"This is sentence {i+1}"} for i in range(2)]
raw_elements = [{"text": f"This is sentence {i + 1}"} for i in range(2)]

elements = encoder.embed_documents(
elements=raw_elements,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/embed/test_vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_embed_documents_does_not_break_element_to_dict(mocker):
# Mock create_client to return our mock_client
mocker.patch.object(VertexAIEmbeddingConfig, "get_client", return_value=mock_client)
encoder = VertexAIEmbeddingEncoder(config=VertexAIEmbeddingConfig(api_key={"api_key": "value"}))
raw_elements = [{"text": f"This is sentence {i+1}"} for i in range(2)]
raw_elements = [{"text": f"This is sentence {i + 1}"} for i in range(2)]

elements = encoder.embed_documents(
elements=raw_elements,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/embed/test_voyageai.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_embed_documents_does_not_break_element_to_dict(mocker):
encoder = VoyageAIEmbeddingEncoder(
config=VoyageAIEmbeddingConfig(api_key="api_key", model_name="voyage-law-2")
)
raw_elements = [{"text": f"This is sentence {i+1}"} for i in range(2)]
raw_elements = [{"text": f"This is sentence {i + 1}"} for i in range(2)]

elements = encoder.embed_documents(
elements=raw_elements,
Expand Down
156 changes: 0 additions & 156 deletions test/unit/pipeline/reformat/test_chunking.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)

test_file_path = Path(__file__).resolve()
project_root = test_file_path.parents[2]
project_root = test_file_path.parents[3]
docs_path = project_root / "example-docs"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ReadConfig,
)

DIRECTORY = pathlib.Path(__file__).parents[2].resolve()
DIRECTORY = pathlib.Path(__file__).parents[3].resolve()
EXAMPLE_DOCS_DIRECTORY = DIRECTORY / "example-docs"
TEST_DOWNLOAD_DIR = "/tmp"
TEST_OUTPUT_DIR = "/tmp"
Expand Down
2 changes: 1 addition & 1 deletion unstructured_ingest/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.13-dev3" # pragma: no cover
__version__ = "0.3.13-dev4" # pragma: no cover
2 changes: 1 addition & 1 deletion unstructured_ingest/connector/notion/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def build_columned_list(client: Client, column_parent: Block) -> HtmlTag:
):
columns_content.append(
Div(
[Style(f"width:{100/num_columns}%; float: left")],
[Style(f"width:{100 / num_columns}%; float: left")],
[content.block.get_html() for content in column_content_chunk],
),
)
Expand Down
2 changes: 1 addition & 1 deletion unstructured_ingest/v2/examples/chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
access_config=ChromaAccessConfig(settings=None, headers=None),
host="localhost",
port=8047,
collection_name=f"test-collection-{random.randint(1000,9999)}",
collection_name=f"test-collection-{random.randint(1000, 9999)}",
tenant="default_tenant",
database="default_database",
),
Expand Down
2 changes: 1 addition & 1 deletion unstructured_ingest/v2/examples/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
access_config=MongoDBAccessConfig(uri=None),
host="localhost",
port=27017,
collection=f"test-collection-{random.randint(1000,9999)}",
collection=f"test-collection-{random.randint(1000, 9999)}",
database="testDatabase",
),
stager_config=MongoDBUploadStagerConfig(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def build_html(
if isinstance(current_block["block"].block, notion_blocks.Column):
html.append(
Div(
[Style(f"width:{100/current_block['peers_count']}%; float: left")],
[Style(f"width:{100 / current_block['peers_count']}%; float: left")],
children_html,
)
)
Expand Down
Loading