django-resonant-settings 0.30__tar.gz → 0.33.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/PKG-INFO +3 -1
  2. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/pyproject.toml +29 -3
  3. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/createsuperuser.py +3 -3
  4. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/receiver.py +3 -2
  5. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/utils.py +3 -1
  6. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/celery.py +7 -0
  7. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/development/celery.py +5 -0
  8. {django_resonant_settings-0.30/resonant_settings/testing → django_resonant_settings-0.33.0/resonant_settings/development}/minio_storage.py +3 -1
  9. django_resonant_settings-0.30/resonant_settings/testing/__init__.py +0 -0
  10. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/.gitignore +0 -0
  11. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/LICENSE +0 -0
  12. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/README.md +0 -0
  13. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/__init__.py +0 -0
  14. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/_env.py +0 -0
  15. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth.py +0 -0
  16. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/__init__.py +0 -0
  17. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/adapter.py +0 -0
  18. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/apps.py +0 -0
  19. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/allauth_support/management/commands/createsuperuser.py +0 -0
  20. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/development/__init__.py +0 -0
  21. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/development/debug_toolbar.py +0 -0
  22. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/django.py +0 -0
  23. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/django_extensions.py +0 -0
  24. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/logging.py +0 -0
  25. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/oauth_toolkit.py +0 -0
  26. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/production/__init__.py +0 -0
  27. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/production/email.py +0 -0
  28. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/production/https.py +0 -0
  29. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/production/s3_storage.py +0 -0
  30. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/py.typed +0 -0
  31. {django_resonant_settings-0.30 → django_resonant_settings-0.33.0}/resonant_settings/rest_framework.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-resonant-settings
3
- Version: 0.30
3
+ Version: 0.33.0
4
4
  Summary: Shared Django settings for Resonant applications.
5
5
  Project-URL: Repository, https://github.com/kitware-resonant/cookiecutter-resonant
6
6
  Project-URL: Bug Reports, https://github.com/kitware-resonant/cookiecutter-resonant/issues
@@ -26,6 +26,8 @@ Requires-Python: >=3.10
26
26
  Requires-Dist: django-environ
27
27
  Provides-Extra: allauth
28
28
  Requires-Dist: django-allauth; extra == 'allauth'
29
+ Provides-Extra: celery
30
+ Requires-Dist: celery; extra == 'celery'
29
31
  Description-Content-Type: text/markdown
30
32
 
31
33
  # django-resonant-settings
@@ -37,14 +37,40 @@ dependencies = [
37
37
  ]
38
38
  dynamic = ["version"]
39
39
 
40
+ [project.urls]
41
+ Repository = "https://github.com/kitware-resonant/cookiecutter-resonant"
42
+ "Bug Reports" = "https://github.com/kitware-resonant/cookiecutter-resonant/issues"
43
+
40
44
  [project.optional-dependencies]
41
45
  allauth = [
42
46
  "django-allauth",
43
47
  ]
48
+ celery = [
49
+ "celery",
50
+ ]
44
51
 
45
- [project.urls]
46
- Repository = "https://github.com/kitware-resonant/cookiecutter-resonant"
47
- "Bug Reports" = "https://github.com/kitware-resonant/cookiecutter-resonant/issues"
52
+ [dependency-groups]
53
+ dev = [
54
+ "tox",
55
+ "tox-uv",
56
+ ]
57
+ lint = [
58
+ "flake8",
59
+ "flake8-black",
60
+ "flake8-bugbear",
61
+ "flake8-docstrings",
62
+ "flake8-isort",
63
+ "pep8-naming",
64
+ ]
65
+ format = [
66
+ "black",
67
+ "isort",
68
+ ]
69
+ type = [
70
+ "mypy",
71
+ "celery-types",
72
+ "django-stubs[compatible-mypy]",
73
+ ]
48
74
 
49
75
  [tool.hatch.build]
