-
Notifications
You must be signed in to change notification settings - Fork 29
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
Considering writing a script to add function signatures to a code base. #121
Comments
On second thought, with how normal it is for julia devs to work in the repl, maybe I can skip the CLI and it just becomes a function people can access from within julia? Same functionality, just a different interface. Also saves an unnecessary dependency. |
Yes, just a function-based interface is what would be more useful. (A separate CLI could always be added, but given the precompilation time required in many cases with dev'd packages I doubt many people would use it.) Another approach that may work better than actually editing the source in that way could be an function autodoc(mod::Module)
docs = Docs.meta(mod)
for name in names(mod; all = true)
if isdefined(mod, name)
binding = Docs.Binding(mod, name)
if !haskey(docs, binding)
@eval mod begin
@doc """
*auto-generated docs*
""" $name
end
end
end
end
end
macro autodoc()
:(autodoc(@__MODULE__))
end Has the benefit of not needing the user to run code that changes their source code directly, only an |
Very interesting approach! Impressive. Being new to julia, I skipped the section on macros, so I have no idea how this works. The whole macro thing seemed like way too much magic for me anyway, but maybe after a few months I'll see the light. My main question is if I made a function that edits the source code (which I'm already 90% done with), would it be considered as an addition to this package? I also have a preference for explicit over implicit/magic, in general. |
Feel free to create a PR if you're already that far along implementing and we can weigh up the pros/cons of the approach with something concrete. Requirements for inclusion in the package would be zero-dependencies outside of |
Thank you very much for those guidelines. They really help reduce the fear
factor in submitting a PR because it helps me estimate the chances of
rejection/"why don't you do it this way instead" (which is equally
invalidating). 🙂 Those two are also my goals so we're 100% in alignment.
😁 I'll send a PR when it's done.
…On Tue, Sep 28, 2021, 6:45 PM Michael Hatherly ***@***.***> wrote:
My main question is if I made a function that edits the source code (which
I'm already 90% done with), would it be considered as an addition to this
package? I also have a preference for explicit over implicit/magic, in
general.
Feel free to create a PR if you're already that far along implementing and
we'll can weigh up the pros/cons of the approach with something concrete.
Requirements for inclusion in the package would be zero-dependencies
outside of Base and general enough to handle any valid Julia syntax that
can be documented.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEVLQ5V2QCUAGCMA3HIOVCLUEGMERANCNFSM5E4IHANQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
This is a great extension! :) I've noticed a few open source projects that don't have function signatures in their docstrings, and I think this package could help a lot.
To help make it easier for me to contribute to these projects, I'd like to write a CLI script that will:
If I made such a script, and if it worked well (did the right thing 90% of the time, with the other 10% manually fixable), would it be welcomed to be bundled in with DocStringExtensions for others to use as well?
The text was updated successfully, but these errors were encountered: