Skip to content

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

Draft
icweaver wants to merge 10 commits into
mainfrom
units
Draft

[EXPERIMENTAL] Use DynamicQuantities.jl as default units backend#62
icweaver wants to merge 10 commits into
mainfrom
units

Conversation

@icweaver

@icweaver icweaver commented Nov 29, 2025

Copy link
Copy Markdown
Member

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

icweaver commented Nov 30, 2025

Copy link
Copy Markdown
Member Author

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

codecov Bot commented Dec 1, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5f0d99c) to head (49ce9c5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #62   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         2    +1     
  Lines           58        62    +4     
=========================================
+ Hits            58        62    +4     

☔ View full report in Codecov by Harness.
📢 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