50
76
  packages = [
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import ClassVar
3
+ from typing import Any, ClassVar
4
4
 
5
5
  from django.contrib.auth.management.commands import createsuperuser
6
6
  from django.contrib.auth.models import User, UserManager
@@ -9,7 +9,7 @@ from resonant_settings.allauth_support.utils import temporarily_change_attribute
9
9
 
10
10
 
11
11
  class Command(createsuperuser.Command):
12
- def __init__(self, *args, **kwargs):
12
+ def __init__(self, *args: Any, **kwargs: Any):
13
13
  super().__init__(*args, **kwargs)
14
14
  self.UserModel = EmailAsUsernameProxyUser
15
15
  self.username_field = self.UserModel._meta.get_field(self.UserModel.USERNAME_FIELD)
@@ -37,7 +37,7 @@ class EmailAsUsernameProxyUserManager(UserManager):
37
37
  username: str | None = None,
38
38
  email: str | None = None,
39
39
  password: str | None = None,
40
- **extra_fields,
40
+ **extra_fields: Any,
41
41
  ) -> EmailAsUsernameProxyUser:
42
42
  # Practically, email will always be provided
43
43
  assert email
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from typing import Any
2
3
 
3
4
  from allauth.account.models import EmailAddress
4
5
  from django.contrib.auth.models import AbstractUser
@@ -10,8 +11,8 @@ def verify_email_address_on_user_post_save(
10
11
  sender: type[AbstractUser],
11
12
  instance: AbstractUser,
12
13
  created: bool,
13
- **kwargs,
14
- ):
14
+ **kwargs: Any,
15
+ ) -> None:
15
16
  """Automatically verify email addresses of newly created superusers."""
16
17
  # These should always be true, but it's a final sanity check
17
18
  if created and instance.is_superuser:
@@ -1,9 +1,11 @@
1
+ from collections.abc import Generator
1
2
  from contextlib import contextmanager
3
+ from typing import Any
2
4
 
3
5
 
4
6
  # From https://stackoverflow.com/a/38532086
5
7
  @contextmanager
6
- def temporarily_change_attributes(something, **kwargs):
8
+ def temporarily_change_attributes(something: object, **kwargs: Any) -> Generator[None]:
7
9
  previous_values = {k: getattr(something, k) for k in kwargs}
8
10
  for k, v in kwargs.items():
9
11
  setattr(something, k, v)
@@ -7,6 +7,8 @@ Configure Celery with the following features:
7
7
  This requires the `celery` package to be installed.
8
8
  """
9
9
 
10
+ import celery.app.trace # type: ignore[import-not-found]
11
+
10
12
  from resonant_settings._env import env
11
13
 
12
14
  # Assume AMQP.
@@ -62,3 +64,8 @@ CELERY_WORKER_PREFETCH_MULTIPLIER = 1
62
64
  # Accept the default of the number of CPU cores.
63
65
  # Workers running memory-intensive tasks may need to decrease this.
64
66
  CELERY_WORKER_CONCURRENCY: int | None = None
67
+
68
+ # Make the task received log message include the task's arguments.
69
+ celery.app.trace.LOG_RECEIVED = """\
70
+ Task %(name)s[%(id)s] received: (%(args)s, %(kwargs)s)\
71
+ """
@@ -1,7 +1,12 @@
1
+ from resonant_settings._env import env
2
+
1
3
  # Acknowledge early in development, which will help prevent failing or
2
4
  # long-running tasks from being started automatically every time the worker
3
5
  # process restarts; this more aggressively flushes the task queue.
4
6
  CELERY_TASK_ACKS_LATE = False
5
7
 
8
+ CELERY_TASK_ALWAYS_EAGER: bool = env.bool("DJANGO_CELERY_TASK_ALWAYS_EAGER", default=False)
9
+ CELERY_TASK_EAGER_PROPAGATES = CELERY_TASK_ALWAYS_EAGER
10
+
6
11
  # In development, run without concurrency.
7
12
  CELERY_WORKER_CONCURRENCY: int | None = 1
@@ -22,5 +22,7 @@ MINIO_STORAGE_MEDIA_BUCKET_NAME = minio_url.path.lstrip("/")
22
22
  MINIO_STORAGE_MEDIA_URL: str | None = env.str("DJANGO_MINIO_STORAGE_MEDIA_URL", default=None)
23
23
 
24
24
  MINIO_STORAGE_AUTO_CREATE_MEDIA_BUCKET = True
25
- MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY = "READ_WRITE"
25
+ # Make the bucket private to the public
26
+ MINIO_STORAGE_AUTO_CREATE_MEDIA_POLICY = "NONE"
27
+ # Issue signed URLs to provide any read access
26
28
  MINIO_STORAGE_MEDIA_USE_PRESIGNED = True