Unitful.jl icon indicating copy to clipboard operation
Unitful.jl copied to clipboard

Improve docs for extending Unitful

Open briochemc opened this issue 5 years ago • 2 comments

I'd wanted to extend Unitful with a couple of units in a package of mine but I realized I did not understand most of the discussion about it in the documentation here.

Then I thought I'd just copy the UnitfulUS.jl example but it seems that it is not passing CI, which deterred me back here to suggest to either

  1. improve Unitful's documentation here, or
  2. update UnitfulUS.jl so that it passes CI, or
  3. register a dedicated package, e.g., UnitfulExtensionExample.jl, with some conversion testing, that would contain something like:
module UnitfulExtensionExample

mandatory code # Don' touch this part
mandatory code # Don' touch this part
mandatory code # Don' touch this part

# my new units 
# (I just copy-pasted the first 5 units 
# from UnitfulUS.jl for the sake of this example.)
@unit sinch_us    "inˢ"       USSurveyInch      (100//3937)*Unitful.m   false
@unit sft_us      "ftˢ"       USSurveyFoot      12sinch_us              false
@unit sli_us      "liˢ"       USSurveyLink      (33//50)sft_us          false
@unit syd_us      "ydˢ"       USSurveyYard      3sft_us                 false
@unit srd_us      "rdˢ"       USSurveyRod       25sli_us                false

mandatory code # Don' touch this part
mandatory code # Don' touch this part
mandatory code # Don' touch this part

end

briochemc avatar Dec 19 '19 07:12 briochemc

UnitfulUS.jl actually passes CI, the badge in the README just points to the CI for the old repository (UnitfulUS was transferred from ajkeller34 to PainterQubits a while ago).

sostock avatar Dec 21 '19 17:12 sostock

Oh OK I see. I just submitted a PR to change that (for the badges to point to PainterQubits).

briochemc avatar Dec 22 '19 23:12 briochemc