haraka 0.2.46__tar.gz → 0.2.47__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 (41) hide show
  1. {haraka-0.2.46 → haraka-0.2.47}/PKG-INFO +1 -1
  2. {haraka-0.2.46 → haraka-0.2.47}/haraka/__init__.py +2 -1
  3. haraka-0.2.47/haraka/startup/PyFast.py +47 -0
  4. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/logging/log_util.py +5 -3
  5. haraka-0.2.47/haraka/utils/manifests/go-grpc-gateway-buf.yml +0 -0
  6. {haraka-0.2.46 → haraka-0.2.47}/haraka.egg-info/PKG-INFO +1 -1
  7. {haraka-0.2.46 → haraka-0.2.47}/haraka.egg-info/SOURCES.txt +2 -0
  8. {haraka-0.2.46 → haraka-0.2.47}/pyproject.toml +1 -1
  9. {haraka-0.2.46 → haraka-0.2.47}/MANIFEST.in +0 -0
  10. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/__init__.py +0 -0
  11. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/__init__.py +0 -0
  12. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/assets.py +0 -0
  13. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/frame/__init__.py +0 -0
  14. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/frame/border.py +0 -0
  15. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/frame/framer.py +0 -0
  16. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/ascii/frame/width_utils.py +0 -0
  17. {haraka-0.2.46 → haraka-0.2.47}/haraka/art/create.py +0 -0
  18. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/__init__.py +0 -0
  19. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/config/__init__.py +0 -0
  20. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/config/config.py +0 -0
  21. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/resources/__init__.py +0 -0
  22. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/resources/assets.py +0 -0
  23. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/runner.py +0 -0
  24. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/__init__.py +0 -0
  25. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/command.py +0 -0
  26. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/fileOps/__init__.py +0 -0
  27. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/fileOps/files.py +0 -0
  28. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/fileOps/purge.py +0 -0
  29. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/gitOps/__init__.py +0 -0
  30. {haraka-0.2.46 → haraka-0.2.47}/haraka/post_gen/service/gitOps/gitops.py +0 -0
  31. {haraka-0.2.46/haraka/utils/common → haraka-0.2.47/haraka/startup}/__init__.py +0 -0
  32. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/__init__.py +0 -0
  33. {haraka-0.2.46/haraka/utils/logging → haraka-0.2.47/haraka/utils/common}/__init__.py +0 -0
  34. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/common/utils.py +0 -0
  35. /haraka-0.2.46/haraka/utils/manifests/go-grpc-gateway-buf.yml → /haraka-0.2.47/haraka/utils/logging/__init__.py +0 -0
  36. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/manifests/GoUltraFast.yml +0 -0
  37. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/manifests/JavaFein.yml +0 -0
  38. {haraka-0.2.46 → haraka-0.2.47}/haraka/utils/manifests/PyFast.yml +0 -0
  39. {haraka-0.2.46 → haraka-0.2.47}/haraka.egg-info/dependency_links.txt +0 -0
  40. {haraka-0.2.46 → haraka-0.2.47}/haraka.egg-info/top_level.txt +0 -0
  41. {haraka-0.2.46 → haraka-0.2.47}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.46
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,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"]
@@ -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!")
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haraka
3
- Version: 0.2.46
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
@@ -26,6 +26,8 @@ haraka/post_gen/service/fileOps/files.py
26
26
  haraka/post_gen/service/fileOps/purge.py
27
27
  haraka/post_gen/service/gitOps/__init__.py
28
28
  haraka/post_gen/service/gitOps/gitops.py
29
+ haraka/startup/PyFast.py
30
+ haraka/startup/__init__.py
29
31
  haraka/utils/__init__.py
30
32
  haraka/utils/common/__init__.py
31
33
  haraka/utils/common/utils.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "haraka"
7
- version = "0.2.46"
7
+ version = "0.2.47"
8
8
  description = "Reusable post-generation helper for Cookiecutter micro-service templates"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes
File without changes