uv_configuration/sources.rs
1#[derive(
2 Debug, Default, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize,
3)]
4#[serde(rename_all = "kebab-case", deny_unknown_fields)]
5pub enum SourceStrategy {
6 /// Use `tool.uv.sources` when resolving dependencies.
7 #[default]
8 Enabled,
9 /// Ignore `tool.uv.sources` when resolving dependencies.
10 Disabled,
11}
12
13impl SourceStrategy {
14 /// Return the [`SourceStrategy`] from the command-line arguments, if any.
15 pub fn from_args(no_sources: bool) -> Self {
16 if no_sources {
17 Self::Disabled
18 } else {
19 Self::Enabled
20 }
21 }
22}