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

Clean up exports #2474

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Clean up exports #2474

wants to merge 12 commits into from

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Jan 21, 2025

As mentioned in #2468, I don't think we need to export so many things. I've done a bunch of cuts here, with the intention that if we don't feel comfortable cutting something, we can easily revert specific commits. In my opinion, though, even though it looks like many sweeping changes, I don't think any of these are hugely controversial on their own.

Concretely, this PR does the following:

  1. Stops re-exporting the DynamicPPL module.

  2. Stops re-exporting @logprob_str and @prob_str, which were deprecated several months ago (we've killed off deprecated stuff in far shorter timespans)

  3. Stops re-exporting DynamicPPL.LogDensityFunction, this is an implementation detail that users probably don't need to construct themselves.

  4. Bumps the Distributions.jl compat bound (from 0.23 to 0.25.77) and removes code that was required to support old versions of Distributions. Note that DynamicPPL already requires Distributions 0.25.

  5. Removes the blanket re-export of Bijectors and Libtask, as well as the export of Bijectors.ordered. ordered is used in the Gaussian mixture model tutorial, but even there it's imported directly from Bijectors, and I don't think it's unfair to expect users to manually import Bijectors if they want to use this function.

  6. Removes the blanket re-export of AbstractMCMC, replacing it with an explicit export list of sample, MCMCThreads, MCMCDistributed, and MCMCSerial. Note that these are the only four identifiers which AbstractMCMC itself exports (https://github.com/TuringLang/AbstractMCMC.jl/blob/master/src/AbstractMCMC.jl) so the only change is that the module name itself (AbstractMCMC) is no longer accessible as Turing.AbstractMCMC.

  7. For convenience, re-exports LinearAlgebra.I.

  8. Exports DynamicPPL.returned (apparently we never bothered to export it when deprecating generated_quantities, oops haha).

Will let CI run before requesting a review.

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 56.43%. Comparing base (24d5556) to head (2409aa1).

Files with missing lines Patch % Lines
src/stdlib/distributions.jl 0.00% 4 Missing ⚠️
src/mcmc/Inference.jl 0.00% 1 Missing ⚠️
src/optimisation/Optimisation.jl 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (24d5556) and HEAD (2409aa1). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (24d5556) HEAD (2409aa1)
54 39
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2474       +/-   ##
===========================================
- Coverage   85.01%   56.43%   -28.59%     
===========================================
  Files          21       21               
  Lines        1582     1561       -21     
===========================================
- Hits         1345      881      -464     
- Misses        237      680      +443     

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

@coveralls
Copy link

coveralls commented Jan 21, 2025

Pull Request Test Coverage Report for Build 12885951319

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 3 files are covered.
  • 430 unchanged lines in 11 files lost coverage.
  • Overall coverage decreased (-27.7%) to 48.809%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/mcmc/Inference.jl 0 1 0.0%
src/optimisation/Optimisation.jl 0 1 0.0%
src/stdlib/distributions.jl 0 4 0.0%
Files with Coverage Reduction New Missed Lines %
src/mcmc/emcee.jl 2 88.46%
src/variational/VariationalInference.jl 4 0.0%
src/mcmc/particle_mcmc.jl 10 80.13%
src/mcmc/Inference.jl 20 75.15%
ext/TuringDynamicHMCExt.jl 29 0.0%
src/mcmc/mh.jl 34 58.96%
src/stdlib/distributions.jl 47 0.0%
ext/TuringOptimExt.jl 50 0.0%
src/mcmc/sghmc.jl 50 20.29%
src/variational/advi.jl 56 0.0%
Totals Coverage Status
Change from base Build 12786420948: -27.7%
Covered Lines: 758
Relevant Lines: 1553

💛 - Coveralls

@penelopeysm penelopeysm force-pushed the py/imports branch 6 times, most recently from abc1f9b to d4c3547 Compare January 21, 2025 02:39
@mhauru
Copy link
Member

mhauru commented Jan 21, 2025

I think I agree with all the changes listed in OP, although LogDensityFunction makes me pause and wonder how people might be using it. I don't think I should be the main reviewer here, the more senior members of the team understand user needs better.

Rather than merging straight to master, should we bundle this with #2458 to form a new breaking release to go out when we feel like is the right moment?

@penelopeysm
Copy link
Member Author

Happy to release both PRs together!

I can't say I feel particularly bad about LogDensityFunction tbh, it's still accessible via DynamicPPL with the same functionality, so we're really just asking people to import it from where it should be imported.

@penelopeysm
Copy link
Member Author

There's still the wholesale export of MCMCChains which I don't dare to touch. MCMCChains exports a lot of stuff. https://github.com/TuringLang/MCMCChains.jl/blob/master/src/MCMCChains.jl

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