mirror of
				https://github.com/astral-sh/uv.git
				synced 2025-10-31 20:09:09 +00:00 
			
		
		
		
	Update validation for enviroments and required-environments in uv.toml (#14905)
				
					
				
			See https://github.com/astral-sh/uv/pull/14322/files#r2231891679 Closes https://github.com/astral-sh/uv/issues/14904
This commit is contained in:
		
							parent
							
								
									a701d3c447
								
							
						
					
					
						commit
						c489fcb633
					
				
					 2 changed files with 17 additions and 12 deletions
				
			
		|  | @ -211,8 +211,8 @@ fn validate_uv_toml(path: &Path, options: &Options) -> Result<(), Error> { | ||||||
|         override_dependencies: _, |         override_dependencies: _, | ||||||
|         constraint_dependencies: _, |         constraint_dependencies: _, | ||||||
|         build_constraint_dependencies: _, |         build_constraint_dependencies: _, | ||||||
|         environments: _, |         environments, | ||||||
|         required_environments: _, |         required_environments, | ||||||
|         conflicts, |         conflicts, | ||||||
|         workspace, |         workspace, | ||||||
|         sources, |         sources, | ||||||
|  | @ -265,6 +265,19 @@ fn validate_uv_toml(path: &Path, options: &Options) -> Result<(), Error> { | ||||||
|             "build-backend", |             "build-backend", | ||||||
|         )); |         )); | ||||||
|     } |     } | ||||||
|  |     if environments.is_some() { | ||||||
|  |         return Err(Error::PyprojectOnlyField( | ||||||
|  |             path.to_path_buf(), | ||||||
|  |             "environments", | ||||||
|  |         )); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if required_environments.is_some() { | ||||||
|  |         return Err(Error::PyprojectOnlyField( | ||||||
|  |             path.to_path_buf(), | ||||||
|  |             "required-environments", | ||||||
|  |         )); | ||||||
|  |     } | ||||||
|     Ok(()) |     Ok(()) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -336,8 +349,8 @@ fn warn_uv_toml_masked_fields(options: &Options) { | ||||||
|         override_dependencies, |         override_dependencies, | ||||||
|         constraint_dependencies, |         constraint_dependencies, | ||||||
|         build_constraint_dependencies, |         build_constraint_dependencies, | ||||||
|         environments, |         environments: _, | ||||||
|         required_environments, |         required_environments: _, | ||||||
|         conflicts: _, |         conflicts: _, | ||||||
|         workspace: _, |         workspace: _, | ||||||
|         sources: _, |         sources: _, | ||||||
|  | @ -504,12 +517,6 @@ fn warn_uv_toml_masked_fields(options: &Options) { | ||||||
|     if build_constraint_dependencies.is_some() { |     if build_constraint_dependencies.is_some() { | ||||||
|         masked_fields.push("build-constraint-dependencies"); |         masked_fields.push("build-constraint-dependencies"); | ||||||
|     } |     } | ||||||
|     if environments.is_some() { |  | ||||||
|         masked_fields.push("environments"); |  | ||||||
|     } |  | ||||||
|     if required_environments.is_some() { |  | ||||||
|         masked_fields.push("required-environments"); |  | ||||||
|     } |  | ||||||
|     if !masked_fields.is_empty() { |     if !masked_fields.is_empty() { | ||||||
|         let field_listing = masked_fields.join("\n- "); |         let field_listing = masked_fields.join("\n- "); | ||||||
|         warn_user!( |         warn_user!( | ||||||
|  |  | ||||||
|  | @ -14266,8 +14266,6 @@ matplotlib | ||||||
| fn importlib_metadata_not_repeated() -> Result<()> { | fn importlib_metadata_not_repeated() -> Result<()> { | ||||||
|     let context = TestContext::new("3.12"); |     let context = TestContext::new("3.12"); | ||||||
| 
 | 
 | ||||||
|     let uv_toml = context.temp_dir.child("uv.toml"); |  | ||||||
|     uv_toml.write_str(r#"environments = ["python_version >= '3.10'", "python_version >= '3.8' and python_version < '3.10'", "python_version < '3.8'"]"#)?; |  | ||||||
|     let requirements_in = context.temp_dir.child("requirements.in"); |     let requirements_in = context.temp_dir.child("requirements.in"); | ||||||
|     requirements_in.write_str("build")?; |     requirements_in.write_str("build")?; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Zanie Blue
						Zanie Blue