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

Add pkgversion(m::Module) to get the version of the package that loaded a given module #45607

Merged
merged 5 commits into from
Jun 9, 2022

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Jun 7, 2022

Similar to pkgdir(m::Module) this returns the version of the package that loaded the given module or submodule.
(building on #44318)

(@v1.9) pkg> st
Status `~/.julia/environments/v1.9/Project.toml`
  [c46f51b8] ProfileView v1.5.1
  [295af30f] Revise v3.3.3

julia> using ProfileView, Revise

julia> pkgversion(ProfileView)
v"1.5.1"

julia> pkgversion(Revise)
v"3.3.3"
julia> module Foo end
Main.Foo

julia> pkgversion(Foo)

julia>
(@v1.9) pkg> st -m OrderedCollections
Status `~/.julia/environments/v1.9/Manifest.toml`
  [bac558e1] OrderedCollections v1.4.1

julia> pkgversion(Revise.OrderedCollections)
v"1.4.1"

@quinnj
Copy link
Member

quinnj commented Jun 7, 2022

Oh man, I've really wanted this! Thanks @IanButterworth!

@KristofferC
Copy link
Member

KristofferC commented Jun 8, 2022

With #44318 we store the version when the package is loaded. So why does this PR parse the project file (again)?

@IanButterworth
Copy link
Member Author

Great question. I'll fix that.

base/loading.jl Outdated Show resolved Hide resolved
@fingolfin
Copy link
Member

fingolfin commented Jun 9, 2022

vtjnash added a commit that referenced this pull request Jun 29, 2022
vtjnash added a commit that referenced this pull request Jun 30, 2022
KristofferC pushed a commit that referenced this pull request Jul 4, 2022
Regressions introduced by #45607

(cherry picked from commit 239a1f2)
KristofferC pushed a commit that referenced this pull request Jul 4, 2022
Regressions introduced by #45607

(cherry picked from commit 239a1f2)
pcjentsch pushed a commit to pcjentsch/julia that referenced this pull request Aug 18, 2022
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.

4 participants