Skip to content
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-zaak/open-zaak#1649] Command to document envvars #22

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented May 14, 2024

Closes open-zaak/open-zaak#1649 partly

TODO:

  • add tests
  • add separate flag to mark as required vs required in docker?
  • move intro text to library, only override in Objects?

@stevenbal stevenbal marked this pull request as draft May 14, 2024 13:00
@stevenbal stevenbal force-pushed the feature/autodoc branch 2 times, most recently from b5a713c to 57f12cf Compare May 14, 2024 15:22
@stevenbal stevenbal force-pushed the feature/autodoc branch 2 times, most recently from f2bff21 to cef41ca Compare June 7, 2024 13:02
@stevenbal stevenbal changed the base branch from feature/django-settings to main June 7, 2024 13:02
@stevenbal stevenbal force-pushed the feature/autodoc branch 2 times, most recently from 8710224 to 01a6fac Compare June 7, 2024 14:31
@stevenbal
Copy link
Contributor Author

@annashamray let me know if this approach is something that you think is worthwhile, I think it could save us a lot of hassle when it comes to documenting envvars (especially those that are used by every project). Here is an example of what it looks like after running the command: https://github.com/maykinmedia/objecttypes-api/blob/66a942d613776cb1766d3da025ce5e321103cf40/docs/env_config.rst

@annashamray
Copy link
Contributor

I quite like it! It also forces you to write what the env variable actually does, which is a good thing for me.
Do you think that generating docks for djang-setup-configuration would be redundant in this case?

@stevenbal
Copy link
Contributor Author

stevenbal commented Jun 10, 2024

Do you think that generating docks for djang-setup-configuration would be redundant in this case?

I'm not sure, since there already were docs for those I excluded them, also because they maybe require a bit more explanation to describe the ConfigurationSteps as a whole. Also the generated docs for setup-configuration relies on reusing the model field help_texts, so I think that's still good to have

@stevenbal stevenbal force-pushed the feature/autodoc branch 2 times, most recently from 1826777 to c8277c0 Compare July 22, 2024 14:57
@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.35%. Comparing base (d9a4a86) to head (ac6e174).
Report is 22 commits behind head on main.

Files Patch % Lines
open_api_framework/conf/utils.py 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   76.00%   82.35%   +6.35%     
==========================================
  Files           4        4              
  Lines          50       68      +18     
==========================================
+ Hits           38       56      +18     
  Misses         12       12              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stevenbal stevenbal force-pushed the feature/autodoc branch 6 times, most recently from a306feb to 791e9de Compare July 23, 2024 11:05
@stevenbal stevenbal changed the title 🚧 Initial changes for documenting envvars ✨ [open-zaak/open-zaak#1649] Command to document envvars Jul 23, 2024
@stevenbal stevenbal force-pushed the feature/autodoc branch 3 times, most recently from 8082666 to 7202c38 Compare July 23, 2024 12:36
@stevenbal stevenbal marked this pull request as ready for review July 23, 2024 12:38
@stevenbal
Copy link
Contributor Author

@annashamray this PR is now ready for review :)

Copy link
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

It would be nice to have tests for the command (and perhaps config util but it's optional)
testapp/settings.py seems like a perfect place to add a couple of settings with env vars

`decouple.config` is overridden to accept help text and several other attributes, as well as to add the loaded environment variables to a registry. This registry is used by the `generate_envvar_docs` management command to generate RST style documentation based on a template. This removes the need for duplication for these envvar docs in all the components that use open-api-framework
Copy link
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stevenbal stevenbal merged commit 9194e18 into main Aug 15, 2024
9 checks passed
@stevenbal stevenbal deleted the feature/autodoc branch August 22, 2024 14:39
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.

Automatically generate documentation from environment variables
3 participants