haraka 0.2.45__py3-none-any.whl → 0.2.47__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.
haraka/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """cookiecutter post-generation helper package."""
2
2
  from haraka.post_gen.runner import main
3
3
  from haraka.post_gen.config import PostGenConfig
4
- __all__ = ["main", "PostGenConfig"]
4
+ from haraka.startup import PyFast
5
+ __all__ = ["main", "PostGenConfig", "PyFast"]
haraka/post_gen/runner.py CHANGED
@@ -68,7 +68,7 @@ def main(cfg: PostGenConfig) -> None:
68
68
  divider("🎉 Project generation complete 🎉")
69
69
  logger.debug("Project generation completed")
70
70
 
71
- if cfg.variant == "go-grpc-protoc":
71
+ if cfg.variant == "GoUltraFast":
72
72
  logger.debug(f"Detected variant: {cfg.variant}, beginning Go-specific steps")
73
73
  go_emoji_logo = [emoji["go"]]
74
74
  go_performance_mode = [
@@ -7,7 +7,7 @@ variant, as defined by a YAML manifest in `haraka/manifests/<variant>.yml`.
7
7
 
8
8
  Manifest format (git-wildmatch globs):
9
9
 
10
- variant: python-fastapi
10
+ variant: PyFast
11
11
  keep:
12
12
  - src/app/**
13
13
  - tests/**
@@ -52,7 +52,7 @@ class ResourcePurger:
52
52
  Parameters
53
53
  ----------
54
54
  variant
55
- Variant key, e.g. ``python-fastapi`` or ``go-grpc-protoc``.
55
+ Variant key, e.g. ``PyFast`` or ``GoUltraFast``.
56
56
  project_dir
57
57
  Root of the freshly generated Cookiecutter project.
58
58
  """
@@ -0,0 +1,47 @@
1
+ from fastapi import FastAPI
2
+ import socket
3
+ from haraka.utils import Logger
4
+
5
+ class PyFast:
6
+ """
7
+ A helper class to handle initialization and shutdown messaging for a FastAPI application.
8
+ """
9
+ def __init__(self, variant: str = "PyFast"):
10
+ """
11
+ Initializes the PyFast instance with a logger.
12
+
13
+ Args:
14
+ variant (str): A string identifier for the application. Default is 'PyFast'.
15
+ """
16
+ self.variant = variant
17
+ self.logger = Logger(self.variant).start_logger()
18
+
19
+ def init(self, settings, app: FastAPI):
20
+ """
21
+ Initializes the application and logs Swagger UI availability.
22
+
23
+ Args:
24
+ settings: A settings object containing application configuration (e.g., port).
25
+ app (FastAPI): The FastAPI application instance.
26
+ """
27
+ try:
28
+ port = settings.port
29
+ docs_path = app.docs_url or "/docs" # Default to '/docs' if not set
30
+ local_url = f"http://localhost:{port}{docs_path}"
31
+
32
+ # Resolve the network-accessible hostname
33
+ host = socket.gethostbyname(socket.gethostname())
34
+ network_url = f"http://{host}:{port}{docs_path}"
35
+
36
+ # Log the Swagger UI URLs
37
+ self.logger.info(f"Swagger UI available at: {local_url}")
38
+ self.logger.info(f"Network Swagger UI available at: {network_url}")
39
+
40
+ except Exception as e:
41
+ self.logger.warn(f"Failed to determine network URL: {e}")
42
+
43
+ def destroy(self):
44
+ """
45
+ Logs a shutdown message when the application is shutting down.
46
+ """
47
+ self.logger.info("🛑 Application is shutting down!")
File without changes
@@ -9,7 +9,7 @@ class Logger:
9
9
  self.verbose = verbose
10
10
  self.evm = evm # Extreme Verbosity Mode (In-depth debug logs)
11
11
 
12
- def start_logger(self, verbose) -> Logger:
12
+ def start_logger(self, verbose: bool = False) -> Logger:
13
13
  label = Logger.get_label(self.label)
14
14
  return Logger(label, verbose)
15
15
 
@@ -21,14 +21,16 @@ class Logger:
21
21
  print(f"🔴 DEBUG: {msg}")
22
22
 
23
23
  def warn(self, msg: str, file: TextIO = sys.stderr) -> None:
24
- print(f"{self.label} WARNING: {msg}", file=file)
24
+ print(f"{self.label} ⚠️ WARNING: {msg}", file=file)
25
25
 
26
26
  def error(self, msg: str, file: TextIO = sys.stderr) -> None:
27
- print(f"{self.label} ERROR: {msg}", file=file)
27
+ print(f"{self.label} ERROR: {msg}", file=file)
28
28
 
29
29
  @staticmethod
30
30
  def get_label(variant: str) -> str:
31
31
  if variant == "go":
32
32
  return f"[🔥Go Fast: post_gen]"
33
+ if variant == "PyFast":
34
+ return f"[🐍 PyFast]:"
33
35
  return f"[🔥post_gen ({variant})]"
34
36
 
@@ -1,4 +1,4 @@
1
- variant: go-grpc-protoc
1
+ variant: GoUltraFast
2
2
 
3
3
  keep:
4
4
  # ── application source (Go) ─────────────────────────
@@ -1,4 +1,4 @@
1
- variant: java-springboot
1
+ variant: JavaFein
2
2
 
3
3
  keep:
4
4
  # ── application source ────────────────────────────
@@ -1,4 +1,4 @@
1
- variant: python-fastapi
1
+ variant: PyFast
2
2
 
3
3
  keep:
4
4
  # ── application source ─────────────────────────────
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.45
3
+ Version: 0.2.47
4
4
  Summary: Reusable post-generation helper for Cookiecutter micro-service templates
5
5
  Author-email: Will Burks <will@example.com>
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- haraka/__init__.py,sha256=oQxsY6uhvvb8bUdYvbP6oWo48gfzJLunsYTVmFFSKBs,176
1
+ haraka/__init__.py,sha256=1pmkgpZyYEvpZT_WJfiqDK6o-85VR8vv5DTa1s0A5Tg,220
2
2
  haraka/art/__init__.py,sha256=-b1KHQiLkaI2sXaHS05XDaE27tZfXvVLitILjJfSiKs,112
3
3
  haraka/art/create.py,sha256=D2VPJtuwI0Ed7CcreHRHhxSN1VzV7PQfC1q-NW8l0DY,631
4
4
  haraka/art/ascii/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,7 +8,7 @@ haraka/art/ascii/frame/border.py,sha256=n7qaLxzzBmf8ewatbe5gN97DO4afZM67bBjpU1Oq
8
8
  haraka/art/ascii/frame/framer.py,sha256=s_-lsb-hGhlH_73q5iTtk8KHW0MSeSHSAvNFVmL1c9A,3951
9
9
  haraka/art/ascii/frame/width_utils.py,sha256=in4AV3gTBBXUX6N01j67Icu9vsHFomybBN8rpL3sQ5s,810
10
10
  haraka/post_gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- haraka/post_gen/runner.py,sha256=Kl67dUdegrnqBdOL1_vkzGMYWmc_R_Cvia1WyTDWjXU,3507
11
+ haraka/post_gen/runner.py,sha256=OxnalHdVUEtb_k_c8ADZzaWjLOg6v4MZ8P-8Et5dGD4,3504
12
12
  haraka/post_gen/config/__init__.py,sha256=-_XkJ_Dni28yJCMfIceQSiH1wa_hHsZMoBTyvR9Ikbc,62
13
13
  haraka/post_gen/config/config.py,sha256=HwRteLlvOEbfz3_4W6dcJ17bGB6oUrg4dMTzuti8svU,1791
14
14
  haraka/post_gen/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -17,19 +17,21 @@ haraka/post_gen/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
17
17
  haraka/post_gen/service/command.py,sha256=yvEzW9rMSXWeQ_2DXuQNtGH6sRuZnK6viMud-amFQXw,2348
18
18
  haraka/post_gen/service/fileOps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  haraka/post_gen/service/fileOps/files.py,sha256=qsNftbLoo8HHARBwNSHe6dUVPCoqzgv1SHUOH56gj00,3058
20
- haraka/post_gen/service/fileOps/purge.py,sha256=HWc9lUtmLtiTp7dVAO0YHXoHbWa6HVstc7XfmONQ470,7132
20
+ haraka/post_gen/service/fileOps/purge.py,sha256=_pMjLxsOm8GhoWt6saqpNqXeJqTWY_8RMBlQ4GMD16c,7113
21
21
  haraka/post_gen/service/gitOps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  haraka/post_gen/service/gitOps/gitops.py,sha256=clWny1m9qB4yr8asba8JwqBjewlMVsJUmIOCLtAL8RI,4052
23
+ haraka/startup/PyFast.py,sha256=CoXaeCLiVJTnsEEHRcSeCLXyHLuupNWRm158mcJzkak,1666
24
+ haraka/startup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
25
  haraka/utils/__init__.py,sha256=3Cp4u0dyAGcmqes-tIr95KFsNsJx5Ji5Yzkto9546Hs,168
24
26
  haraka/utils/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
27
  haraka/utils/common/utils.py,sha256=kMnMXe_hcxGkD0MKGmR1lIwsRND7BaFPRbGN4PwonfM,360
26
28
  haraka/utils/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- haraka/utils/logging/log_util.py,sha256=UQq2E24q3brvXqcyGCjfSxxHH48JF_BMg54TKdl1SHk,1049
29
+ haraka/utils/logging/log_util.py,sha256=Atlhutx4tKTtme9nj0JjObZNiCkwpEixGjhsGvI9544,1143
30
+ haraka/utils/manifests/GoUltraFast.yml,sha256=LBSlT2QyOi_reUfZ7AAvs0U6Ju47K94eG_fjs7SNuN8,975
31
+ haraka/utils/manifests/JavaFein.yml,sha256=TSTo45Q-NMMqaDS4ogYwU0PpxW-sl0MCYj-RG-Hc_M0,989
32
+ haraka/utils/manifests/PyFast.yml,sha256=dfUXDsxWj-Ex_DQX9sNNezIjfAW_ipjHEh1g8sEs8eQ,924
28
33
  haraka/utils/manifests/go-grpc-gateway-buf.yml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- haraka/utils/manifests/go-grpc-protoc.yml,sha256=buCesaRm9uXGqcohi3SwXsmbI7NyFXLbhFwdV3IVlSI,978
30
- haraka/utils/manifests/java-springboot.yml,sha256=q3TJNGbYpLwmf5evWnprCdU74XJHI5UAeiu4eZ5PVUc,996
31
- haraka/utils/manifests/python-fastapi.yml,sha256=8SHFM-x9vgpB9JkKnIphSK-DDXjMQ-gkRVL8PQhSAic,932
32
- haraka-0.2.45.dist-info/METADATA,sha256=yMxGn6urP5CNRS8sePmCqS2QADq8q075mfjTRksrimo,579
33
- haraka-0.2.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- haraka-0.2.45.dist-info/top_level.txt,sha256=1khpwypLKWoklVd_CgFiwAfcctVSXRoRPc3BI9lyIXo,7
35
- haraka-0.2.45.dist-info/RECORD,,
34
+ haraka-0.2.47.dist-info/METADATA,sha256=e1Uowa-leM9QT8Dd8xYM-RCziprKhCYRs5hcCDGd-es,579
35
+ haraka-0.2.47.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ haraka-0.2.47.dist-info/top_level.txt,sha256=1khpwypLKWoklVd_CgFiwAfcctVSXRoRPc3BI9lyIXo,7
37
+ haraka-0.2.47.dist-info/RECORD,,