generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 461
Have [all] group reference the other optional dependency groups by name #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pgrayy
merged 5 commits into
strands-agents:main
from
zastrowm:fix_dependency_difference
Aug 18, 2025
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5c791f
fix: Unify dependencies in groups & add test to catch future revisions
zastrowm 1c9496b
Switch to tomli because tomllib isn't on 3.10
zastrowm c6c350e
Add tomli as dependency to hatch test
zastrowm 77aab31
fix: Unify dependencies by referencing other groups
zastrowm 2c655ff
Clamp version of openai to avoid breaking change bug in litellm
zastrowm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| """Tests for project configuration consistency.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import tomli | ||
|
|
||
|
|
||
| def test_optional_dependencies_version_consistency(): | ||
| """Test that duplicate dependencies across groups have consistent version specifiers.""" | ||
| pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml" | ||
|
|
||
| with open(pyproject_path, "rb") as f: | ||
| data = tomli.load(f) | ||
|
|
||
| optional_deps = data["project"]["optional-dependencies"] | ||
|
|
||
| # Collect all dependencies and their version specifiers with group info | ||
| dep_specs: dict[str, tuple[str, str]] = {} | ||
|
|
||
| for group_name, deps in optional_deps.items(): | ||
| for dep in deps: | ||
| # Extract package name before any version specifier | ||
| name = dep | ||
| for op in [">=", "==", ">", "<", "~=", "!="]: | ||
| if op in name: | ||
| name = name.split(op)[0].strip() | ||
| break | ||
|
|
||
| # Remove extras like [sql] from name | ||
| if "[" in name: | ||
| name = name.split("[")[0].strip() | ||
|
|
||
| # Extract version specifier (everything after package name) | ||
| version_spec = dep[len(name) :].strip() | ||
| # Remove extras from version spec if present | ||
| if version_spec.startswith("["): | ||
| bracket_end = version_spec.find("]") | ||
| if bracket_end != -1: | ||
| version_spec = version_spec[bracket_end + 1 :].strip() | ||
|
|
||
| if name in dep_specs: | ||
| (previous_spec, first_group) = dep_specs[name] | ||
| assert previous_spec == version_spec, ( | ||
| f"Version specifier mismatch for {name}: '{dep_specs[name]}'" | ||
| f" in [{first_group}] vs '{version_spec}' in [{group_name}]" | ||
| ) | ||
| else: | ||
| dep_specs[name] = (version_spec, group_name) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.