csu 2.1.0__tar.gz → 2.1.2__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 (105) hide show
  1. {csu-2.1.0 → csu-2.1.2}/.bumpversion.cfg +1 -1
  2. {csu-2.1.0 → csu-2.1.2}/.cookiecutterrc +1 -1
  3. {csu-2.1.0 → csu-2.1.2}/PKG-INFO +3 -3
  4. {csu-2.1.0 → csu-2.1.2}/README.rst +2 -2
  5. {csu-2.1.0 → csu-2.1.2}/pyproject.toml +1 -1
  6. {csu-2.1.0 → csu-2.1.2}/src/csu/__init__.py +1 -1
  7. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/engine.py +5 -3
  8. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/models.py +0 -3
  9. {csu-2.1.0 → csu-2.1.2}/src/csu.egg-info/PKG-INFO +3 -3
  10. {csu-2.1.0 → csu-2.1.2}/.coveragerc +0 -0
  11. {csu-2.1.0 → csu-2.1.2}/.editorconfig +0 -0
  12. {csu-2.1.0 → csu-2.1.2}/.github/workflows/github-actions.yml +0 -0
  13. {csu-2.1.0 → csu-2.1.2}/.pre-commit-config.yaml +0 -0
  14. {csu-2.1.0 → csu-2.1.2}/.taplo.toml +0 -0
  15. {csu-2.1.0 → csu-2.1.2}/AUTHORS.rst +0 -0
  16. {csu-2.1.0 → csu-2.1.2}/CHANGELOG.rst +0 -0
  17. {csu-2.1.0 → csu-2.1.2}/CONTRIBUTING.rst +0 -0
  18. {csu-2.1.0 → csu-2.1.2}/LICENSE +0 -0
  19. {csu-2.1.0 → csu-2.1.2}/MANIFEST.in +0 -0
  20. {csu-2.1.0 → csu-2.1.2}/ci/bootstrap.py +0 -0
  21. {csu-2.1.0 → csu-2.1.2}/ci/requirements.txt +0 -0
  22. {csu-2.1.0 → csu-2.1.2}/ci/templates/.github/workflows/github-actions.yml +0 -0
  23. {csu-2.1.0 → csu-2.1.2}/pytest.ini +0 -0
  24. {csu-2.1.0 → csu-2.1.2}/setup.cfg +0 -0
  25. {csu-2.1.0 → csu-2.1.2}/src/csu/admin.py +0 -0
  26. {csu-2.1.0 → csu-2.1.2}/src/csu/conf.py +0 -0
  27. {csu-2.1.0 → csu-2.1.2}/src/csu/consts.py +0 -0
  28. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/__init__.py +0 -0
  29. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/auth.py +0 -0
  30. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/fields.py +0 -0
  31. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/forms.py +0 -0
  32. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/perms.py +0 -0
  33. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/phonenumber.py +0 -0
  34. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/serializers.py +0 -0
  35. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/test_auth.py +0 -0
  36. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/test_fields.py +0 -0
  37. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/test_forms.py +0 -0
  38. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/test_phonenumber.py +0 -0
  39. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/test_serializers.py +0 -0
  40. {csu-2.1.0 → csu-2.1.2}/src/csu/drf/views.py +0 -0
  41. {csu-2.1.0 → csu-2.1.2}/src/csu/enums.py +0 -0
  42. {csu-2.1.0 → csu-2.1.2}/src/csu/env.py +0 -0
  43. {csu-2.1.0 → csu-2.1.2}/src/csu/exceptions.py +0 -0
  44. {csu-2.1.0 → csu-2.1.2}/src/csu/export.py +0 -0
  45. {csu-2.1.0 → csu-2.1.2}/src/csu/fixups.py +0 -0
  46. {csu-2.1.0 → csu-2.1.2}/src/csu/forms/__init__.py +0 -0
  47. {csu-2.1.0 → csu-2.1.2}/src/csu/forms/crispy.py +0 -0
  48. {csu-2.1.0 → csu-2.1.2}/src/csu/forms/fields.py +0 -0
  49. {csu-2.1.0 → csu-2.1.2}/src/csu/gettext.py +0 -0
  50. {csu-2.1.0 → csu-2.1.2}/src/csu/gettext_lazy.py +0 -0
  51. {csu-2.1.0 → csu-2.1.2}/src/csu/locale/ro/LC_MESSAGES/django.mo +0 -0
  52. {csu-2.1.0 → csu-2.1.2}/src/csu/locale/ro/LC_MESSAGES/django.po +0 -0
  53. {csu-2.1.0 → csu-2.1.2}/src/csu/logging.py +0 -0
  54. {csu-2.1.0 → csu-2.1.2}/src/csu/management.py +0 -0
  55. {csu-2.1.0 → csu-2.1.2}/src/csu/models.py +0 -0
  56. {csu-2.1.0 → csu-2.1.2}/src/csu/query.py +0 -0
  57. {csu-2.1.0 → csu-2.1.2}/src/csu/routers.py +0 -0
  58. {csu-2.1.0 → csu-2.1.2}/src/csu/service.py +0 -0
  59. {csu-2.1.0 → csu-2.1.2}/src/csu/templates/api_exception.html +0 -0
  60. {csu-2.1.0 → csu-2.1.2}/src/csu/templates/forms/widgets/opaquewidget.html +0 -0
  61. {csu-2.1.0 → csu-2.1.2}/src/csu/test_consts.py +0 -0
  62. {csu-2.1.0 → csu-2.1.2}/src/csu/test_env.py +0 -0
  63. {csu-2.1.0 → csu-2.1.2}/src/csu/test_exceptions.py +0 -0
  64. {csu-2.1.0 → csu-2.1.2}/src/csu/test_logging.py +0 -0
  65. {csu-2.1.0 → csu-2.1.2}/src/csu/test_management.py +0 -0
  66. {csu-2.1.0 → csu-2.1.2}/src/csu/test_service.py +0 -0
  67. {csu-2.1.0 → csu-2.1.2}/src/csu/test_timezones.py +0 -0
  68. {csu-2.1.0 → csu-2.1.2}/src/csu/test_utils.py +0 -0
  69. {csu-2.1.0 → csu-2.1.2}/src/csu/test_xml.py +0 -0
  70. {csu-2.1.0 → csu-2.1.2}/src/csu/timezones.py +0 -0
  71. {csu-2.1.0 → csu-2.1.2}/src/csu/utils.py +0 -0
  72. {csu-2.1.0 → csu-2.1.2}/src/csu/views.py +0 -0
  73. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/__init__.py +0 -0
  74. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/admin.py +0 -0
  75. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/asgi.py +0 -0
  76. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/enums.py +0 -0
  77. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/job.py +0 -0
  78. {csu-2.1.0 → csu-2.1.2}/src/csu/worker/registry.py +0 -0
  79. {csu-2.1.0 → csu-2.1.2}/src/csu/wsgi.py +0 -0
  80. {csu-2.1.0 → csu-2.1.2}/src/csu/xml.py +0 -0
  81. {csu-2.1.0 → csu-2.1.2}/src/csu.egg-info/SOURCES.txt +0 -0
  82. {csu-2.1.0 → csu-2.1.2}/src/csu.egg-info/dependency_links.txt +0 -0
  83. {csu-2.1.0 → csu-2.1.2}/src/csu.egg-info/requires.txt +0 -0
  84. {csu-2.1.0 → csu-2.1.2}/src/csu.egg-info/top_level.txt +0 -0
  85. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_custom_context.yaml +0 -0
  86. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_custom_context_0_retries.yaml +0 -0
  87. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_decoding.yaml +0 -0
  88. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_error.yaml +0 -0
  89. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_logging.yaml +0 -0
  90. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service/test_redirects.yaml +0 -0
  91. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service_auth/test_async.yaml +0 -0
  92. {csu-2.1.0 → csu-2.1.2}/tests/cassettes/test_service_auth/test_sync.yaml +0 -0
  93. {csu-2.1.0 → csu-2.1.2}/tests/conftest.py +0 -0
  94. {csu-2.1.0 → csu-2.1.2}/tests/exampleworker.py +0 -0
  95. {csu-2.1.0 → csu-2.1.2}/tests/test_models.py +0 -0
  96. {csu-2.1.0 → csu-2.1.2}/tests/test_service.py +0 -0
  97. {csu-2.1.0 → csu-2.1.2}/tests/test_service_auth.py +0 -0
  98. {csu-2.1.0 → csu-2.1.2}/tests/test_views.py +0 -0
  99. {csu-2.1.0 → csu-2.1.2}/tests/test_worker.py +0 -0
  100. {csu-2.1.0 → csu-2.1.2}/tests/testproject/__init__.py +0 -0
  101. {csu-2.1.0 → csu-2.1.2}/tests/testproject/fixtures/testuser.json +0 -0
  102. {csu-2.1.0 → csu-2.1.2}/tests/testproject/models.py +0 -0
  103. {csu-2.1.0 → csu-2.1.2}/tests/testproject/settings.py +0 -0
  104. {csu-2.1.0 → csu-2.1.2}/tests/testproject/urls.py +0 -0
  105. {csu-2.1.0 → csu-2.1.2}/tox.ini +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 2.1.0
