Skip to content

Declare packaging as install requirement (fixes #2022)#2024

Merged
dirkkul merged 2 commits intoweaviate:mainfrom
ducroq:feature/add-packaging-dep
Apr 29, 2026
Merged

Declare packaging as install requirement (fixes #2022)#2024
dirkkul merged 2 commits intoweaviate:mainfrom
ducroq:feature/add-packaging-dep

Conversation

@ducroq
Copy link
Copy Markdown
Contributor

@ducroq ducroq commented Apr 29, 2026

Adds packaging>=21.0 to install_requires in setup.cfg.

Why

weaviate-client imports from packaging import version at module load in two places:

  • weaviate/exceptions.py:9
  • weaviate/proto/v1/__init__.py:12

Until v4.20.4 the dependency was satisfied transitively through deprecation, which was removed in v4.20.5 (#1999, "remove unmaintained deprecation package, use stdlib instead"). On environments that don't get packaging from somewhere else — slim Python container images are the canonical case — the first import weaviate now fails with ModuleNotFoundError: No module named 'packaging'. Reproducible on every release from 4.20.5 onwards.

Reproduction (no longer fails after this PR)

FROM python:3.12-slim
RUN pip install --no-cache-dir weaviate-client==4.21.0
RUN python -c "import weaviate"

Version pin

>=21.0 is conservative — packaging.version.Version has been stable since v17.0. Happy to widen or tighten if you have a preferred lower bound.

Notes

`weaviate.exceptions` and `weaviate.proto.v1.__init__` import
`from packaging import version` at module load. The dependency was
previously satisfied transitively through `deprecation`, which was removed
in v4.20.5 (weaviate#1999). Slim Python images that don't pre-install `packaging`
now fail with `ModuleNotFoundError: No module named 'packaging'` on the
first `import weaviate`.

Adds `packaging>=21.0` to install_requires. Closes weaviate#2022.
Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot
Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@dirkkul
Copy link
Copy Markdown
Collaborator

dirkkul commented Apr 29, 2026

Thank you! Can you also add it here: requirements-devel.txt - I will then merge after you've agreed to the CLA!

@ducroq
Copy link
Copy Markdown
Contributor Author

ducroq commented Apr 29, 2026

Done — added packaging==26.2 to requirements-devel.txt (matching the recent stable version in your install_requires range). New commit pushed.

Picked 26.2 since it's the version currently resolved in our own deploy chain and aligns with your existing pins; happy to adjust to whatever version your CI standardises on.

@ducroq
Copy link
Copy Markdown
Contributor Author

ducroq commented Apr 29, 2026

I agree to the Weaviate CLA.

@dirkkul dirkkul merged commit 29e5eb7 into weaviate:main Apr 29, 2026
122 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

weaviate-client 4.20.5+ imports packaging without declaring it as a dependency

3 participants