Skip to content

Conversation

DilumAluthge
Copy link
Member

@DilumAluthge DilumAluthge commented Jul 2, 2025

Co-authored-by: Miles Cranmer

Replacement for #3847 (closes #3847).

This is an alternative for #3847. AFAICT, it satisfies the use case of #3847, and has the advantages of not exposing internal types, and not renaming any internal functions.

I'm not at all married to the name satisfies_compat - I'm happy to change it.

@DilumAluthge
Copy link
Member Author

cc: @MilesCranmer

@DilumAluthge DilumAluthge force-pushed the dpa/satisfies_compat branch from d16545e to 01c9f51 Compare July 2, 2025 18:46
@DilumAluthge DilumAluthge changed the title Add new public function satisfies_compat::VersionNumber, ::String), and add (to docs) some examples of checking [compat] entries Add new public function Pkg.satisfies_compat::VersionNumber, ::String), and add (to docs) some examples of checking [compat] entries Jul 2, 2025
@DilumAluthge DilumAluthge force-pushed the dpa/satisfies_compat branch from 01c9f51 to cd1735c Compare July 2, 2025 18:49
…g)`, and add (to docs) some examples of checking `[compat]` entries

Co-authored-by: Miles Cranmer <[email protected]>
@IanButterworth
Copy link
Member

IanButterworth commented Jul 2, 2025

SGTM +1

@DilumAluthge
Copy link
Member Author

CHANGELOG entry added.

@DilumAluthge
Copy link
Member Author

I've added a few tests.

We also have a few doctests in the docstring.

@DilumAluthge DilumAluthge moved this from In progress to In review in Pkg.jl Jul 2, 2025
@DilumAluthge DilumAluthge requested review from IanButterworth and KristofferC and removed request for IanButterworth and KristofferC July 2, 2025 20:01
@IanButterworth IanButterworth moved this from In review to In progress in Pkg.jl Jul 2, 2025
@IanButterworth IanButterworth moved this from In progress to In review in Pkg.jl Jul 2, 2025
@IanButterworth IanButterworth changed the title Add new public function Pkg.satisfies_compat::VersionNumber, ::String), and add (to docs) some examples of checking [compat] entries Add new public function Pkg.satisfies_compat(::VersionNumber, ::String), and add (to docs) some examples of checking [compat] entries Jul 2, 2025
IanButterworth
IanButterworth previously approved these changes Jul 2, 2025
Copy link
Member

@IanButterworth IanButterworth left a comment

Choose a reason for hiding this comment

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

SGTM but worth getting @KristofferC review too

Co-authored-by: Ian Butterworth <[email protected]>
julia> Pkg.satisfies_compat(v"0.1.0", "=0.1")
true

julia> Pkg.satisfies_compat(v"0.1.0", "=0.1.1")
Copy link
Member

Choose a reason for hiding this comment

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

I think we can reduce the number of examples a bit, I think people will understand how to use it after one or two examples.

Copy link
Member

@KristofferC KristofferC left a comment

Choose a reason for hiding this comment

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

LGTM, with the note that I think we can reduce the number of examples given a bit.

KristofferC

This comment was marked as duplicate.

KristofferC

This comment was marked as duplicate.

@KristofferC
Copy link
Member

KristofferC commented Jul 7, 2025

#1263 wants to get the range returned. Perhaps we can also do that (but only document that you can call in on that range). Then you would also get the pretty printing.

@IanButterworth
Copy link
Member

Could that be a follow-on? I can tidy up the examples to get this merged if so.

@KristofferC
Copy link
Member

But if we go with that there is no need for the satisfies_compat method at all?

@IanButterworth
Copy link
Member

Can all semver specs be represented by a single range object?

julia> Pkg.Types.semver_spec("1, 2, =3.0, 3.2")
VersionSpec("[1 - 2, 3.0.0, 3.2.0 - 3]")

@KristofferC
Copy link
Member

A VersionSpec can contain a collection of ranges.

@IanButterworth
Copy link
Member

So how does the user test inclusion of a version in that collection of ranges?

You're proposing returning a range not a VersionSpec?

@KristofferC
Copy link
Member

A VersionSpec is a single object (that can internally have many ranges in it) , that you can test in with a VersionNumber with.

@IanButterworth
Copy link
Member

Ok, I was understanding that you wanted to return a single range, not the VersionSpec (which would need to become public, as discussed in #3847 (comment) which lead to this alternative PR)

#1263 wants to get the range returned. Perhaps we can also do that (but only document that you can call in on that range).

@IanButterworth
Copy link
Member

Making VersionSpec public seems fine to me.

@KristofferC
Copy link
Member

Ah sorry, I should have been more accurate and said VersionSpec.

@IanButterworth IanButterworth moved this from In review to In progress in Pkg.jl Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants