jararaca 0.3.12a1__py3-none-any.whl → 0.3.12a3__py3-none-any.whl

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.

Potentially problematic release.


This version of jararaca might be problematic. Click here for more details.

@@ -5,7 +5,6 @@ import signal
5
5
  import time
6
6
  from abc import ABC, abstractmethod
7
7
  from datetime import UTC, datetime
8
- from types import FrameType
9
8
  from typing import Any
10
9
  from urllib.parse import parse_qs
11
10
 
@@ -249,13 +248,16 @@ class BeatWorker:
249
248
 
250
249
  def run(self) -> None:
251
250
 
252
- def on_signal_received(signal: int, frame_type: FrameType | None) -> None:
253
- logger.info("Received shutdown signal")
254
- self.shutdown_event.set()
255
-
256
- signal.signal(signal.SIGINT, on_signal_received)
251
+ def on_shutdown(loop: asyncio.AbstractEventLoop) -> None:
252
+ logger.info("Shutting down - signal received")
253
+ # Schedule the shutdown to run in the event loop
254
+ asyncio.create_task(self._graceful_shutdown())
257
255
 
258
256
  with asyncio.Runner(loop_factory=uvloop.new_event_loop) as runner:
257
+ loop = runner.get_loop()
258
+ loop.add_signal_handler(signal.SIGINT, on_shutdown, loop)
259
+ # Add graceful shutdown handler for SIGTERM as well
260
+ loop.add_signal_handler(signal.SIGTERM, on_shutdown, loop)
259
261
  runner.run(self.start_scheduler())
260
262
 
261
263
  async def start_scheduler(self) -> None:
@@ -340,3 +342,9 @@ class BeatWorker:
340
342
 
341
343
  await self.backend.dispose()
342
344
  await self.broker.dispose()
345
+
346
+ async def _graceful_shutdown(self) -> None:
347
+ """Handles graceful shutdown process"""
348
+ logger.info("Initiating graceful shutdown sequence")
349
+ self.shutdown_event.set()
350
+ logger.info("Graceful shutdown completed")
@@ -603,8 +603,19 @@ class HttpParemeterSpec:
603
603
 
604
604
 
605
605
  def parse_path_with_params(path: str, parameters: list[HttpParemeterSpec]) -> str:
606
+ # Use a regular expression to match both simple parameters {param} and
607
+ # parameters with converters {param:converter}
608
+ import re
609
+
610
+ pattern = re.compile(r"{([^:}]+)(?::[^}]*)?}")
611
+
612
+ # For each parameter found in the path, replace it with :param format
606
613
  for parameter in parameters:
607
- path = path.replace(f"{{{parameter.name}}}", f":{parameter.name}")
614
+ path = pattern.sub(
615
+ lambda m: f":{m.group(1)}" if m.group(1) == parameter.name else m.group(0),
616
+ path,
617
+ )
618
+
608
619
  return path
609
620
 
610
621
 
@@ -728,7 +739,9 @@ def extract_parameters(
728
739
  )
729
740
  mapped_types.update(rec_mapped_types)
730
741
  parameters_list.extend(rec_parameters)
731
- elif controller.path.find(f":{parameter_name}") != -1:
742
+ elif (
743
+ re.search(f":{parameter_name}(?:/|$)", controller.path) is not None
744
+ ):
732
745
  mapped_types.add(annotated_type)
