Avoid enforcing non-conflicts in uv export (#9751)

## Summary

These are already enforced a level above.
This commit is contained in:
Charlie Marsh 2024-12-09 16:56:16 -05:00 committed by GitHub
parent 13c4003252
commit 3992295e9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 98 additions and 9 deletions

View file

@ -4143,11 +4143,6 @@ enum LockErrorKind {
#[source]
err: DependencyGroupError,
},
/// An error that occurs when trying to export a `uv.lock` with
/// conflicting extras/groups specified to `requirements.txt`.
/// (Because `requirements.txt` cannot encode them.)
#[error("Cannot represent `uv.lock` with conflicting extras or groups as `requirements.txt`")]
ConflictsNotAllowedInRequirementsTxt,
}
/// An error that occurs when a source string could not be parsed.

View file

@ -19,7 +19,7 @@ use uv_pep508::MarkerTree;
use uv_pypi_types::{ParsedArchiveUrl, ParsedGitUrl};
use crate::graph_ops::marker_reachability;
use crate::lock::{LockErrorKind, Package, PackageId, Source};
use crate::lock::{Package, PackageId, Source};
use crate::universal_marker::UniversalMarker;
use crate::{InstallTarget, LockError};
@ -41,9 +41,6 @@ impl<'lock> RequirementsTxtExport<'lock> {
hashes: bool,
install_options: &'lock InstallOptions,
) -> Result<Self, LockError> {
if !target.lock().conflicts().is_empty() {
return Err(LockErrorKind::ConflictsNotAllowedInRequirementsTxt.into());
}
let size_guess = target.lock().packages.len();
let mut petgraph = Graph::with_capacity(size_guess, size_guess);
let mut inverse = FxHashMap::with_capacity_and_hasher(size_guess, FxBuildHasher);