django-wiki / django-nyt

Notification system for Django with batteries included: Email digests, user settings, JSON API
Apache License 2.0
144 stars 47 forks source link

Refactor settings pattern #127

Closed benjaoming closed 10 months ago

benjaoming commented 10 months ago

This PR implements a new settings pattern that's friendly to tests using Django's override_settings decorator. It's also friendly to our documentation, such that we can simply render the docstrings of django_nyt.settings.defaults in order to have a nice Configuration section in our documentation.

The reST needed to include the final documentation for the app settings:


.. automodule:: django_nyt.conf
   :noindex:

   .. autoclass:: AppSettings()
      :members:

Documentation page BEFORE:

image

Documentation page AFTER:

image

codecov[bot] commented 10 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ae58eb8) 74.30% compared to head (bcf1e7a) 74.90%.

Files Patch % Lines
django_nyt/consumers.py 0.00% 1 Missing :warning:
django_nyt/subscribers.py 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #127 +/- ## ========================================== + Coverage 74.30% 74.90% +0.60% ========================================== Files 23 23 Lines 541 554 +13 ========================================== + Hits 402 415 +13 Misses 139 139 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

benjaoming commented 10 months ago

I'm gonna merge this now, not as in "this is perfect", but as in "this is the end of Chapter 1", but look forward to a sequel! The plot is unknown, but I have a good feeling we'll see some action with Django AppConfig.

Blog post: https://overtag.dk/v2/blog/a-settings-pattern-for-reusable-django-apps/

Edit: The other reason is that incidentally this PR also fixes the Read the Docs deployment that had started using the "default" Sphinx theme :scream: