Skip to content

fix: add __version__ attribute to package#635

Open
abdelhadi703 wants to merge 1 commit intoollama:mainfrom
abdelhadi703:fix/add-version-attribute
Open

fix: add __version__ attribute to package#635
abdelhadi703 wants to merge 1 commit intoollama:mainfrom
abdelhadi703:fix/add-version-attribute

Conversation

@abdelhadi703
Copy link
Copy Markdown

Summary

The ollama package was missing a __version__ attribute, causing AttributeError: module 'ollama' has no attribute '__version__' when users try to access ollama.__version__.

Changes

  • Added __version__ attribute using importlib.metadata.version('ollama')
  • Falls back to '0.0.0' if metadata is unavailable (e.g., when running from source)
  • Added '__version__' to __all__ for proper exports

Testing

>>> import ollama
>>> ollama.__version__
'0.6.2'

Fixes #623

The ollama package was missing a __version__ attribute, causing
AttributeError when users try to access ollama.__version__.

This fix adds __version__ using importlib.metadata.version() which
reads the version from package metadata (set by hatch-vcs from git
tags). Falls back to '0.0.0' if metadata is unavailable.

Fixes ollama#623

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

“缺少 __version__属性

1 participant