itw-python-builder 0.1.0__tar.gz → 0.1.2__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.
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/PKG-INFO +3 -2
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/README.md +1 -1
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder/tasks.py +37 -37
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/PKG-INFO +3 -2
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/requires.txt +1 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/pyproject.toml +2 -1
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/LICENSE +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder/.pylintrc +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder/__init__.py +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder/cli.py +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder/version.py +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/SOURCES.txt +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/dependency_links.txt +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/entry_points.txt +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/top_level.txt +0 -0
- {itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itw_python_builder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
|
|
5
5
|
Author-email: IT-Works <contact@it-works.io>
|
|
6
6
|
License: MIT
|
|
@@ -23,6 +23,7 @@ License-File: LICENSE
|
|
|
23
23
|
Requires-Dist: invoke>=2.0.0
|
|
24
24
|
Requires-Dist: pylint>=3.0.0
|
|
25
25
|
Requires-Dist: pylint-django>=2.5.0
|
|
26
|
+
Requires-Dist: python-decouple>=3.8
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
# ITW Python Builder
|
|
@@ -44,7 +45,7 @@ Standardized Django deployment pipeline with Docker, testing, SonarQube integrat
|
|
|
44
45
|
|
|
45
46
|
## Installation
|
|
46
47
|
```bash
|
|
47
|
-
pip install
|
|
48
|
+
pip install itw-python-builder
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
Install globally (outside any project venv). The `itw` command becomes available system-wide.
|
|
@@ -17,7 +17,7 @@ Standardized Django deployment pipeline with Docker, testing, SonarQube integrat
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
```bash
|
|
20
|
-
pip install
|
|
20
|
+
pip install itw-python-builder
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Install globally (outside any project venv). The `itw` command becomes available system-wide.
|
|
@@ -40,6 +40,15 @@ def detect_and_activate_venv():
|
|
|
40
40
|
print(f"[itw] Using venv: {venv_path}")
|
|
41
41
|
_venv_activated = True
|
|
42
42
|
|
|
43
|
+
def load_env():
|
|
44
|
+
"""Load .env file from current directory into os.environ."""
|
|
45
|
+
from decouple import Config, RepositoryEnv
|
|
46
|
+
env_path = os.path.join(os.getcwd(), '.env')
|
|
47
|
+
if not os.path.exists(env_path):
|
|
48
|
+
return
|
|
49
|
+
config = Config(RepositoryEnv(env_path))
|
|
50
|
+
for key, value in config.repository.data.items():
|
|
51
|
+
os.environ.setdefault(key, value)
|
|
43
52
|
|
|
44
53
|
def get_current_branch(ctx: Context) -> str:
|
|
45
54
|
branch_result = ctx.run('git rev-parse --abbrev-ref HEAD')
|
|
@@ -197,25 +206,25 @@ def release(ctx: Context, skip_pipeline=False) -> None:
|
|
|
197
206
|
@task
|
|
198
207
|
def test(ctx: Context, settings='backend.test_settings'):
|
|
199
208
|
"""Run Django tests with coverage"""
|
|
200
|
-
|
|
201
|
-
ctx.run('coverage
|
|
202
|
-
ctx.run('coverage
|
|
209
|
+
detect_and_activate_venv()
|
|
210
|
+
ctx.run(f'python -m coverage run manage.py test --settings={settings} --keepdb')
|
|
211
|
+
ctx.run('python -m coverage report -m')
|
|
212
|
+
ctx.run('python -m coverage xml -o coverage.xml')
|
|
203
213
|
|
|
204
214
|
|
|
205
215
|
@task
|
|
206
216
|
def lint(ctx: Context):
|
|
207
217
|
"""Run pylint, generate reports for SonarQube"""
|
|
218
|
+
detect_and_activate_venv()
|
|
208
219
|
print("\n" + "=" * 60)
|
|
209
220
|
print("Running pylint...")
|
|
210
221
|
print("=" * 60)
|
|
211
222
|
ctx.run(
|
|
212
|
-
f'pylint . '
|
|
213
|
-
f'--exit-zero '
|
|
223
|
+
f'python -m pylint . '
|
|
214
224
|
f'--rcfile={PYLINTRC} '
|
|
215
225
|
f'--output-format=parseable '
|
|
216
226
|
f'--msg-template="{{path}}:{{line}}: [{{msg_id}}({{symbol}}), {{obj}}] {{msg}}" '
|
|
217
|
-
f'> pylint-report.txt'
|
|
218
|
-
warn=True
|
|
227
|
+
f'> pylint-report.txt'
|
|
219
228
|
)
|
|
220
229
|
print("✓ pylint done → pylint-report.txt")
|
|
221
230
|
print("\n✓ Lint reports ready for SonarQube")
|
|
@@ -224,30 +233,28 @@ def lint(ctx: Context):
|
|
|
224
233
|
@task
|
|
225
234
|
def lintlocal(ctx: Context):
|
|
226
235
|
"""Run pylint locally with human-readable output (no report files)"""
|
|
227
|
-
|
|
236
|
+
detect_and_activate_venv()
|
|
228
237
|
print("\n" + "=" * 60)
|
|
229
238
|
print("Running pylint...")
|
|
230
239
|
print("=" * 60)
|
|
231
|
-
ctx.run(f'pylint . --exit-zero --output-format=parseable --rcfile={PYLINTRC}', warn=True)
|
|
240
|
+
ctx.run(f'python -m pylint . --exit-zero --output-format=parseable --rcfile={PYLINTRC}', warn=True)
|
|
232
241
|
|
|
233
242
|
|
|
234
243
|
@task
|
|
235
244
|
def analyze(ctx: Context):
|
|
236
245
|
"""Run SonarQube analysis"""
|
|
246
|
+
detect_and_activate_venv()
|
|
247
|
+
load_env()
|
|
237
248
|
try:
|
|
238
249
|
version = Version.read_from_file()
|
|
239
250
|
sonar_version = str(version).lstrip('v.')
|
|
240
251
|
except:
|
|
241
252
|
sonar_version = "0.0.0"
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
except ImportError:
|
|
248
|
-
sonar_host = os.environ.get('SONAR_HOST_URL', '')
|
|
249
|
-
sonar_token = os.environ.get('SONAR_TOKEN', '')
|
|
250
|
-
git_depth = os.environ.get('GIT_DEPTH', 0)
|
|
253
|
+
|
|
254
|
+
sonar_host = os.environ.get('SONAR_HOST_URL', '')
|
|
255
|
+
sonar_token = os.environ.get('SONAR_TOKEN', '')
|
|
256
|
+
git_depth = os.environ.get('GIT_DEPTH', '0')
|
|
257
|
+
|
|
251
258
|
if not sonar_host or not sonar_token:
|
|
252
259
|
raise RuntimeError('SONAR_HOST_URL and SONAR_TOKEN environment variables must be set.')
|
|
253
260
|
ctx.run(
|
|
@@ -266,30 +273,29 @@ def buildlocal(ctx: Context):
|
|
|
266
273
|
@task
|
|
267
274
|
def testlocal(ctx: Context, settings='backend.test_settings'):
|
|
268
275
|
"""Run tests locally (not in Docker)"""
|
|
269
|
-
|
|
270
|
-
ctx.run('coverage
|
|
271
|
-
ctx.run('coverage
|
|
276
|
+
detect_and_activate_venv()
|
|
277
|
+
ctx.run(f'python -m coverage run manage.py test --settings={settings} --keepdb')
|
|
278
|
+
ctx.run('python -m coverage report -m')
|
|
279
|
+
ctx.run('python -m coverage xml -o coverage.xml')
|
|
272
280
|
print("✓ Tests completed")
|
|
273
281
|
|
|
274
282
|
|
|
275
283
|
@task
|
|
276
284
|
def analyzelocal(ctx: Context):
|
|
277
285
|
"""Run SonarQube static analysis locally"""
|
|
286
|
+
detect_and_activate_venv()
|
|
287
|
+
load_env()
|
|
278
288
|
print("Running SonarQube analysis...")
|
|
279
289
|
try:
|
|
280
290
|
version = Version.read_from_file()
|
|
281
291
|
sonar_version = str(version).lstrip('v.')
|
|
282
292
|
except:
|
|
283
293
|
sonar_version = "0.0.0"
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
except ImportError:
|
|
290
|
-
sonar_host = os.environ.get('SONAR_HOST_URL', '')
|
|
291
|
-
sonar_token = os.environ.get('SONAR_TOKEN', '')
|
|
292
|
-
git_depth = os.environ.get('GIT_DEPTH', 0)
|
|
294
|
+
|
|
295
|
+
sonar_host = os.environ.get('SONAR_HOST_URL', '')
|
|
296
|
+
sonar_token = os.environ.get('SONAR_TOKEN', '')
|
|
297
|
+
git_depth = os.environ.get('GIT_DEPTH', '0')
|
|
298
|
+
|
|
293
299
|
if not sonar_host or not sonar_token:
|
|
294
300
|
raise RuntimeError('SONAR_HOST_URL and SONAR_TOKEN environment variables must be set.')
|
|
295
301
|
ctx.run(
|
|
@@ -301,8 +307,7 @@ def analyzelocal(ctx: Context):
|
|
|
301
307
|
@task
|
|
302
308
|
def pipelinelocal(ctx: Context, settings='backend.test_settings'):
|
|
303
309
|
"""Local pipeline: lint → test → analyze → build"""
|
|
304
|
-
|
|
305
|
-
|
|
310
|
+
detect_and_activate_venv()
|
|
306
311
|
print("=" * 60)
|
|
307
312
|
print("Step 1: Running lint...")
|
|
308
313
|
print("=" * 60)
|
|
@@ -318,11 +323,6 @@ def pipelinelocal(ctx: Context, settings='backend.test_settings'):
|
|
|
318
323
|
print("=" * 60)
|
|
319
324
|
analyzelocal(ctx)
|
|
320
325
|
|
|
321
|
-
print("\n" + "=" * 60)
|
|
322
|
-
print("Step 4: Building Docker image locally...")
|
|
323
|
-
print("=" * 60)
|
|
324
|
-
buildlocal(ctx)
|
|
325
|
-
|
|
326
326
|
print("\n" + "=" * 60)
|
|
327
327
|
print("✓ Local pipeline completed successfully!")
|
|
328
328
|
print("=" * 60)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: itw_python_builder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Standardized Django deployment pipeline with Docker, testing, and SonarQube integration
|
|
5
5
|
Author-email: IT-Works <contact@it-works.io>
|
|
6
6
|
License: MIT
|
|
@@ -23,6 +23,7 @@ License-File: LICENSE
|
|
|
23
23
|
Requires-Dist: invoke>=2.0.0
|
|
24
24
|
Requires-Dist: pylint>=3.0.0
|
|
25
25
|
Requires-Dist: pylint-django>=2.5.0
|
|
26
|
+
Requires-Dist: python-decouple>=3.8
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
# ITW Python Builder
|
|
@@ -44,7 +45,7 @@ Standardized Django deployment pipeline with Docker, testing, SonarQube integrat
|
|
|
44
45
|
|
|
45
46
|
## Installation
|
|
46
47
|
```bash
|
|
47
|
-
pip install
|
|
48
|
+
pip install itw-python-builder
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
Install globally (outside any project venv). The `itw` command becomes available system-wide.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "itw_python_builder"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -28,6 +28,7 @@ dependencies = [
|
|
|
28
28
|
"invoke>=2.0.0",
|
|
29
29
|
"pylint>=3.0.0",
|
|
30
30
|
"pylint-django>=2.5.0",
|
|
31
|
+
"python-decouple>=3.8",
|
|
31
32
|
]
|
|
32
33
|
|
|
33
34
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{itw_python_builder-0.1.0 → itw_python_builder-0.1.2}/itw_python_builder.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|