Skip to content

feat: separate out remaining dependencies and improve tests#789

Open
jakelorocco wants to merge 3 commits intomainfrom
jal/improve-dependency-isolation-tests
Open

feat: separate out remaining dependencies and improve tests#789
jakelorocco wants to merge 3 commits intomainfrom
jal/improve-dependency-isolation-tests

Conversation

@jakelorocco
Copy link
Copy Markdown
Contributor

@jakelorocco jakelorocco commented Apr 6, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Finishes up the dependency isolation tests; splits cli into it's own group; and fixes up import errors and dependency separation.

CI doesn't run the dependency isolation tests; ensured they pass locally.

All nice import error messages function like our current ones. The m cli works this way as well:

(mellea) ~/code/mellea4 ✓ % m --help
The 'm' CLI requires extra dependencies. Please install them with: pip install "mellea[cli]"

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

@jakelorocco jakelorocco linked an issue Apr 6, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@jakelorocco jakelorocco changed the title Jal/improve dependency isolation tests feat: separate out remaining dependencies and improve tests Apr 6, 2026
@github-actions github-actions bot added the enhancement New feature or request label Apr 6, 2026
@jakelorocco jakelorocco force-pushed the jal/improve-dependency-isolation-tests branch from dcc97f5 to 484a590 Compare April 6, 2026 17:13
@jakelorocco jakelorocco marked this pull request as ready for review April 6, 2026 18:21
@jakelorocco jakelorocco requested review from a team as code owners April 6, 2026 18:21
@jakelorocco
Copy link
Copy Markdown
Contributor Author

@frreiss, I believe you are getting pulled in just for the changes in mellea/formatters/granite/retrievers/util.py. This is a quality of life change but let me know if you see issues with it. Thanks!

Copy link
Copy Markdown
Contributor

@planetf1 planetf1 left a comment

Choose a reason for hiding this comment

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

initial comments

The heavy server dependencies are only imported when ``m serve`` is actually invoked.
"""

import typer
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.

this is now an optional dependency if the cli bundle is installed. As such I think it should have a guard/raise an error

except ImportError as e:
raise ImportError(
"The 'm serve' command requires extra dependencies. "
'Please install them with: pip install "mellea[server]"'
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.

typer is in the new cli dependency group. So currently we'd need server and cli (unless typer is transitively found?). Maybe the dependency is needed in server group too, or this message is modified

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.

Ah - I think it is transitive? I wonder if it would then be clearer in the code to split into two and keep typer aligned with a cli exception

"ollama>=0.5.1",
"requests>=2.32.3",
"typer",
"click<8.2.0", # Newer versions will cause errors with --help in typer CLIs.
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.

We used to pin click - are we ok now with the resolved version?

@@ -8,6 +8,10 @@ resolution-markers = [
"python_full_version < '3.12'",
]

[options]
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.

doesn't this go in pyproject.toml as

[tool.uv]
exclude-newer = "P2W"   # or "2 weeks", "14 days"

But that's based off a search - I've not tested but note the explicit timestamp in the exclude (or is that how it works?)

I think the main difference is that a uv lock will not update the timestamp - it only changes when invalidated - so we'd stick on older dependencies longer than intended (which in itself is likely a security issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: improve package import handling and testing

2 participants