Skip to content

[EXPERIMENTAL] Use DynamicQuantities.jl as default units backend#62

Draft
icweaver wants to merge 7 commits intomainfrom
units
Draft

[EXPERIMENTAL] Use DynamicQuantities.jl as default units backend#62
icweaver wants to merge 7 commits intomainfrom
units

Conversation

@icweaver
Copy link
Copy Markdown
Member

@icweaver icweaver commented Nov 29, 2025

Experimenting with how this might look (far future, not committing to anything now)

What's changed

  • Set DQ as default units backend
    • Uses symbolic units by default for convenient unit display.
    • Future: Can switch this to regular units if this becomes a performance bottleneck. Trade-off: prints units in base SI
  • Moved Unitful support to a minimal-maintenance extension
    • Can still be accessed through the usual <cosmology func>(u::UnitLike, args...; kws...) interface
    • Reduces programmatically defined functions to just what is in the public API.

Example usage: https://learn.juliaastro.org/tutorials/cosmo-plots/

Larger plan

To-do

  • Unitful.jl extension
  • tests
  • docs

@cgarling
Copy link
Copy Markdown
Member

Do you like returning basic numbers by default here? My 2 cents is that I would prefer us to pick a default units package (DQ if we decide to switch) and return those quantities by default. We can have a Unitful extension so the function signatures that take types can also take Unitful types, but I don't really like returning basic numbers by default as it forces you to check the docstring to see what the units on the basic numbers are.

@icweaver
Copy link
Copy Markdown
Member Author

icweaver commented Nov 30, 2025

I don't. Agreed. I just did unitless returns for now for the interim to experiment with transitioning to DQ by default long term. Growing pains =]

Edit: Since this is a speculative far future draft PR, I'll go ahead and rip off the band-aid

@icweaver icweaver changed the title [EXPERIMENTAL] Units extensions [EXPERIMENTAL] Use DynamicQuantities.jl as default units backend Nov 30, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f7396bf) to head (8aa02fa).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       JuliaAstro/JuliaAstro.github.io#62   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         2    +1     
  Lines           74        78    +4     
=========================================
+ Hits            74        78    +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants