Skip to content

Add global state to raise an error when attempting to subprocess uv #763

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
merged 2 commits into from
Jun 18, 2025

Conversation

nathanjmcdougall
Copy link
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Jun 18, 2025 that may be closed by this pull request
@nathanjmcdougall nathanjmcdougall requested a review from Copilot June 18, 2025 09:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new disable_uv_subprocess flag to the global configuration to prevent uv subprocess calls, updates the subprocess helper to respect this flag and error early, and adds tests for both enabled and disabled behaviors.

  • Introduce disable_uv_subprocess in UsethisConfig and its default.
  • Guard call_uv_subprocess to raise UVSubprocessFailedError when the flag is set.
  • Add tests verifying that subprocess calls are blocked or allowed based on the flag.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/usethis/test_config.py Added TestDisableUVSubprocess tests for the new disable_uv_subprocess flag
src/usethis/_integrations/uv/call.py Early exit in call_uv_subprocess when disable_uv_subprocess is true
src/usethis/_config.py Added disable_uv_subprocess attribute and set up in the config setter
Comments suppressed due to low confidence (2)

src/usethis/_config.py:31

  • The new disable_uv_subprocess attribute is not described in the class docstring. Please update the top-level docstring of UsethisConfig to explain what this flag controls.
    disable_uv_subprocess: bool = False

tests/usethis/test_config.py:54

  • Consider mocking or monkeypatching the underlying call_subprocess function here so that the test doesn't invoke a real external command and can assert on the expected invocation.
                output = call_uv_subprocess(["python", "list"], change_toml=False)

Copy link

codspeed-hq bot commented Jun 18, 2025

CodSpeed Walltime Performance Report

Merging #763 will not alter performance

Comparing 761-global-state-to-avoid-subprocessing-uv (0cc113f) with main (ebdff2b)

Summary

✅ 1 untouched benchmarks

Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@nathanjmcdougall nathanjmcdougall merged commit c63a203 into main Jun 18, 2025
17 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 761-global-state-to-avoid-subprocessing-uv branch June 18, 2025 10:02
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.

Global state to avoid subprocessing uv
1 participant