2
+ current_version = 2.1.2
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -40,7 +40,7 @@ default_context:
40
40
  sphinx_theme: furo
41
41
  test_matrix_separate_coverage: 'no'
42
42
  tests_inside_package: 'yes'
43
- version: 2.1.0
43
+ version: 2.1.2
44
44
  version_manager: bump2version
45
45
  website: https://blog.ionelmc.ro
46
46
  year_from: '2024'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csu
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: Clean Slate Utils - bunch of utility code, mostly Django/DRF specific.
5
5
  Author-email: Ionel Cristian Mărieș <contact@ionelmc.ro>
6
6
  License-Expression: BSD-2-Clause
@@ -77,9 +77,9 @@ Overview
77
77
  .. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
78
78
  :alt: Supported implementations
79
79
  :target: https://pypi.org/project/csu
80
- .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.0.svg
80
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.2.svg
81
81
  :alt: Commits since latest release
82
- :target: https://github.com/ionelmc/python-csu/compare/v2.1.0...main
82
+ :target: https://github.com/ionelmc/python-csu/compare/v2.1.2...main
83
83
  .. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
84
84
  :alt: Scrutinizer Status
85
85
  :target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
@@ -34,9 +34,9 @@ Overview
34
34
  .. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
35
35
  :alt: Supported implementations
