File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -539,6 +539,20 @@ impl PyProjectTomlMut {
539539 {
540540 if let Some ( key) = find_source ( name, sources) {
541541 sources. remove ( & key) ;
542+
543+ // Remove the `tool.uv.sources` table if it is empty.
544+ if sources. is_empty ( ) {
545+ self . doc
546+ . entry ( "tool" )
547+ . or_insert ( implicit ( ) )
548+ . as_table_mut ( )
549+ . ok_or ( Error :: MalformedSources ) ?
550+ . entry ( "uv" )
551+ . or_insert ( implicit ( ) )
552+ . as_table_mut ( )
553+ . ok_or ( Error :: MalformedSources ) ?
554+ . remove ( "sources" ) ;
555+ }
542556 }
543557 }
544558
Original file line number Diff line number Diff line change @@ -1688,8 +1688,6 @@ fn add_remove_workspace() -> Result<()> {
16881688 [build-system]
16891689 requires = ["setuptools>=42"]
16901690 build-backend = "setuptools.build_meta"
1691-
1692- [tool.uv.sources]
16931691 "###
16941692 ) ;
16951693 } ) ;
@@ -2881,8 +2879,6 @@ fn remove_non_normalized_source() -> Result<()> {
28812879 [build-system]
28822880 requires = ["setuptools>=42"]
28832881 build-backend = "setuptools.build_meta"
2884-
2885- [tool.uv.sources]
28862882 "###
28872883 ) ;
28882884 } ) ;
@@ -4614,8 +4610,6 @@ fn remove_repeated() -> Result<()> {
46144610
46154611 [tool.uv]
46164612 dev-dependencies = ["anyio"]
4617-
4618- [tool.uv.sources]
46194613 "###
46204614 ) ;
46214615 } ) ;
@@ -4648,8 +4642,6 @@ fn remove_repeated() -> Result<()> {
46484642
46494643 [tool.uv]
46504644 dev-dependencies = ["anyio"]
4651-
4652- [tool.uv.sources]
46534645 "###
46544646 ) ;
46554647 } ) ;
@@ -4685,8 +4677,6 @@ fn remove_repeated() -> Result<()> {
46854677
46864678 [tool.uv]
46874679 dev-dependencies = []
4688-
4689- [tool.uv.sources]
46904680 "###
46914681 ) ;
46924682 } ) ;
You can’t perform that action at this time.
0 commit comments