Skip to content

Update docs and add doctests #175

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

abhro
Copy link

@abhro abhro commented Apr 21, 2025

Please see the commmit messages for relevant changes

This comment was marked as outdated.

@icweaver icweaver mentioned this pull request May 13, 2025
2 tasks
Copy link
Contributor

github-actions bot commented Jun 6, 2025

Benchmark Results (Julia v1.10)

Time benchmarks
main f85fd82... main / f85fd82...
Quantity/creation/Quantity(x) 3.41 ± 0.01 ns 2.79 ± 0.009 ns 1.22 ± 0.0053
Quantity/creation/Quantity(x, length=y) 3.11 ± 0.001 ns 3.41 ± 0.01 ns 0.912 ± 0.0027
Quantity/with_numbers/*real 3.1 ± 0.01 ns 3.1 ± 0.01 ns 1 ± 0.0046
Quantity/with_numbers/^int 8.05 ± 2.2 ns 8.37 ± 2.5 ns 0.963 ± 0.38
Quantity/with_numbers/^int * real 8.67 ± 2.5 ns 8.05 ± 2.2 ns 1.08 ± 0.43
Quantity/with_quantity/+y 4.04 ± 0.001 ns 4.04 ± 0.001 ns 1 ± 0.00035
Quantity/with_quantity//y 3.42 ± 0.011 ns 3.11 ± 0.001 ns 1.1 ± 0.0036
Quantity/with_self/dimension 3.1 ± 0.01 ns 2.79 ± 0.001 ns 1.11 ± 0.0036
Quantity/with_self/inv 3.11 ± 0.01 ns 3.11 ± 0.001 ns 1 ± 0.0032
Quantity/with_self/ustrip 2.79 ± 0.01 ns 2.79 ± 0.01 ns 1 ± 0.0051
QuantityArray/broadcasting/multi_array_of_quantities 0.143 ± 0.0035 ms 0.145 ± 0.0031 ms 0.984 ± 0.032
QuantityArray/broadcasting/multi_normal_array 0.056 ± 0.0031 ms 0.0529 ± 0.0029 ms 1.06 ± 0.083
QuantityArray/broadcasting/multi_quantity_array 0.155 ± 0.00092 ms 0.157 ± 0.00092 ms 0.99 ± 0.0083
QuantityArray/broadcasting/x^2_array_of_quantities 0.0446 ± 0.008 ms 0.0451 ± 0.0082 ms 0.989 ± 0.25
QuantityArray/broadcasting/x^2_normal_array 8.07 ± 1.8 μs 7.95 ± 1.5 μs 1.02 ± 0.3
QuantityArray/broadcasting/x^2_quantity_array 8.65 ± 1.1 μs 9.49 ± 1.3 μs 0.911 ± 0.17
QuantityArray/broadcasting/x^4_array_of_quantities 0.0855 ± 0.0041 ms 0.0889 ± 0.0039 ms 0.962 ± 0.063
QuantityArray/broadcasting/x^4_normal_array 0.05 ± 0.00033 ms 0.0472 ± 0.0032 ms 1.06 ± 0.071
QuantityArray/broadcasting/x^4_quantity_array 0.053 ± 0.0031 ms 0.0502 ± 0.00036 ms 1.06 ± 0.062
time_to_load 0.201 ± 0.0052 s 0.204 ± 0.0051 s 0.987 ± 0.036
Memory benchmarks
main f85fd82... main / f85fd82...
Quantity/creation/Quantity(x) 0 allocs: 0 B 0 allocs: 0 B
Quantity/creation/Quantity(x, length=y) 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/*real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int * real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity/+y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity//y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/dimension 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/inv 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/ustrip 0 allocs: 0 B 0 allocs: 0 B
QuantityArray/broadcasting/multi_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/multi_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/multi_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^2_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^2_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^2_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^4_array_of_quantities 2 allocs: 0.382 MB 2 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^4_normal_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
QuantityArray/broadcasting/x^4_quantity_array 2 allocs: 0.0763 MB 2 allocs: 0.0763 MB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

Copy link
Contributor

github-actions bot commented Jun 6, 2025

Benchmark Results (Julia v1)

Time benchmarks
main f85fd82... main / f85fd82...
Quantity/creation/Quantity(x) 3.1 ± 0.01 ns 3.1 ± 0.01 ns 1 ± 0.0046
Quantity/creation/Quantity(x, length=y) 3.73 ± 0.01 ns 3.73 ± 0.01 ns 1 ± 0.0038
Quantity/with_numbers/*real 3.72 ± 0.91 ns 2.79 ± 0.001 ns 1.33 ± 0.33
Quantity/with_numbers/^int 8.67 ± 2.2 ns 8.68 ± 2 ns 0.999 ± 0.34
Quantity/with_numbers/^int * real 9.29 ± 2.2 ns 9.29 ± 2.1 ns 1 ± 0.32
Quantity/with_quantity/+y 4.35 ± 0.01 ns 4.35 ± 0 ns 1 ± 0.0023
Quantity/with_quantity//y 3.42 ± 0.01 ns 3.41 ± 0.01 ns 1 ± 0.0042
Quantity/with_self/dimension 3.11 ± 0.001 ns 4.02 ± 0.01 ns 0.773 ± 0.0019
Quantity/with_self/inv 3.11 ± 0.01 ns 3.11 ± 0.001 ns 1 ± 0.0032
Quantity/with_self/ustrip 3.1 ± 0.01 ns 3.1 ± 0.01 ns 1 ± 0.0046
QuantityArray/broadcasting/multi_array_of_quantities 0.0905 ± 0.0029 ms 0.091 ± 0.0011 ms 0.994 ± 0.034
QuantityArray/broadcasting/multi_normal_array 0.0498 ± 0.00025 ms 0.0499 ± 0.00031 ms 0.999 ± 0.008
QuantityArray/broadcasting/multi_quantity_array 0.0623 ± 0.00029 ms 0.0622 ± 0.0092 ms 1 ± 0.15
QuantityArray/broadcasting/x^2_array_of_quantities 13.6 ± 2.5 μs 18.6 ± 6.4 μs 0.732 ± 0.29
QuantityArray/broadcasting/x^2_normal_array 2.29 ± 2.3 μs 2.54 ± 3.8 μs 0.905 ± 1.6
QuantityArray/broadcasting/x^2_quantity_array 3.49 ± 0.18 μs 3.74 ± 1.6 μs 0.933 ± 0.4
QuantityArray/broadcasting/x^4_array_of_quantities 0.0845 ± 0.00084 ms 0.0847 ± 0.00097 ms 0.998 ± 0.015
QuantityArray/broadcasting/x^4_normal_array 0.0497 ± 0.00018 ms 0.0498 ± 0.00023 ms 0.998 ± 0.0059
QuantityArray/broadcasting/x^4_quantity_array 0.0499 ± 0.00043 ms 0.0468 ± 0.00021 ms 1.06 ± 0.01
time_to_load 0.209 ± 0.0041 s 0.213 ± 0.0056 s 0.983 ± 0.032
Memory benchmarks
main f85fd82... main / f85fd82...
Quantity/creation/Quantity(x) 0 allocs: 0 B 0 allocs: 0 B
Quantity/creation/Quantity(x, length=y) 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/*real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_numbers/^int * real 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity/+y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_quantity//y 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/dimension 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/inv 0 allocs: 0 B 0 allocs: 0 B
Quantity/with_self/ustrip 0 allocs: 0 B 0 allocs: 0 B
QuantityArray/broadcasting/multi_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/multi_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/multi_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^2_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^2_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^2_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^4_array_of_quantities 3 allocs: 0.382 MB 3 allocs: 0.382 MB 1
QuantityArray/broadcasting/x^4_normal_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
QuantityArray/broadcasting/x^4_quantity_array 3 allocs: 0.0764 MB 3 allocs: 0.0764 MB 1
time_to_load 0.159 k allocs: 11.2 kB 0.159 k allocs: 11.2 kB 1

@icweaver
Copy link
Contributor

Hi @abhro, hope you've been well! I love this PR and just wanted to check back in about its current status. I think getting it in would be really helpful for keeping the docs in sync with the QuantityArray PR (#178) I'm working on, especially if we could make the use of @example blocks a bit more ubiquitous here

@abhro
Copy link
Author

abhro commented Jul 11, 2025

Hi! I think I've addressed all the changes, it's most likely just the CI checks now

@icweaver
Copy link
Contributor

Oh, could we also add the generated index.md file to .gitignore? I accidentally uploaded it in another PR, haha. And probably /test/Manifest.toml for completeness too?

@abhro
Copy link
Author

abhro commented Jul 28, 2025

Done!

@icweaver
Copy link
Contributor

icweaver commented Jul 28, 2025

Sweet, thanks!

Have you been able to generate docs with the Mirror to DAMTP bit btw? I've been finding that since it it relies on an ENV in CI, it fails when I try to build locally, so I've just been commenting it our for now. I'm wondering if it would make sense to hide that bit behind a conditional flag that's called during CI?

@abhro
Copy link
Author

abhro commented Jul 28, 2025

Have you been able to generate docs with the Mirror to DAMTP bit btw? I've been finding that since it it relies on an ENV in CI, it fails when I try to build locally, so I've just been commenting it our for now. I'm wondering if it would make sense to hide that bit behind a conditional flag that's called during CI?

I'm guessing this part is meant for @MilesCranmer? I'm not sure I can offer much help on the deployment side of things

@icweaver
Copy link
Contributor

Sorry, I should have said "because of the Mirror to DAMTP bit" instead of "with the Mirror to DAMTP bit". In other words, this seems like an issue for anyone trying to build the docs locally, so I just wanted to see if we could smooth that process out a bit for folks.

Similarly, I was wondering if it might also be good to add a tip about using LiveServer.jl with something like:

servedocs(; include_dirs=["src/"], skip_files=["docs/src/index.md"])

so things work well from the jump. Anyway, just wanted to get your perspective to get an idea of if something like this would be helpful or not, haha

@abhro
Copy link
Author

abhro commented Jul 29, 2025

Sorry, I should have said "because of the Mirror to DAMTP bit" instead of "with the Mirror to DAMTP bit". In other words, this seems like an issue for anyone trying to build the docs locally, so I just wanted to see if we could smooth that process out a bit for folks.

Mmm, yes, that's probably a good idea to add a guard to check if the build is happening in CI or not.

@icweaver
Copy link
Contributor

icweaver commented Aug 2, 2025

Cool how about just wrapping the deploydocs bit in something like this?

in_CI_env = get(ENV, "CI", nothing) == "true"

if in_CI_env
    deploydocs(;
        repo="github.com/SymbolicML/DynamicQuantities.jl",
        devbranch="main"
    )

    # Mirror to DAMTP:
    ENV["DOCUMENTER_KEY"] = ENV["DOCUMENTER_KEY_CAM"]
    ENV["GITHUB_REPOSITORY"] = "ai-damtp-cam-ac-uk/dynamicquantities.git"
    deploydocs(;
        repo="github.com/ai-damtp-cam-ac-uk/dynamicquantities.git",
        devbranch="main"
    )
end

@MilesCranmer
Copy link
Member

That looks ok but the environment variable should be more specific. Like “DEPLOY_DOCUMENTER” or something. And just have the default be “false” rather than nothing

Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.21%. Comparing base (3e4e19d) to head (f85fd82).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #175   +/-   ##
=======================================
  Coverage   99.21%   99.21%           
=======================================
  Files          21       21           
  Lines        1273     1273           
=======================================
  Hits         1263     1263           
  Misses         10       10           

☔ 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.

@icweaver
Copy link
Contributor

icweaver commented Aug 6, 2025

Sweet, thx! Could you also add that CI guard Miles mentioned?

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