Skip to content

Enable package extension for Statistics #277

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

Merged
merged 8 commits into from
Apr 13, 2024

Conversation

hyrodium
Copy link
Contributor

This PR reverts #255.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.05%. Comparing base (cf4b0c3) to head (cc5d38b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #277   +/-   ##
=======================================
  Coverage   97.05%   97.05%           
=======================================
  Files           6        7    +1     
  Lines         782      782           
=======================================
  Hits          759      759           
  Misses         23       23           

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

@kimikage
Copy link
Collaborator

kimikage commented Apr 5, 2024

This seems more elegant than the use of Requires.jl with respect to Stdlib.

On the other hand, in the first place, this workaround uses a non-public function Statistics._mean_promote.
Until now, this has been acceptable because the version of Statistics.jl was synchronized with Julia's version upgrades.

Seems to me we need to revisit the workaround itself.
Of course, that should be separate from this PR.

@kimikage kimikage requested a review from johnnychen94 April 5, 2024 04:41
@kimikage
Copy link
Collaborator

kimikage commented Apr 6, 2024

This change is not so complicated, and the intent is clear.
If we decide to merge this PR, however, making the simple revert commit into master might make the tracking easier.
This is just a little reminder for the hygiene of commit-graph, because PR #278 also makes changes to Project.toml.

@kimikage kimikage mentioned this pull request Apr 6, 2024
@johnnychen94
Copy link
Collaborator

johnnychen94 commented Apr 6, 2024

Sorry, I missed this PR.

Adding extension support is a good change, but it requires Julia 1.9 to work.

For the very fundamental packages such as FixedPointNumbers, keeping a broad range of compatibility support is necessary. It's necessary to keep it compatible with the current LTS version, i.e., Julia 1.6. The current FixedPointNumbers is still compatible with Julia 1.0, which is more than great.

Thus, we still need to preserve the old codes, still need to install Requires (but conditionally loading it depending on the actual Julia versions).

Ref: https://pkgdocs.julialang.org/v1/creating-packages/#Backwards-compatibility

@kimikage
Copy link
Collaborator

kimikage commented Apr 6, 2024

@johnnychen94 You are absolutely right.
We might need Requires.jl (perhaps for CheckedArithmetic?).

But for the case of Statistics, it has been a stdlib and should work as before. (Conversely, the "new” Statistics.jl will basically not be introduced into the old julia.)

@johnnychen94
Copy link
Collaborator

johnnychen94 commented Apr 6, 2024

Adding extension support is a good change, but it requires Julia 1.9 to work.

Sorry, I misunderstood the code. The current version is compatible with old Julia versions by falling back to a direct include rather than the lazy @require.

My two cents is to still use the lazy @require because it's what we expected in #255. (never mind, I just realized that #255 is a patch for Julia 1.9, for which version extension is supported...)

Comment on lines 627 to 628
if !isdefined(Base, :get_extension)
include("../ext/FixedPointNumbersStatisticsExt.jl")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although this is in keeping with PR #255 manner, I would prefer that the precompile be at the end of the module (except for the __init__()).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c4eee40.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'm not familiar with _precompile_() function. Perhaps the current code should be replaced with PrecompileTools.jl.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, it is from the SnoopCompile.jl days.
I think replacing before releasing the new version is a good idea.

@kimikage
Copy link
Collaborator

kimikage commented Apr 6, 2024

@hyrodium Could you rebase (and tweak) this?

Copy link
Collaborator

@kimikage kimikage left a comment

Choose a reason for hiding this comment

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

It is hard to determine where in the trade-off we should compromise.

Project.toml Outdated
Comment on lines 15 to 16
[compat]
Requires = "1"
julia = "1"
Copy link
Collaborator

@kimikage kimikage Apr 6, 2024

Choose a reason for hiding this comment

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

If we follow the principle, Statistics should be in [compat].
This is especially the case where even patch versions need to be included (e.g. Statistics = "1 - 1.11.1").

cf. #277 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6c2a68c.

Copy link
Collaborator

@kimikage kimikage Apr 13, 2024

Choose a reason for hiding this comment

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

To my surprise, it seems that the hyphen notation is not supported for julia v1.0.
Sorry for misleading you.
Or "< 1.11.2"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, < 1.11.2 could be a solution (cf. Pkg.jl v1.0 documentation). However, "1 - 1.11.1" looks better to me because it has a lower bound. Is there any chance to drop support for Julia 1.0?

Copy link
Collaborator

@kimikage kimikage Apr 13, 2024

Choose a reason for hiding this comment

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

Since Statistics.jl is stdlib, the lower bound is practically meaningless.
I don't intend to continue actively supporting julia v1.0, but I don't think it has caused any critical problems yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, this is very trivial, the uppercase "S" of Statistics precedes the lowercase "j" of julia.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments! I have updated the compat bound for Statistics.jl

@kimikage
Copy link
Collaborator

kimikage commented Apr 7, 2024

cf. JuliaStats/Statistics.jl#165

@kimikage kimikage changed the title Enable package extension and remove Requres.jl Enable package extension for Statistics Apr 7, 2024
@hyrodium hyrodium force-pushed the feature/package_extension branch from 407e84f to 8528da3 Compare April 8, 2024 15:10
@kimikage
Copy link
Collaborator

kimikage commented Apr 9, 2024

@hyrodium Thank you for rebasing.
Is this ready to merge? Or do you plan to revise it (regarding my comments)?
I will merge this PR once I get the go-ahead.

@kimikage kimikage merged commit ca600b0 into JuliaMath:master Apr 13, 2024
@kimikage
Copy link
Collaborator

@hyrodium Thank you for addressing this issue!

@kimikage kimikage mentioned this pull request Apr 30, 2024
38 tasks
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request Apr 30, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request Apr 30, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
kimikage pushed a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
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.

3 participants