36
36
  :target: https://pypi.org/project/csu
37
- .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.0.svg
37
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.2.svg
38
38
  :alt: Commits since latest release
39
- :target: https://github.com/ionelmc/python-csu/compare/v2.1.0...main
39
+ :target: https://github.com/ionelmc/python-csu/compare/v2.1.2...main
40
40
  .. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
41
41
  :alt: Scrutinizer Status
42
42
  :target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
@@ -12,7 +12,7 @@ dynamic = [
12
12
  "readme",
13
13
  ]
14
14
  name = "csu"
15
- version = "2.1.0"
15
+ version = "2.1.2"
16
16
  license = "BSD-2-Clause"
17
17
  license-files = ["LICENSE"]
18
18
  description = "Clean Slate Utils - bunch of utility code, mostly Django/DRF specific."
@@ -2,4 +2,4 @@
2
2
  a.k.a Clean Slate Utils
3
3
  """
4
4
 
5
- __version__ = "2.1.0"
5
+ __version__ = "2.1.2"
@@ -44,7 +44,7 @@ class ResultTypeProtocol(Protocol):
44
44
 
45
45
  class AbstractWorker(ABC):
46
46
  state: WorkerState = WorkerState.UNKNOWN
47
- runner: asyncio.Task
47
+ runner: asyncio.Task | None = None
48
48
  shutdown_requested = False
49
49
 
50
50
  def __str__(self):
@@ -308,14 +308,16 @@ class AbstractEngine(ABC):
308
308
  self.queue_awaited.clear()
309
309
 
310
310
  def add_worker(self, worker: AbstractWorker):
311
- if self.queue is not None:
312
- raise RuntimeError(f"Engine {self} is already started!")
311
+ assert self.queue is None, f"{self} is already started"
313
312
  if isinstance(worker, AbstractConsumer):
314
313
  self.queue_maxsize += 1
315
314
  self.workers.append(worker)
316
315
 
317
316
  async def start(self):
318
317
  self.queue = Queue(maxsize=self.queue_maxsize)
318
+ for worker in self.workers:
319
+ assert worker.runner is None, f"{worker=} should not be started"
320
+ worker.start()
319
321
  signal.signal(self.shutdown_signal, self.shutdown_handler)
320
322
 
321
323
  def shutdown_handler(self, sig, frame):
@@ -1,6 +1,5 @@
1
1
  from abc import abstractmethod
2
2
  from asyncio import CancelledError
3
- from dataclasses import dataclass
4
3
  from datetime import timedelta
5
4
  from random import SystemRandom
6
5
 
@@ -147,7 +146,6 @@ class AbstractTask(models.Model):
147
146
  await self.asave(update_fields=["queue_state", "updated_at"])
148
147
 
149
148
 
150
- @dataclass(repr=False)
151
149
  class ModelProducer(AbstractProducer):
152
150
  @property
153
151
  @abstractmethod
@@ -158,7 +156,6 @@ class ModelProducer(AbstractProducer):
158
156
  return await sync_to_async(self.task_model.objects.get_first_and_mark_scheduled, thread_sensitive=False)()
159
157
 
160
158
 
161
- @dataclass(repr=False)
162
159
  class ModelConsumer(AbstractConsumer):
163
160
  @property
164
161
  @abstractmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csu
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: Clean Slate Utils - bunch of utility code, mostly Django/DRF specific.
5
5
  Author-email: Ionel Cristian Mărieș <contact@ionelmc.ro>
6
6
  License-Expression: BSD-2-Clause
@@ -77,9 +77,9 @@ Overview
77
77
  .. |supported-implementations| image:: https://img.shields.io/pypi/implementation/csu.svg
78
78
  :alt: Supported implementations
79
79
  :target: https://pypi.org/project/csu
80
- .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.0.svg
80
+ .. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-csu/v2.1.2.svg
81
81
  :alt: Commits since latest release
82
- :target: https://github.com/ionelmc/python-csu/compare/v2.1.0...main
82
+ :target: https://github.com/ionelmc/python-csu/compare/v2.1.2...main
83
83
  .. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/ionelmc/python-csu/main.svg
84
84
  :alt: Scrutinizer Status
85
85
  :target: https://scrutinizer-ci.com/g/ionelmc/python-csu/
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes