Skip to content

Conversation

@AlexWaygood
Copy link
Member

The heavy use of cd in this workflow makes it kinda hard to figure out which directory you're in at any one time. This PR tries to reduce the number of places we switch the working directory; to me it makes the workflow easier to reason about and understand

@AlexWaygood AlexWaygood marked this pull request as ready for review August 1, 2025 12:29
Comment on lines -342 to +365
- name: Run litestar tests
run: uv run --with=../typing-extensions-latest -- python -m pytest tests/unit/test_typing.py tests/unit/test_dto
- name: Run litestar tests with typing_extensions main branch
working-directory: litestar
run: |
# litestar's python-requires means uv won't let us add typing-extensions-latest
# as a requirement unless we do this
sed -i 's/^requires-python = ">=3.8/requires-python = ">=3.9/' pyproject.toml
uv add --editable ../typing-extensions-latest
uv sync
printf "\n\nINSTALLED DEPENDENCIES ARE:\n\n"
uv pip list
printf "\n\n"
uv run python -m pytest tests/unit/test_typing.py tests/unit/test_dto
Copy link
Member Author

@AlexWaygood AlexWaygood Aug 1, 2025

Choose a reason for hiding this comment

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

I think the old invocation here meant that the typing_extensions main branch would be installed into the ephemeral environment created by uv run --with, but the project environment (which the ephemeral environment would delegate to) would have a typing_extensions installation from PyPI installed into it.

Everything was probably working okay here? But it seems fragile, and it's hard to verify that we were actually using the main branch of typing_extensions during the pytest run. The new setup is more complicated, obviously, but it's much easier to verify that we are actually using the main branch of typing_extensions during the pytest run

uv pip list
printf "\n\n"
uv run pytest tests
Copy link
Member

Choose a reason for hiding this comment

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

How do we know uv run won't install a different version of typing-extensions?

Copy link
Member Author

@AlexWaygood AlexWaygood Aug 1, 2025

Choose a reason for hiding this comment

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

The uv add command a few lines above modifies the pyproject.toml file to specify that the project depends on an editable install of our checkout of the typing_extensions main branch. So if uv did an implicit sync as part of the uv run command (which you're right, it often does), all it would do as part of that sync is check that the editable install of typing_extensions in the virtual environment points to the directory specified in the pyproject.toml file

@AlexWaygood AlexWaygood merged commit b98762c into main Aug 1, 2025
74 checks passed
@AlexWaygood AlexWaygood deleted the less-cd branch August 1, 2025 15:35
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