733
746
  parameters_list.append(
734
747
  HttpParemeterSpec(
@@ -762,8 +775,9 @@ def extract_parameters(
762
775
  )
763
776
  )
764
777
  elif (
765
- controller.path.find(f"{{{parameter_name}}}") != -1
766
- or mapping.path.find(f"{{{parameter_name}}}") != -1
778
+ # Match both simple parameters {param} and parameters with converters {param:converter}
779
+ re.search(f"{{{parameter_name}(:.*?)?}}", controller.path) is not None
780
+ or re.search(f"{{{parameter_name}(:.*?)?}}", mapping.path) is not None
767
781
  ):
768
782
  mapped_types.add(parameter_type)
769
783
  parameters_list.append(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jararaca
3
- Version: 0.3.12a1
3
+ Version: 0.3.12a3
4
4
  Summary: A simple and fast API framework for Python
5
5
  Home-page: https://github.com/LuscasLeo/jararaca
6
6
  Author: Lucas S
@@ -1,6 +1,6 @@
1
1
  LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
2
2
  README.md,sha256=2qMM__t_MoLKZr4IY9tXjo-Jn6LKjuHMb1qbyXpgL08,3401
3
- pyproject.toml,sha256=pegG6HUFXIUVHdfGGruJu_hqjwWTYYSSsRar1mjbmqw,2040
3
+ pyproject.toml,sha256=Hiy7cJKBQIrdiYnBskiQEYruLl8LsGgsknkKCD2uSp8,2040
4
4
  jararaca/__init__.py,sha256=EdOPigKYraoG7I-Hl9V3XteqrbhdBS3xy1rUakh58lc,17949
5
5
  jararaca/__main__.py,sha256=-O3vsB5lHdqNFjUtoELDF81IYFtR-DSiiFMzRaiSsv4,67
6
6
  jararaca/broker_backend/__init__.py,sha256=GzEIuHR1xzgCJD4FE3harNjoaYzxHMHoEL0_clUaC-k,3528
@@ -60,18 +60,18 @@ jararaca/rpc/http/backends/otel.py,sha256=Uc6CjHSCZ5hvnK1fNFv3ota5xzUFnvIl1JOpG3
60
60
  jararaca/rpc/http/decorators.py,sha256=oUSzgMGI8w6SoKiz3GltDbd3BWAuyY60F23cdRRNeiw,11897
61
61
  jararaca/rpc/http/httpx.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
62
  jararaca/scheduler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
- jararaca/scheduler/beat_worker.py,sha256=JZXjkEMmZkvSwjfqgY4ClJE9Fwi6O-u2G_lHnjptVys,11605
63
+ jararaca/scheduler/beat_worker.py,sha256=i_NyovjFhhLYuUivf2mwpVC27oQ9SGTFOHZ7Ec4jv6I,12076
64
64
  jararaca/scheduler/decorators.py,sha256=iyWFvPLCRh9c0YReQRemI2mLuaUv7r929So-xuKIWUs,4605
65
65
  jararaca/scheduler/types.py,sha256=4HEQOmVIDp-BYLSzqmqSFIio1bd51WFmgFPIzPpVu04,135
66
66
  jararaca/tools/app_config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
67
  jararaca/tools/app_config/decorators.py,sha256=-ckkMZ1dswOmECdo1rFrZ15UAku--txaNXMp8fd1Ndk,941
68
68
  jararaca/tools/app_config/interceptor.py,sha256=HV8h4AxqUc_ACs5do4BSVlyxlRXzx7HqJtoVO9tfRnQ,2611
69
- jararaca/tools/typescript/interface_parser.py,sha256=rM2t_6iAC2u75vBvTmZYy-JS14w36s4PKmaaGZzRYw4,30944
69
+ jararaca/tools/typescript/interface_parser.py,sha256=Bux7DUjEQ8eAry_qZeKCIYz0aPaMO78_5wAPVErXGFo,31482
70
70
  jararaca/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
71
  jararaca/utils/rabbitmq_utils.py,sha256=ytdAFUyv-OBkaVnxezuJaJoLrmN7giZgtKeet_IsMBs,10918
72
72
  jararaca/utils/retry.py,sha256=DzPX_fXUvTqej6BQ8Mt2dvLo9nNlTBm7Kx2pFZ26P2Q,4668
73
- jararaca-0.3.12a1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
74
- jararaca-0.3.12a1.dist-info/METADATA,sha256=vwoe5SBCrXlu3jg5CE_pBXADBbTnKipjeLBAN7S71DI,4995
75
- jararaca-0.3.12a1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
76
- jararaca-0.3.12a1.dist-info/entry_points.txt,sha256=WIh3aIvz8LwUJZIDfs4EeH3VoFyCGEk7cWJurW38q0I,45
77
- jararaca-0.3.12a1.dist-info/RECORD,,
73
+ jararaca-0.3.12a3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
74
+ jararaca-0.3.12a3.dist-info/METADATA,sha256=wspP7q-KGhpcjXzXfRPGdW14rjggwwhzGOFnhmhjgDE,4995
75
+ jararaca-0.3.12a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
76
+ jararaca-0.3.12a3.dist-info/entry_points.txt,sha256=WIh3aIvz8LwUJZIDfs4EeH3VoFyCGEk7cWJurW38q0I,45
77
+ jararaca-0.3.12a3.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "jararaca"
3
- version = "0.3.12a1"
3
+ version = "0.3.12a3"
4
4
  description = "A simple and fast API framework for Python"
5
5
  authors = ["Lucas S <me@luscasleo.dev>"]
6
6
  readme = "README.md"