Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEWS.md confuses automated tooling #3918

Closed
ericphanson opened this issue Jan 18, 2025 · 2 comments
Closed

NEWS.md confuses automated tooling #3918

ericphanson opened this issue Jan 18, 2025 · 2 comments

Comments

@ericphanson
Copy link
Contributor

I've been working on changelog parsing in https://github.com/JuliaDocs/Changelog.jl, in order to make changelogs more accessible to Julia users and tooling, e.g. perhaps a pkg repl mode for pkg> changelog JuMP, or for RegistryCI to be able to read changelogs so that for breaking releases it can fulfill the release notes check by checking a changelog if present.

However, having a toplevel NEWS.md that is essentially a manual redirect makes it hard to automatically find the changelog automatically. In JuliaDocs/Changelog.jl#13 I check a bunch of top-level filenames in the package, and I could also search docs/src to find docs/src/changelog.md, but to figure out which one to prefer would need some heuristics - naively, I would check top-level first, then if I don't find anything, check docs/src, but that would give the wrong answer here. I could do a more sophisticated check by finding which file is longer or which has more parsable versions or something, but it seems a little complicated (albeit doable). I think that is an option but it might be simpler if JuMP's NEWS.md simply symlinked to docs/src/changelog.md or something like that?

@ericphanson
Copy link
Contributor Author

eh, I think actually parsing all the potential changelogs and using some basic rules to choose the best one is a more robust way to go in general. I tweaked my find_changelog function and this now works:

using PackageAnalyzer: find_package, obtain_code
using Changelog # branch: eph/find_changelog
using Changelog: find_changelog, tryparsefile, find_version


function changelog(pkg, version=nothing)
    code_dir = obtain_code(find_package(pkg))[1]
    nt = find_changelog(code_dir)
    nt === nothing && error("Could not find changelog for $pkg in $code_dir")
    (; path, changelog) = nt
    if version !== nothing
        v = find_version(changelog, version)
        v === nothing && return error("Could not find version $version in changelog at $path")
        return v
    end
    return changelog
end

changelog("JuMP", v"1")

yielding

julia> changelog("JuMP", v"1")
Changelog.VersionInfo with
- version: 1.0.0
- date: 2022-03-24
- changes
  - Read more about this release, along with an acknowledgement of all the contributors in our  JuMP 1.0.0 is released blog post.
  - Breaking
    - The previously deprecated functions (v0.23.0, v0.23.1) have been removed.Deprecation was to improve consistency of function names:`num_nl_constraints` (see `num_nonlinear_constraints`)`all_nl_constraints` (see `all_nonlinear_constraints`)`add_NL_expression` (see `add_nonlinear_expression`)`set_NL_objective`  (see `set_nonlinear_objective`)`add_NL_constraint` (see `add_nonlinear_constraint`)`nl_expr_string` (see `nonlinear_expr_string`)`nl_constraint_string` (see `nonlinear_constraint_string`)`SymMatrixSpace` (see `SymmetricMatrixSpace`)
    - The unintentionally exported variable `JuMP.op_hint` has been renamed to theunexported `JuMP._OP_HINT`
  - Fixed
    - Fixed a bug writing .nl files
    - Fixed a bug broadcasting `SparseAxisArray`s

@odow
Copy link
Member

odow commented Jan 18, 2025

I'm open to just removing our NEWS.md. It was kept with the redirect just for backwards compatibility of anyone looking there when we changed to the proper docs.

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

No branches or pull requests

2 participants