-
Notifications
You must be signed in to change notification settings - Fork 22
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
Boundary for docs #19
Comments
I really like both ideas. I'd definitely like to see boundary integrating with the wider ecosystem, and enriching the generated docs is a great first step! However I'm not completely sure what is currently possible. Module groups have to be declared in mix.exs, which is evaluated before the code is compiled and boundary data is gathered, so I don't think we can do anything here ATM. However, I'm not super familiar with ins and outs of ex_doc, so maybe I'm missing something. Do you see some way how this could be done today? If not, I guess we should reach out to ex_doc team and discuss possible extensions to ex_doc interface first. Documentation metadata might be doable today, but this requires some experimenting. Essentially, we should be able to change the However, ATM my capacity for working on this is limited, so someone else should do the initial research. This doesn't even need to be done with If you're willing to work on this, feel free to assign yourself to the issue, and let me know if you need any help. Note that I'm currently on vacation, so I can't respond immediately, but I'll try to address any question as soon as I can :-) |
I‘m not sure this is too much a problem. Boundary could generate/update something like a boundary.exs (e.g. as a mix task), which can be evaled by mix.exs on subsequent ˋmix docsˋ calls. |
This is an interesting idea. One drawback is that a user has to remember to manually invoke the boundary task before docs. This might be tackled with aliased task, but I'm not completely sure it would work consistently, because boundary.exs would have to be evaled after the code compilation but before the docs task reads the info. I also wonder how would it work with hex.publish which IIRC implicitly invokes the docs task. To be clear, I'm not against this approach, but someone needs to make a proof of concept to check how is it behaving when we invoke |
Before compile does work without problems to add metadata to the current module doc: https://gist.github.com/LostKobrakai/19c326cf1fec6273ee64152bb640d335 |
In regards to the mix task for module groups: hex does document aliasing as the way to do more than the default |
This looks cool, thanks for trying it out! I think we can go ahead with specifying how it would look like from the user's perspective. Are you willing to do this? It doesn't have to be anything formal, just a brief description in this issue.
The issue I worry about is the following:
My hunch is that in step 3, mix might eagerly load the older version of boundary.exs before the code is recompiled. |
In the docs I'd imagine something like the following: BoundaryThis module is part of the boundary The root module for the boundary is: SomeModuleName | "This module" Exports:
Dependencies: [
Export and Dependency (and maybe current boundary module) listings might be enough when shown on the root module. |
Sorry for the late reply, my vacation got a bit more active :-) I don't think we need to define the exact shape of the documentation upfront. This can be done as we go along, and will probably be tweaked over time. When I said
I was mostly concerned with how the client developers (those using Boundary, such as lib & project authors) will enable this option (or these options). Do they need to configure something in mix.exs? Re module groups, I don't think that my concern stated in this comment is answered. That aside, the documentation meta looks good, but I'm not sure if we should add it by default. What's your opinion on this? |
So the documentation metadata I feel good including by default. Unless it's MB of additional filesize, which e.g. for nerves people can be problematic. In such a case I guess a global config to disable it would be enough to handle that concern. For the module groups boundary would need a mix task to generate the file and people would need to integrate the aliases for
A mix task can ensure compile is triggered, so boundary would always generate a most recent |
The thing I'm worried about here is that it might add an unwanted noise to the docs. If I understand correctly, if we add metadata, they will be always shown in docs generated by ex_doc, right? If that is the case, then I'd definitely like to make it an opt-in, which would probably mean we need a |
I feel the other way round is actually better. Always include the metadata (unless there are valid concerns around filesize) and leave the option of enabling/disabling output to the consumer of the metadata (a.k.a. ex_docs). This allows the metadata not only to be used by |
I'm not worried about the file size but about automatically adding unwanted noise in docs. Suppose I'm writing a lib and I'm using boundary internally. I might not want this meta to be included in the published hex docs.
What other tooling? We're discussing docs here, nothing else. If you want to build other kind of tooling on top of boundary, the library already exposes some functions for retrieving boundary definitions (example), and we can of course expand this as needed. |
I can see your point, but there's not just ex_doc consuming the documentation stored in beam files. Afaik elixir-ls uses data in there, iex's |
Yeah, I consider these tools as different views of the docs. My point remains the same: the fact that I'm using boundary is by default an internal detail until I decide to expose it. I'm definitely open to changing my mind in the future, but I'd prefer to start conservative, rather than unconditionally adding some extra noise to every doc of every client project :-) In other words, I suggest we start with adding an opt-in support for docs enrichment, using something like # mix.exs
def project do
[
boundary: [docs_meta: true],
# ...
]
end Assuming we can agree on this, I think that the work on meta can be started. Regarding module groups, I'm still somewhat uncertain about the issue I mentioned. I'll try to find the time to prove or disprove this issue myself. Assuming that there's no problem, I think we should first define a sketch of the usage proposal (what should the client developer do in mix.exs to make it work). But anyway, I think we can tackle these two things separately, and meta seems like a simpler of the two things, so let's start with that. There's one other thing worth mentioning. Some extensive work has been done for the upcoming version in this branch. IIRC, this work is basically complete and ready to be merged and released, but I need to double check it, b/c I haven't been working on this in the past few months. In any case, we should do the future work on top of that branch, since IIRC there have been some changes in the internals. |
Thanks! My plan is to release next version this weekend, and then I'll take a look at these PRs (I'll try to do that this weekend too). |
The mix task for module groups is now merged. Having additional documentation by |
Since #21 was closed, I assume this isn't implemented? What work would need to be done to support |
I think it's pretty much described in the PR discussion itself (see in particular this comment). Adding metadata to the root module (the one that has This means we need to think about how ex_doc should be changed to support this feature, preferably in a boundary-agnostic way. Then, we should propose the change to the ex_doc team, and, assuming the change is approved, make a PR. Personally, I don't have the capacity for this. |
I'm wondering if boundary could generate ex_doc module groups per boundary and maybe documentation metadata for if a module is exported or not. The latter could be used by ex_doc if available (and commonly used).
The text was updated successfully, but these errors were encountered: