Skip to content

Write Project.toml with the same section sorting as Pkg#74

Open
nickrobinson251 wants to merge 3 commits intoJuliaPackaging:masterfrom
nickrobinson251:npr-write-project-toml-like-pkg
Open

Write Project.toml with the same section sorting as Pkg#74
nickrobinson251 wants to merge 3 commits intoJuliaPackaging:masterfrom
nickrobinson251:npr-write-project-toml-like-pkg

Conversation

@nickrobinson251
Copy link

@nickrobinson251 nickrobinson251 commented Apr 4, 2025

close #52

Let me know:

  • where exactly we want to put preferences section... up near the top made sense to me... could also be at the bottom ofc, someone just got to pick
  • i presume we don't want a dep on Pkg.jl, hence the copy-pasta, otherwise this can just use Pkg code.
  • could add a test for pre v1.11 too if you think it's worth it

@nickrobinson251 nickrobinson251 marked this pull request as ready for review April 4, 2025 21:07
@oxinabox
Copy link

oxinabox commented Nov 3, 2025

this would be nice to have.
Since you openned the issue @KristofferC maybe you can review?

@fingolfin fingolfin closed this Dec 15, 2025
@fingolfin fingolfin reopened this Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@eadfbfd). Learn more about missing BASE report.
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/Preferences.jl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master      #74   +/-   ##
=========================================
  Coverage          ?   93.10%           
=========================================
  Files             ?        2           
  Lines             ?      174           
  Branches          ?        0           
=========================================
  Hits              ?      162           
  Misses            ?       12           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but would indeed be great if @KristofferC could comment

# Taken from Pkg.jl v1.11.4 (but we don't want to depend on Pkg.jl directly just for this)
# https://github.com/JuliaLang/Pkg.jl/blob/v1.11.4/src/project.jl#L235
# with `preferences` added before `deps`
const _project_key_order = ["name", "uuid", "keywords", "license", "desc", "preferences", "deps", "weakdeps", "sources", "extensions", "compat"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we insert preferences here, should a similar patch be made to Pkg.jl so that it also sorts preferences to the same position?

if VERSION > v"1.11.0-"
@testset "Project.toml writing" begin
Pkg.activate("PkgV_1_11_plus") do
@eval using PkgV_1_11_plus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code suffers from world age issues, hence the tests are failing with Julia >= 1.12

See also my PR #88 which might give a suggestion how to fix this (but perhaps a better solution is possible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preferences should store the resulting Project.toml with the same section sorting as Pkg

4 participants