oe-python-template 0.13.14__tar.gz → 0.13.15__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 (40) hide show
  1. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/.gitignore +1 -0
  2. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/PKG-INFO +1 -1
  3. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/pyproject.toml +2 -2
  4. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_log.py +42 -1
  5. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_sentry.py +2 -2
  6. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/LICENSE +0 -0
  7. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/README.md +0 -0
  8. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/__init__.py +0 -0
  9. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/api.py +0 -0
  10. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/cli.py +0 -0
  11. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/constants.py +0 -0
  12. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/__init__.py +0 -0
  13. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_api.py +0 -0
  14. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_cli.py +0 -0
  15. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_constants.py +0 -0
  16. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_gui.py +0 -0
  17. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_models.py +0 -0
  18. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_service.py +0 -0
  19. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/hello/_settings.py +0 -0
  20. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/__init__.py +0 -0
  21. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/_api.py +0 -0
  22. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/_cli.py +0 -0
  23. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/_gui.py +0 -0
  24. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/_service.py +0 -0
  25. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/system/_settings.py +0 -0
  26. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/.vendored/bottle.py +0 -0
  27. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/__init__.py +0 -0
  28. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_api.py +0 -0
  29. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_cli.py +0 -0
  30. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_console.py +0 -0
  31. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_constants.py +0 -0
  32. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_di.py +0 -0
  33. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_gui.py +0 -0
  34. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_health.py +0 -0
  35. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_logfire.py +0 -0
  36. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_notebook.py +0 -0
  37. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_process.py +0 -0
  38. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_service.py +0 -0
  39. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/_settings.py +0 -0
  40. {oe_python_template-0.13.14 → oe_python_template-0.13.15}/src/oe_python_template/utils/boot.py +0 -0
@@ -4,6 +4,7 @@
4
4
  .env
5
5
  .env.backup
6
6
  .env.bak
7
+ .env.orig
7
8
  ENV/
8
9
  env/
9
10
  .envrc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template
3
- Version: 0.13.14
3
+ Version: 0.13.15
4
4
  Summary: 🧠 Copier template to scaffold Python projects compliant with best practices and modern tooling.
5
5
  Project-URL: Homepage, https://oe-python-template.readthedocs.io/en/latest/
6
6
  Project-URL: Documentation, https://oe-python-template.readthedocs.io/en/latest/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "oe-python-template"
3
- version = "0.13.14"
3
+ version = "0.13.15"
4
4
  description = "🧠 Copier template to scaffold Python projects compliant with best practices and modern tooling."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Helmut Hoffer von Ankershoffen", email = "helmuthva@gmail.com" }]
@@ -279,7 +279,7 @@ source = ["src/"]
279
279
 
280
280
 
281
281
  [tool.bumpversion]
282
- current_version = "0.13.14"
282
+ current_version = "0.13.15"
283
283
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
284
284
  serialize = ["{major}.{minor}.{patch}"]
285
285
  search = "{current_version}"
@@ -1,13 +1,15 @@
1
1
  """Logging configuration and utilities."""
2
2
 
3
3
  import logging as python_logging
4
+ import os
4
5
  import typing as t
5
6
  from logging import FileHandler
7
+ from pathlib import Path
6
8
  from typing import Annotated, Literal
7
9
 
8
10
  import click
9
11
  import logfire
10
- from pydantic import Field
12
+ from pydantic import AfterValidator, Field
11
13
  from pydantic_settings import BaseSettings, SettingsConfigDict
12
14
  from rich.console import Console
13
15
  from rich.logging import RichHandler
@@ -31,6 +33,44 @@ def get_logger(name: str | None) -> python_logging.Logger:
31
33
  return python_logging.getLogger(f"{__project_name__}.{name}")
32
34
 
33
35
 
36
+ def _validate_file_name(file_name: str | None) -> str | None:
37
+ """Validate the file_name is valid and the file writeable.
38
+
39
+ - Checks file_name does not yet exist or is a file
40
+ - If not yet existing, checks it can be created
41
+ - If existing file, checks file is writeable
42
+
43
+ Args:
44
+ file_name: The file name of the log file
45
+
46
+ Returns:
47
+ str | None: The validated file name
48
+
49
+ Raises:
50
+ ValueError: If file name is not valid or the file not writeable
51
+ """
52
+ if file_name is None:
53
+ return file_name
54
+
55
+ file_path = Path(file_name)
56
+ if file_path.exists():
57
+ if not file_path.is_file():
58
+ message = f"File name {file_path.absolute()} is not a file"
59
+ raise ValueError(message)
60
+ if not os.access(file_path, os.W_OK):
61
+ message = f"File {file_path.absolute()} is not writable"
62
+ raise ValueError(message)
63
+ else:
64
+ try:
65
+ file_path.touch(exist_ok=False)
66
+ file_path.unlink()
67
+ except OSError as e:
68
+ message = f"File {file_path.absolute()} cannot be created: {e}"
69
+ raise ValueError(message) from e
70
+
71
+ return file_name
72
+
73
+
34
74
  class LogSettings(BaseSettings):
35
75
  """Settings for configuring logging behavior."""
36
76
 
@@ -51,6 +91,7 @@ class LogSettings(BaseSettings):
51
91
  ]
52
92
  file_name: Annotated[
53
93
  str,
94
+ AfterValidator(_validate_file_name),
54
95
  Field(description="Name of the log file", default=f"{__project_name__}.log"),
55
96
  ]
56
97
  console_enabled: Annotated[
@@ -77,7 +77,7 @@ def _validate_sentry_domain(netloc_with_auth: str) -> None:
77
77
  raise ValueError(_ERR_MSG_INVALID_DOMAIN)
78
78
 
79
79
 
80
- def validate_https_dsn(value: SecretStr | None) -> SecretStr | None:
80
+ def _validate_https_dsn(value: SecretStr | None) -> SecretStr | None:
81
81
  """Validate that the Sentry DSN is a valid HTTPS URL.
82
82
 
83
83
  Args:
@@ -124,7 +124,7 @@ class SentrySettings(OpaqueSettings):
124
124
  dsn: Annotated[
125
125
  SecretStr | None,
126
126
  BeforeValidator(strip_to_none_before_validator),
127
- AfterValidator(validate_https_dsn),
127
+ AfterValidator(_validate_https_dsn),
128
128
  PlainSerializer(func=OpaqueSettings.serialize_sensitive_info, return_type=str, when_used="always"),
129
129
  Field(description="Sentry DSN", examples=["https://SECRET@SECRET.ingest.de.sentry.io/SECRET"], default=None),
130
130
  ]