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

Remove Pkg from dependencies #1896

Closed
wants to merge 1 commit into from
Closed

Conversation

sumiya11
Copy link
Contributor

A PR for #1895.

I don't know if Base.get_pkgversion_from_path covers all the cases that were previously handled.

Copy link

codecov bot commented Oct 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.24%. Comparing base (8fac1af) to head (0a401a3).
Report is 59 commits behind head on master.

Files with missing lines Patch % Lines
src/Nemo.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1896      +/-   ##
==========================================
- Coverage   87.25%   87.24%   -0.01%     
==========================================
  Files          97       97              
  Lines       35655    35653       -2     
==========================================
- Hits        31111    31106       -5     
- Misses       4544     4547       +3     

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

Copy link
Collaborator

@lgoettgens lgoettgens left a comment

Choose a reason for hiding this comment

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

This does not work on julia 1.6 (the compat bound of Nemo)

@sumiya11
Copy link
Contributor Author

sumiya11 commented Oct 13, 2024

Would it be reasonable to do if VERSION < 1.11 then "old version()" else "new version()" end ?

EDIT: ah, no, the old version loads Pkg.

@lgoettgens
Copy link
Collaborator

Base.get_pkgversion_from_path is non-public, so shouldn't be relied on

version() = VersionNumber("$(ver.version)")
end
end
version() = Base.get_pkgversion_from_path(pkgdir)
Copy link
Member

Choose a reason for hiding this comment

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

If this was just about the Package version, we could use the Compat package and then Compat.pkgversion(Nemo).

However this code also tries to determine if one is using a dev version, i.e., whether it is being run from a git clone. Alas the code for doing that is buggy already (it checks whether /dev/ is in the path, which is OK if someone used Pkg.develop but not for people like me who manually git clone repositories).

Interestingly Nemo.versioninfo tries to get a more thorough git status, but it is also broken (at least with Julia 1.10 and 1.11)

julia> Nemo.versioninfo()
Nemo version 0.47.1
Nemo: ERROR: UndefVarError: `LibGit2` not defined in `Base`

Copy link
Member

Choose a reason for hiding this comment

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

In Oscar.jl we instead use this code to determine if it is a dev version (but this is also far from perfect -- and it uses Pkg):

const is_dev = (function()
        deps = Pkg.dependencies()
        if Base.haskey(deps, PROJECT_UUID)
          if deps[PROJECT_UUID].is_tracking_path
            return true
          end
        end
        return occursin("-dev", lowercase(string(VERSION_NUMBER)))
    end)()

@sumiya11
Copy link
Contributor Author

sumiya11 commented Oct 14, 2024

I see, thank you for explanation.

In case deps contains the uuid key, are ver.source and pkgdir the same (pkgdir defined in src/Nemo.jl)? If so, this case could be covered without Pkg, modulo bugs with /dev/.

Otherwise, when deps contains no uuid key, is version() == "building" equivalent to Base.active_project() == pkgdir (up to appending "/Project.toml" to pkgdir) "?

@fingolfin
Copy link
Member

@sumiya11 I have no idea and in any case, none of this is documented AFAIK. I am not concerned with imitating current behavior 1-1. Rather, the general idea, which is to be able to detect reliably which version a user reporting an issue really is using: i.e. either a specific stable release, and which; or some git version (ideally identified by commit). Just like the Julia banner does (perhaps one could look at its current code for inspiration).

@fingolfin
Copy link
Member

To be clear: In general I would be very happy if we could drop the dependency on Pkg, so I approve with the general direction of this PR, but details need to be sorted out. Thank you for raising this issue!

@sumiya11
Copy link
Contributor Author

I am not concerned with imitating current behavior 1-1. Rather, the general idea, which is to be able to detect reliably which version a user reporting an issue really is using: i.e. either a specific stable release, and which; or some git version (ideally identified by commit). Just like the Julia banner does (perhaps one could look at its current code for inspiration).

Thank you for the clarification.

If so, why not ask the user for the output of Pkg.status() instead of relying on the error-prone version ?

@thofma
Copy link
Member

thofma commented Oct 15, 2024

It is mainly for the banner which includes the version number. Maybe they fix the Pkg loading regression in 1.11.1. It is not the only thing that got slower.

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