Skip to content

ref: Make ollama an optional dependency#2

Merged
NicoHinderling merged 3 commits intogetsentry:mainfrom
NicoHinderling:nh/make-ollama-optional
Mar 24, 2026
Merged

ref: Make ollama an optional dependency#2
NicoHinderling merged 3 commits intogetsentry:mainfrom
NicoHinderling:nh/make-ollama-optional

Conversation

@NicoHinderling
Copy link
Collaborator

Move ollama from a hard dependency to an optional [suggest] extra so the
package can be installed without pulling in pydantic>=2.9, which conflicts
with projects pinned to pydantic v1 (e.g. Sentry).

Only the suggest command uses ollama — check and baseline work without
it. When ollama is missing, suggest raises a clear error with install
instructions.

Changes:

  • pyproject.toml: ollama>=0.3.0 moved to [project.optional-dependencies.suggest]
  • ollama_matcher.py: guarded import with try/except, clear ImportError message
  • cli.py: lazy imports so check/baseline never touch ollama modules
  • tests/test_ollama_matcher.py: mocks updated to work with or without ollama installed
  • README.md + justfile: updated install instructions to document [suggest] extra
  • Version bumped to 0.3.0

Move ollama from hard dependency to optional [suggest] extra so the
package can be installed without pulling in pydantic v2, which conflicts
with projects pinned to pydantic v1 (e.g. Sentry).

The check and baseline commands work without ollama. The suggest command
gives a clear error with install instructions if ollama is missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NicoHinderling NicoHinderling marked this pull request as ready for review March 23, 2026 21:45
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@NicoHinderling NicoHinderling merged commit 6372ec0 into getsentry:main Mar 24, 2026
3 of 5 checks passed
NicoHinderling added a commit to getsentry/sentry that referenced this pull request Mar 25, 2026
*Need to re-run `uv lock` after
getsentry/pypi#2009 merges and update this PR
before merging*


## Summary
- Add `codeowners-coverage>=0.3.0` to dev dependency group in
`pyproject.toml`
- Bump CI workflow from `0.2.1` to `0.3.0`

v0.3.0 makes ollama an optional dependency
(getsentry/codeowners-coverage#2), removing the pydantic conflict that
previously blocked adding this as a dev dependency. This enables running
`codeowners-coverage check` locally via `devenv sync`.

## Blockers
- getsentry/pypi#2009 must merge before `uv lock` can resolve — lockfile
update will follow

## Test plan
- [ ] getsentry/pypi#2009 merges
- [ ] `uv lock` resolves successfully
- [ ] `devenv sync` installs the package
- [ ] `codeowners-coverage check` runs locally
- [ ] CI workflow passes with v0.3.0

---------

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.

1 participant