utils_devops 0.1.119__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.
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: utils_devops
3
+ Version: 0.1.119
4
+ Summary: Lightweight DevOps utilities for automation scripts: config editing (YAML/JSON/INI/.env), templating, diffing, and CLI tools
5
+ License: MIT
6
+ Keywords: devops,automation,nginx,cli,jinja2,yaml,config,diff,templating,logging,docker,compose,file-ops
7
+ Author: Hamed Sheikhan
8
+ Author-email: sh.sheikhan.m@gmail.com
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Classifier: Topic :: Utilities
25
+ Requires-Dist: docker (>=6.0,<8.0)
26
+ Requires-Dist: filelock (>=3.20.0,<4.0.0)
27
+ Requires-Dist: inquirer (>=3.4.1,<4.0.0)
28
+ Requires-Dist: jinja2 (>=3.1,<4.0)
29
+ Requires-Dist: packaging (>=24.1,<25.0)
30
+ Requires-Dist: paramiko (>=3.4.0,<4.0.0)
31
+ Requires-Dist: psutil (>=6.0,<7.0)
32
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
33
+ Requires-Dist: python-dotenv (>=1.0,<2.0)
34
+ Requires-Dist: pyyaml (>=6.0,<7.0)
35
+ Requires-Dist: requests (>=2.32,<3.0)
36
+ Requires-Dist: rich (>=13.9,<14.0)
37
+ Requires-Dist: ruamel-yaml (>=0.18.6,<0.19.0)
38
+ Requires-Dist: scp (>=0.14.0,<0.15.0)
39
+ Requires-Dist: slack-sdk (>=3.37.0,<4.0.0)
40
+ Requires-Dist: sshtunnel (>=0.4.0,<0.5.0)
41
+ Requires-Dist: tenacity (>=9.0,<10.0)
42
+ Requires-Dist: typer (>=0.12.5,<0.13.0)
43
+ Description-Content-Type: text/markdown
44
+
45
+
File without changes
@@ -0,0 +1,175 @@
1
+ [tool.poetry]
2
+ name = "utils_devops"
3
+ version = "0.1.119" # Bumped for new string features + diffing
4
+ description = "Lightweight DevOps utilities for automation scripts: config editing (YAML/JSON/INI/.env), templating, diffing, and CLI tools"
5
+ authors = ["Hamed Sheikhan <sh.sheikhan.m@gmail.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ keywords = [
9
+ "devops",
10
+ "automation",
11
+ "nginx",
12
+ "cli",
13
+ "jinja2",
14
+ "yaml",
15
+ "config",
16
+ "diff",
17
+ "templating",
18
+ "logging",
19
+ "docker",
20
+ "compose",
21
+ "file-ops"
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Developers",
26
+ "Intended Audience :: System Administrators",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: System :: Systems Administration",
29
+ "Topic :: Utilities",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "License :: OSI Approved :: MIT License",
35
+ "Operating System :: OS Independent",
36
+ "Natural Language :: English"
37
+ ]
38
+ packages = [{ include = "utils_devops", from = "src" }]
39
+
40
+ [tool.poetry.dependencies]
41
+ python = "^3.10"
42
+ # Core
43
+ python-dotenv = "^1.0"
44
+ pyyaml = "^6.0" # For safe_load/dump fallback
45
+ ruamel-yaml = "^0.18.6" # Critical: preserves comments, formatting in YAML
46
+ jinja2 = "^3.1"
47
+ typer = "^0.12.5"
48
+ rich = "^13.9"
49
+ # System & File
50
+ psutil = "^6.0"
51
+ filelock = "^3.20.0"
52
+ # Network & Resilience
53
+ requests = "^2.32"
54
+ tenacity = "^9.0"
55
+ # Utils
56
+ packaging = "^24.1"
57
+ python-dateutil = "^2.9.0.post0"
58
+ inquirer = "^3.4.1"
59
+ slack-sdk = "^3.37.0"
60
+ docker = ">=6.0,<8.0"
61
+ # ssh Tools
62
+ paramiko = "^3.4.0" # Best pure-Python SSH implementation
63
+ sshtunnel = "^0.4.0" # Optional: for SSH tunneling/port forwarding
64
+ scp = "^0.14.0" # High-level SCP over Paramiko (very clean API)
65
+
66
+ # Built-in enhanced
67
+
68
+ [tool.poetry.group.dev.dependencies]
69
+ pytest = "^8.0"
70
+ pytest-mock = "^3.0"
71
+ mypy = "^1.8"
72
+ black = "^24.0"
73
+ ruff = "^0.12"
74
+ pre-commit = "^4.0"
75
+ tox = "^4.0"
76
+ bandit = "^1.8"
77
+ twine = "^4.0"
78
+ shiv = "^0.4"
79
+ pytest-cov = "^5.0" # Code coverage
80
+ mkdocs = "^1.6" # Optional: if you want docs
81
+ mkdocs-material = "^9.5" # Optional: beautiful docs
82
+ docker = ">=6.0,<8.0" # for integration tests and local dev
83
+ testcontainers = "^4.11" # run ephemeral containers in tests
84
+ pytest-xdist = "^3.8"
85
+
86
+ [tool.poetry.scripts]
87
+ utils-devops = "utils_devops.cli:app"
88
+
89
+ [build-system]
90
+ requires = ["poetry-core"]
91
+ build-backend = "poetry.core.masonry.api"
92
+
93
+ # ========================
94
+ # Tool Configurations
95
+ # ========================
96
+
97
+ [tool.black]
98
+ line-length = 100
99
+ target-version = ['py310']
100
+ include = '\.pyi?$'
101
+ extend-exclude = '''
102
+ /(
103
+ \.eggs
104
+ | \.git
105
+ | \.hg
106
+ | \.mypy_cache
107
+ | \.tox
108
+ | \.venv
109
+ | _build
110
+ | buck-out
111
+ | build
112
+ | dist
113
+ )/
114
+ '''
115
+
116
+ [tool.ruff]
117
+ select = [
118
+ "E", "W", "F", "I", "B", "C4", "UP", "BLE", "A",
119
+ "COM", "ISC", "PIE", "T20", "Q", "RET", "SIM", "TID",
120
+ "ARG", "PTH", "PL", "TRY", "FLY", "NPY", "PERF", "ANN"
121
+ ]
122
+ ignore = ["E501"] # Let black handle line length
123
+ line-length = 100
124
+ target-version = "py310"
125
+ src = ["src"]
126
+ extend-exclude = ["__pycache__", "*.egg-info", "build", "dist"]
127
+
128
+ [tool.ruff.per-file-ignores]
129
+ "tests/*" = ["S101", "ANN"] # Allow assert + missing annotations in tests
130
+ "src/utils_devops/cli.py" = ["ANN"] # Typer may not annotate fully
131
+
132
+ [tool.mypy]
133
+ python_version = "3.10"
134
+ strict = true
135
+ ignore_missing_imports = true
136
+ exclude = ["build", "dist", "tests/fixtures"]
137
+ warn_unused_configs = true
138
+ disallow_untyped_decorators = false # Allow Typer
139
+
140
+ [[tool.mypy.overrides]]
141
+ module = "ruamel.yaml.*"
142
+ ignore_missing_imports = true
143
+
144
+ [tool.pytest.ini_options]
145
+ addopts = "-ra -q --cov=utils_devops --cov-report=term-missing"
146
+ testpaths = ["tests"]
147
+ python_files = ["test_*.py"]
148
+ python_classes = ["Test*"]
149
+ python_functions = ["test_*"]
150
+ markers = [
151
+ "integration: marks tests as integration (deselect with '-m \"not integration\"')",
152
+ "unit: marks tests as unit"
153
+ ]
154
+
155
+ [tool.coverage.run]
156
+ source = ["src/utils_devops"]
157
+ omit = [
158
+ "src/utils_devops/__init__.py",
159
+ "src/utils_devops/cli.py" # CLI entrypoint
160
+ ]
161
+
162
+ [tool.coverage.report]
163
+ exclude_lines = [
164
+ "pragma: no cover",
165
+ "def __repr__",
166
+ "raise AssertionError",
167
+ "raise NotImplementedError",
168
+ "if __name__ == .__main__.:",
169
+ "if TYPE_CHECKING:"
170
+ ]
171
+ fail_under = 85
172
+
173
+ # Optional: MkDocs (if you want documentation)
174
+ [tool.mkdocs]
175
+ # Configuration would go in mkdocs.yml, but this keeps it discoverable
@@ -0,0 +1,72 @@
1
+ # src/utils_devops/__init__.py
2
+ """
3
+ utils_devops - Lightweight DevOps utilities for automation scripts.
4
+
5
+ Design decisions:
6
+ - `core` is a real package (always imported).
7
+ - `extras` is a real package that performs lazy imports on attribute access
8
+ (see utils_devops/extras/__init__.py). This means both:
9
+ import utils_devops.extras
10
+ and
11
+ from utils_devops.extras import nginx_ops
12
+ will work and lazily import the submodule when needed.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import importlib
18
+ import sys
19
+ from typing import Any
20
+
21
+ __version__ = "0.1.5"
22
+ __author__ = "Hamed Sheikhan <sh.sheikhan.m@gmail.com>"
23
+
24
+ # console (optional)
25
+ try:
26
+ from rich.console import Console
27
+ console = Console()
28
+ except Exception:
29
+ console = None # type: ignore
30
+
31
+ # --- Core package (always imported) ---
32
+ # Import the core package module itself (not individual functions).
33
+ try:
34
+ core = importlib.import_module("utils_devops.core")
35
+ except Exception as e:
36
+ # Fail fast if core cannot import
37
+ raise ImportError("Failed to import utils_devops.core — check installation") from e
38
+
39
+ # re-export convenient names to match older API
40
+ datetimes = core.datetimes
41
+ envs = core.envs
42
+ files = core.files
43
+ logs = core.logs
44
+ strings = core.strings
45
+ systems = core.systems
46
+ script_helpers = core.script_helpers
47
+
48
+ # --- Extras package (the package module implements lazy loading) ---
49
+ # Import the extras package module (it will internally lazy-load submodules).
50
+ try:
51
+ extras = importlib.import_module("utils_devops.extras")
52
+ except Exception:
53
+ # extras is optional — leave it as a placeholder module with limited behavior
54
+ extras = None # type: ignore
55
+
56
+ # top-level visible names
57
+ __all__ = [
58
+ "__version__",
59
+ "core",
60
+ "extras",
61
+ # core convenience re-exports
62
+ "datetimes",
63
+ "envs",
64
+ "files",
65
+ "logs",
66
+ "strings",
67
+ "systems",
68
+ "script_helpers",
69
+ ]
70
+
71
+ if console:
72
+ console.log("[bold green]utils_devops core modules loaded[/bold green]")
@@ -0,0 +1,25 @@
1
+ # src/utils_devops/core/__init__.py
2
+ """
3
+ Core utilities for utils_devops.
4
+ Always loaded — safe and dependency-free.
5
+ """
6
+
7
+ from . import (
8
+ datetimes,
9
+ envs,
10
+ files,
11
+ logs,
12
+ script_helpers,
13
+ strings,
14
+ systems,
15
+ )
16
+
17
+ __all__ = [
18
+ "datetimes",
19
+ "envs",
20
+ "files",
21
+ "logs",
22
+ "script_helpers",
23
+ "strings",
24
+ "systems",
25
+ ]