Skip to content

Migrate from hatch to uv for developing/contributing #77

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

brianloyal
Copy link

Description

Replaced hatch/hatchling with uv/uv_build. Completed with the help of Amazon Q Developer CLI!

Related Issues

#58

Documentation PR

Type of Change

  • New feature

[Choose one of the above types of changes]

Testing

Ran all linting and Bedrock testing commands successfully, except those that involve 3P APIs

  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all
  • Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

Checklist

  • [x ] I have read the CONTRIBUTING document
  • [x ] I have added tests that prove my fix is effective or my feature works
  • [x ] I have updated the documentation accordingly
  • [x ] I have added an appropriate example to the documentation to outline the feature
  • [x ] My changes generate no new warnings
  • [x ] Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

CONTEXT.md Outdated
Copy link
Member

Choose a reason for hiding this comment

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

This file should be removed

Copy link
Author

Choose a reason for hiding this comment

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

My bad - thought i had removed that

- name: Install dependencies
run: |
pip install --no-cache-dir hatch
uv venv
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a direct port of the prior commands, but it seems like uv should be performing commands in the context of the venv automatically.

Specifically in the docs, they mention using the uv commands directly, like sync: https://docs.astral.sh/uv/guides/integration/github/#syncing-and-running - we shouldn't need to create or activate the virtual environment directly.

Similarly to run python, we should be using uv run

Copy link
Author

Choose a reason for hiding this comment

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

I love just using uv run for everything, but was a little concerned about completely moving off of the old venv pattern. However, probably not as big a deal for development workflows. I'll update.

Copy link
Member

Choose a reason for hiding this comment

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

I'm concerned that we're not leveraging uv well; there should be some mechanism to avoid needing to have dedicated files for each command that we want to run for formatting/linting etc.

Looking at the docs they have examples of using tools but because these tools are already installed to the project, I would guess that we could again use uv run for them similar to what we had before

Copy link
Author

Choose a reason for hiding this comment

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

Thought there might be some value in backwards compatibility, but I agree it's cleaner to run the tools directly. If you're cool with it, I'll just add them to the .toml file and remove the scripts/

@@ -3,7 +3,6 @@
from unittest.mock import MagicMock, call, patch

import pytest

Copy link
Member

Choose a reason for hiding this comment

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

Do we know why so many files were reformatted as part of this? If the dependencies were the same I would expect no formatting changes

README.md Outdated

We welcome contributions! See our [Contributing Guide](https://github.com/strands-agents/sdk-python/blob/main/CONTRIBUTING.md) for details on:
Copy link
Member

Choose a reason for hiding this comment

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

Did we intentionally remove this section about contributing?

pyproject.toml Outdated

[[tool.mypy.overrides]]
module = "litellm"
ignore_missing_imports = true

[[tool.mypy.overrides]]
Copy link
Member

Choose a reason for hiding this comment

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

Why were these needed compared to before?

CONTRIBUTING.md Outdated

## Development Environment

This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as the build backend and [hatch](https://hatch.pypa.io/latest/) for development workflow management.
This project uses [uv_build](https://github.com/astral-sh/uv/blob/main/crates/uv-build/README.md) as the build backend and [uv](https://github.com/astral-sh/uv) for development workflow management.
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a docs site to point to instead of a readme?

MIGRATION.md Outdated
@@ -0,0 +1,137 @@
# Migration from Hatch to UV
Copy link
Member

Choose a reason for hiding this comment

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

This file should also be removed

Copy link
Author

Choose a reason for hiding this comment

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

Fair. I'll add it to the PR comments instead

@brianloyal brianloyal marked this pull request as draft May 22, 2025 17:28
@Unshure Unshure assigned Unshure and zastrowm and unassigned Unshure May 29, 2025
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.

3 participants