Add --backend flag to over-ride manual detection of uv#826
Add --backend flag to over-ride manual detection of uv#826nathanjmcdougall merged 69 commits intomainfrom
--backend flag to over-ride manual detection of uv#826Conversation
Fix add_* function when needing to remove Tweak test config
❌ 44 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
CodSpeed Instrumentation Performance ReportMerging #826 will degrade performances by 8.46%Comparing Summary
Benchmarks breakdown
|
|
There are still a couple of major things to do here:
|
--backend flag to over-ride manual detection of uv
|
Another thing to do - we shouldn't create |
|
And yet another thing - make sure all the |
|
Now testing all interfaces which support the Need to consider whether the |
|
Blocked by #663, since we are assuming empty files are valid here: usethis-python/src/usethis/_tool/base.py Lines 417 to 421 in 2982eb3 We should test that empty files are valid for all key-value file managers, probably via a constant that stores all of them (#905) Also, I'd like to break up the complexity here so we don't need to disable the Ruff rule: usethis-python/src/usethis/_tool/base.py Lines 382 to 383 in 2982eb3 |
…ol.apply_rule_config` This is something to watch out for in the future.
|
I think making the CI config backend agnostic is an important next step, but it really belongs in a separate PR. At the moment, the CI completely assumes |
|
#912 should just be resolved here in this branch because I think managed-file creation is a new functionality/default behaviour (should check this). usethis-python/src/usethis/_tool/base.py Lines 430 to 434 in b6c88b6 |
Pass all `test_none_backend` tests
|
I think everything is ready except to make sure all the --how / print_how_to_use messages are respecting the backend choice, and in general checking invocations of |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a --backend flag to override manual detection of UV, representing a major architectural change to support multiple package manager backends. The changes introduce a backend enum system that allows usethis to work with or without UV, providing better flexibility for users who may not have UV installed.
Key changes:
- Introduction of a backend system with
BackendEnum(auto, uv, none) to control package manager behavior - Major reorganization of the codebase structure, moving interface modules and creating backend dispatch logic
- Addition of
--backendflag across all CLI commands to allow manual backend selection
Reviewed Changes
Copilot reviewed 109 out of 121 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/usethis/_types/backend.py |
Defines the new BackendEnum for backend selection |
src/usethis/_integrations/backend/dispatch.py |
Implements backend detection and selection logic |
src/usethis/_ui/options.py |
Adds the backend option for CLI commands |
src/usethis/_config.py |
Updates configuration to include backend settings |
src/usethis/_deps.py |
Refactors dependency management to work with multiple backends |
src/usethis/_init.py |
Creates unified project initialization logic |
| Multiple test files | Updates tests to work with the new backend system |
Comments suppressed due to low confidence (2)
src/usethis/_types/deps.py:14
- The method name
to_requirement_stringis inconsistent with the method callto_requirements_stringused in the old code. This creates an inconsistency that could cause issues.
def to_requirement_string(self) -> str:
tests/usethis/_types/test_deps.py:8
- The test uses
to_requirement_string()which matches the new implementation, but this inconsistency with the oldto_requirements_string()method name should be addressed for consistency.
assert dep.to_requirement_string() == "requests"
This involves some major architectural changes.