itw-python-builder 0.2.2__tar.gz → 0.2.4__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 (22) hide show
  1. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/PKG-INFO +1 -1
  2. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/tasks.py +3 -3
  3. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/templates/new_version_email.html +1 -2
  4. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/utils.py +16 -8
  5. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/version.py +3 -0
  6. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/PKG-INFO +1 -1
  7. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/pyproject.toml +1 -1
  8. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/LICENSE +0 -0
  9. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/README.md +0 -0
  10. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/.pylintrc +0 -0
  11. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/__init__.py +0 -0
  12. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/cli.py +0 -0
  13. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/notify.py +0 -0
  14. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/ssr_tasks.py +0 -0
  15. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/templates/server.sitemap.snippet.ts +0 -0
  16. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder/templates/sitemap.routes.ts +0 -0
  17. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/SOURCES.txt +0 -0
  18. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/dependency_links.txt +0 -0
  19. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/entry_points.txt +0 -0
  20. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/requires.txt +0 -0
  21. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/top_level.txt +0 -0
  22. {itw_python_builder-0.2.2 → itw_python_builder-0.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.2.2
3
+ Version: 0.2.4
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
@@ -358,7 +358,7 @@ def _ensure_unique_tag(ctx: Context, version: Version) -> None:
358
358
  @task
359
359
  def incrementrc(ctx: Context, skip_pipeline=False, pylintrc=None, ssr=False) -> None:
360
360
  """Increment release candidate version and deploy. Use --ssr for Angular SSR builds."""
361
- check_branch(ctx)
361
+ check_branch(ctx, required='staging')
362
362
  ensure_gitlab_auth(ctx)
363
363
  project_type = detect_project_type()
364
364
  version = read_version(ctx)
@@ -427,7 +427,7 @@ def incrementmajor(ctx: Context, skip_pipeline=False, ssr=False) -> None:
427
427
  @task
428
428
  def release(ctx: Context, skip_pipeline=False, ssr=False) -> None:
429
429
  """Promote release candidate to stable release and deploy. Use --ssr for Angular SSR builds."""
430
- production = check_branch(ctx)
430
+ production = check_branch(ctx, required='master')
431
431
  ensure_gitlab_auth(ctx)
432
432
  version = read_version(ctx)
433
433
  version.reset_release_candidate(release=True)
@@ -511,7 +511,7 @@ def analyze(ctx: Context):
511
511
  if not sonar_host or not sonar_token:
512
512
  raise RuntimeError('SONAR_HOST_URL and SONAR_TOKEN environment variables must be set.')
513
513
  ctx.run(
514
- f'podman run --rm -e SONAR_HOST_URL={sonar_host} -e SONAR_TOKEN={sonar_token} -e GIT_DEPTH={git_depth} --user=root -v "$(pwd)":/usr/src:Z docker.io/sonarsource/sonar-scanner-cli:latest -X -Dsonar.projectVersion={sonar_version}')
514
+ f'podman run --rm -e SONAR_HOST_URL={sonar_host} -e SONAR_TOKEN={sonar_token} -e GIT_DEPTH={git_depth} --user=root -v "$(pwd)":/usr/src:Z -v $HOME/.sonar/cache:/opt/sonar-scanner/.sonar/cache:Z docker.io/sonarsource/sonar-scanner-cli:latest -Dsonar.projectVersion={sonar_version}')
515
515
 
516
516
 
517
517
  @task
@@ -26,8 +26,7 @@
26
26
  {COMMIT_MESSAGE}
27
27
  </div>
28
28
  <p style="margin:0 0 8px 0;font-size:15px;"><strong>Komanda për të bërë upgrade:</strong></p>
29
- <p style="margin:0 0 6px 0;font-size:12px;color:#6b7280;">Klikoni mbi komandën për ta zgjedhur, pastaj Ctrl+C (ose ⌘+C).</p>
30
- <pre style="background:#0f172a;color:#f9fafb;padding:14px 16px;border-radius:6px;font-size:13px;overflow-x:auto;margin:0 0 20px 0;-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all;cursor:text;">pip install itw-python-builder=={VERSION} --no-cache-dir</pre>
29
+ <pre style="background:#0f172a;color:#f9fafb;padding:14px 16px;border-radius:6px;font-size:13px;overflow-x:auto;margin:0 0 20px 0;">pip install itw-python-builder=={VERSION} --no-cache-dir</pre>
31
30
  <p style="margin:0;font-size:13px;color:#6b7280;">Faleminderit</p>
32
31
  </td>
33
32
  </tr>
@@ -160,19 +160,27 @@ def is_branch_production(branch: str) -> bool:
160
160
  return branch == 'master'
161
161
 
162
162
 
163
- def check_branch(ctx: Context) -> bool:
163
+ def check_branch(ctx: Context, required: str = None) -> bool:
164
164
  current_branch = get_current_branch(ctx)
165
- production = is_branch_production(current_branch)
165
+ if required == 'master' and current_branch != 'master':
166
+ raise RuntimeError(
167
+ f'This command is production-only and must be run from master. '
168
+ f'Current branch: {current_branch}.'
169
+ )
170
+ if required == 'staging' and current_branch != 'staging':
171
+ raise RuntimeError(
172
+ f'This command is staging-only and must be run from staging. '
173
+ f'Current branch: {current_branch}.'
174
+ )
175
+ if required is None and current_branch not in ('master', 'staging'):
176
+ raise RuntimeError(
177
+ f'Cannot tag in branch {current_branch}. Must be on master or staging.'
178
+ )
166
179
  changed_result = ctx.run('git diff --quiet HEAD $REF -- $DIR || echo changed')
167
180
  changed = changed_result.stdout.splitlines()
168
181
  if len(changed) > 0:
169
182
  raise RuntimeError(f'You have uncommitted changes in branch {current_branch}.')
170
- if production and current_branch != 'master':
171
- raise RuntimeError('You must be in master branch to release in production.')
172
- elif not production and current_branch != 'staging':
173
- raise RuntimeError(f'Cannot tag in branch {current_branch}.')
174
- else:
175
- return production
183
+ return is_branch_production(current_branch)
176
184
 
177
185
 
178
186
  def get_latest_tag(ctx: Context) -> Version:
@@ -32,10 +32,13 @@ class Version:
32
32
 
33
33
  def increment_minor(self, release: bool = False) -> None:
34
34
  self.minor += 1
35
+ self.patch = 0
35
36
  self.reset_release_candidate(release)
36
37
 
37
38
  def increment_major(self, release: bool = False) -> None:
38
39
  self.major += 1
40
+ self.minor = 0
41
+ self.patch = 0
39
42
  self.reset_release_candidate(release)
40
43
 
41
44
  def save_to_file(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itw_python_builder
3
- Version: 0.2.2
3
+ Version: 0.2.4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "itw_python_builder"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"