Skip to content

fix: use installed package version for /version endpoint#7414

Open
Functionhx wants to merge 1 commit into
chroma-core:mainfrom
Functionhx:fix/docker-version-endpoint
Open

fix: use installed package version for /version endpoint#7414
Functionhx wants to merge 1 commit into
chroma-core:mainfrom
Functionhx:fix/docker-version-endpoint

Conversation

@Functionhx

Copy link
Copy Markdown

Fixes #1341

The /version endpoint currently returns a hardcoded version string. This changes version to read from importlib.metadata.version('chromadb') so it reflects the actual installed package version. Falls back to '0.0.0' if the package is not installed.

Fixes chroma-core#1341

The /version endpoint returns a hardcoded version string. This changes
__version__ to read from importlib.metadata.version('chromadb') so it
reflects the actual installed package version. Falls back to '0.0.0' if
the package is not installed.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@eeshsaxena eeshsaxena left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks correct to me. I confirmed the distribution name in pyproject.toml is chromadb, so version("chromadb") resolves the installed package version, and __version__ is what the /version endpoint (segment.py) and the client User-Agent header (fastapi.py/async_fastapi.py) report - so this makes all of them track the real installed version instead of a hardcoded string that drifts. The PackageNotFoundError -> "0.0.0" guard is the right shape.

One thing worth being aware of: the fallback path is hit when the package has no installed metadata - i.e. running straight from a source checkout without an install. A normal pip install/pip install -e . both write metadata, so version("chromadb") works there; it's only a bare source run that would now report 0.0.0 (previously it showed the hardcoded string). That seems like an acceptable trade for not letting the hardcoded value go stale, but flagging it in case any dev workflow relies on __version__ being meaningful without an install.

Deferring to the maintainers.

@Functionhx

Copy link
Copy Markdown
Author

Thanks! Yeah, 0.0.0 is intentional — better than silently reporting a stale version after an upgrade. The bare-source case is pretty rare in practice. Happy to tweak if maintainers prefer something else.

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.

[Bug]: dev Docker image returning the wrong version

2 participants