Retain credentials for direct URLs in uv export (#13809)

Reverts unintended breaking change from #13560 

Test case from https://github.com/astral-sh/uv/pull/13808
This commit is contained in:
Zanie Blue 2025-06-03 09:23:07 -05:00 committed by GitHub
parent 63ba5e9f9e
commit a96e766b55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -108,7 +108,14 @@ impl std::fmt::Display for RequirementsTxtExport<'_> {
subdirectory: direct.subdirectory.clone(),
ext: DistExtension::Source(SourceDistExtension::TarGz),
});
write!(f, "{} @ {}", package.id.name, url)?;
write!(
f,
"{} @ {}",
package.id.name,
// TODO(zanieb): We should probably omit passwords here by default, but we
// should change it in a breaking release and allow opt-in to include them.
url.displayable_with_credentials()
)?;
}
Source::Path(path) | Source::Directory(path) => {
if path.is_absolute() {

View file

@ -1174,7 +1174,6 @@ fn requirements_txt_https_git_credentials() -> Result<()> {
Ok(())
}
#[cfg(feature = "git")]
#[test]
fn requirements_txt_https_credentials() -> Result<()> {
let context = TestContext::new("3.12");
@ -1197,7 +1196,7 @@ fn requirements_txt_https_credentials() -> Result<()> {
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv export --cache-dir [CACHE_DIR]
iniconfig @ https://public:****@pypi-proxy.fly.dev/basic-auth/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl \
iniconfig @ https://public:heron@pypi-proxy.fly.dev/basic-auth/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
# via project