[BD-21] Generate feature toggle documentation#24344
Conversation
|
Thanks for the pull request, @regisb! I've created BLENDED-478 to keep track of it in Jira. More details are on the BD-21 project page. When this pull request is ready, tag your edX technical lead. |
|
A preview of the generated docs is available here as a compressed zip file: https://www.dropbox.com/s/qv0rk3aaqps1fbg/featuretoggles-docs.zip?dl=0 |
|
@regisb Thank you for your contribution. Is this ready for our review? |
|
@natabene no, not yet. We are still discussing the approach. |
robrap
left a comment
There was a problem hiding this comment.
Assuming we only plan on having the docs available in readthedocs, and not as RST files available in the repo, I personally think this is fine and don't have a lot to say about introducing the new directive. Seems comprehensible enough.
I think others will make sense for reviewing the sphinx setup, etc. I'm not clear if make docs is what is used to generate everything that is to be deployed together in readthedocs?
There was a problem hiding this comment.
I know it needs more discussion, but why couldn't this stay here and get versioned with the code?
There was a problem hiding this comment.
I get it could. I don't have a very strong opinion on this. Generally speaking, I avoid versioning of automatically-generated assets. If we version this file, then developers will have to remember to update it very often. For instance, it will become outdated as soon as the position of feature toggles in the source code will be modified, as this report includes line numbers. Plus, generating this file requires the installation of code_annotations as well as the feature_toggle_annotations.yaml configuration file from the edx-toggles repo, so I bet developers will frequently forget to update the yaml report.
There was a problem hiding this comment.
I was imagining this being automated so it would be up to date, but that automation clearly doesn't exist yet.
For now, if your code generates and uses this file and it doesn't need to be committed, then feel free to remove it.
c40205e to
5861bd0
Compare
|
FYI: rebasing should resolve Python 3.8 failures. |
5861bd0 to
7d89106
Compare
|
Agreed. I imagined an automated job to keep the yml up to date. |
7d89106 to
d0aeb96
Compare
|
@regisb: You'll need to cherry-pick this commit: edx@a73b923 |
|
To get this PR ready for review, I need one additional decision. Should we version in edx-platform:
My vote goes to option 2: move the By not versioning What do you think @robrap? |
d0aeb96 to
e49f348
Compare
|
@regisb: We are already using
|
Yes you're right @robrap, this is probably the best solution. Especially since edx-toggles has very few base requirements. I would move the Sphinx extension from edx-platform to edx-toggles, and thus most of the changes from this PR there. However, edx-toggles is currently not available from pypi. Is there a process to publish this package there? Should I copy and adapt the .travis.yml file from code-annotations? Or should I simply add the github dependency under the form |
|
@regisb: I'll add a ticket to get edx-toggles into PyPI and hopefully we'll get that done very soon. |
e9b0a3d to
b37c98e
Compare
|
👌
I already wrote the code. Since it will be part of the featuretoggles Sphinx extension, I'll move it to the edx-toggles pull request. This PR is going to have less changes, as the Sphinx extension will be moved to edx-toggles. I am now considering the documentation of edx-platform settings. On this topic, I have two questions @robrap:
|
b37c98e to
d57714e
Compare
|
Thanks @regisb.
Also, do you imagine a Sphinx extension for We may want to make a little headway on this discussion before landing the Sphinx extension PR, and before I work on getting readthedocs updated. |
|
@robrap Currently, the pii annotation configuration file lives in edx-platform: https://github.com/edx/edx-platform/blob/master/.pii_annotations.yml To clarify: I propose that we rename edx-toggles to edx-POUAC where "POUAC" would be chosen wisely. The purpose of this repo would be to provide all Open edX-specific configuration files and tooling (including Sphinx extensions) around code annotations. Thus, we would move the My vote for edx-POUAC goes to "edx-code-annotations". But if renaming the edx-toggles repo to edx-POUAC proved to be too much of a hassle, I would suggest we delay the decision and proceed to moving the configuration files anyway. |
|
It's my own custom string for "foobar" :) (true story: I once pushed in production a change that appended "pouac" to all course names openfun/edx-theme@dafe88c Since then I have a git hook on my laptop to prevent me from accidentally commiting the "pouac" string)
I'm fine with that. In the meantime, I'll add the setting annotation configuration file and Sphinx extension in edx-platform. |
|
@regisb: After discussing with my team, we are going to propose the following decision (which should be capture in an ADR):
We need to discuss this with @bmedx and ensure that his team can get on board with this decision. |
|
It seems very weird to me to have edx-specific configuration in a general purpose tool's repo. Half of the use cases of the tool are similar to edx-lint (enforcing Django code annotations), the other half are similar to edx-developer-docs (generating documentation for code). I'd suggest that either of those might be a better place to store shared configuration. |
|
Thanks for your thoughts @bmedx. I want to clarify that the proposal includes clearly delineating in the repository between the general purpose tool, and the Open edX specific usages and tools. The idea was also floated to have a separate repo like
You gave two other proposals that involve an existing repo:
I'm going to have @nasthagiri weigh-in, so hopefully we can quickly get to a decision and move on. Thanks again. |
|
Thank you for this discussion. It reminds me of the need to prioritize ARCHBOM-1130: OEP on Github repo creation practices, which would include guidelines for the granularity and boundaries of our repositories. Right now, there is a constant overhead cost for each repository that we need to maintain. We currently have multiple tiny repos that are not worthwhile to keep as standalone. So we need to have a strong case for the choices we make on repository boundaries. I agree with the recommendation to keep edX.org specific data and assets separate from the Open edX platform repositories (and would be private repos). In this case, however, the "profiles" in question are not edX.org specific since they can be used by any Open edX instance. My recommendation is to keep a single repository for annotation-related code, but do so with SOLID design patterns so there are clear boundaries within the repository. The requirements files can also be designed to support Interface-Segregation. Regarding Documentation generation from code annotations, I do believe having Documentation reports is valuable and applicable to any code-annotation (including PII annotations). Given that, as @robrap points out, the code annotation profiles in consideration are potentially generally usable by any consumer (including non Open edX consumers). |
|
I must say that I agree with @bmedx on this. The code-annotations repo is currently very generic, and it gives us the opportunity to use it in contexts that are related neither to edX.org or Open edX. After all, documenting large, language-agnostic code bases is a frequent use case. I would love to add more features to this tool and to advocate for its more widespread usage (on my own personal time of course), but it's going to be difficult to do so when it contains Open edX-specific configuration and documentation. Of course, I understand the problems caused by having too many repositories to manage. Could we split the pear in half (as we say in French) by having a single code-annotations repository that would contain two python packages? The Would that be possible? |
|
@regisb: Although it would be possible to split the packages, it was determined that the effort (including maintenance), wasn’t yet warranted. Here is the ADR for using code-annotations for configs and tools: openedx/code-annotations#43 |
d57714e to
bba4076
Compare
|
This should be ready to merge once we merge the corresponding PR in the code-annotations repo, where we moved the feature toggle annotation configuration file: openedx/code-annotations#44 |
|
Cool. I’ll want to test in readthedocs before merging either. I may not get to that until Monday because I’m mostly off until then. |
|
@regisb: Please update the code-annotations reference and squash to your liking. Let me know when both are complete. Thanks. |
We introduce a new documentation target, where we use the featuretoggles Sphinx extension from code-annotations to generate human-readable documentation of feature toggles in edx-platform. The annotation report is generated on-the-fly based on the standard feature toggle configuration file in code-annotations. In addition, we add new doc.in & doc.txt requirement files that will be pip-installed by readthedocs to generate the documentation targets.
bba4076 to
2c8105f
Compare
|
@robrap I rebased my changes on top of master, removed the TODOs (including the reference to code-annotations from pypi), squashed the commits and updated this PR. As far as I am concerned, this is ready to merge. |
|
Your PR has finished running tests. There were no failures. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
We introduce a new documentation target, where we use the feature toggle
annotation report (a yaml file) to generate html documentation. To do
so, we develop a sphinx plugin that introduces a
.. featuretoggles::directive. This directive parses the yml report file and generates
the docs.