itw-python-builder 0.2.1__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.1 → itw_python_builder-0.2.4}/PKG-INFO +1 -1
  2. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/tasks.py +13 -13
  3. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/templates/new_version_email.html +1 -11
  4. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/utils.py +16 -8
  5. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/version.py +3 -0
  6. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/PKG-INFO +1 -1
  7. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/pyproject.toml +1 -1
  8. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/LICENSE +0 -0
  9. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/README.md +0 -0
  10. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/.pylintrc +0 -0
  11. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/__init__.py +0 -0
  12. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/cli.py +0 -0
  13. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/notify.py +0 -0
  14. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/ssr_tasks.py +0 -0
  15. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/templates/server.sitemap.snippet.ts +0 -0
  16. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder/templates/sitemap.routes.ts +0 -0
  17. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/SOURCES.txt +0 -0
  18. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/dependency_links.txt +0 -0
  19. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/entry_points.txt +0 -0
  20. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/requires.txt +0 -0
  21. {itw_python_builder-0.2.1 → itw_python_builder-0.2.4}/itw_python_builder.egg-info/top_level.txt +0 -0
  22. {itw_python_builder-0.2.1 → 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.1
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
@@ -112,19 +112,19 @@ def logout(ctx: Context):
112
112
 
113
113
 
114
114
  @task(name='task')
115
- def create_task(ctx: Context, f=None):
116
- """Create GitLab tasks in the group's _pm repo from a markdown file (--f path.md)."""
117
- if not f:
118
- raise RuntimeError('Missing --f path to markdown file.')
119
- if not f.lower().endswith('.md'):
120
- raise RuntimeError(f'File must be .md, got {f!r}.')
121
- if not os.path.isfile(f):
122
- raise RuntimeError(f'File not found: {f}')
115
+ def create_task(ctx: Context, file=None):
116
+ """Create GitLab tasks in the group's _pm repo from a markdown file (--file path.md)."""
117
+ if not file:
118
+ raise RuntimeError('Missing --file path to markdown file.')
119
+ if not file.lower().endswith('.md'):
120
+ raise RuntimeError(f'File must be .md, got {file!r}.')
121
+ if not os.path.isfile(file):
122
+ raise RuntimeError(f'File not found: {file}')
123
123
  if not os.path.isdir(os.path.join(os.getcwd(), '.git')):
124
124
  raise RuntimeError('Not a git repository (no .git folder here).')
125
125
 
126
- issues = parse_md_issues(f)
127
- print(f'[itw] Parsed {len(issues)} task(s) from {f}.')
126
+ issues = parse_md_issues(file)
127
+ print(f'[itw] Parsed {len(issues)} task(s) from {file}.')
128
128
 
129
129
  token = ensure_gitlab_token(ctx)
130
130
  host, project_path = _parse_gitlab_remote(ctx)
@@ -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,17 +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
- <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#0f172a;border-radius:6px;margin:0 0 20px 0;">
30
- <tr>
31
- <td style="padding:14px 16px;">
32
- <code style="color:#f9fafb;font-family:Consolas,Monaco,monospace;font-size:13px;-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all;cursor:text;display:block;word-break:break-all;">pip install itw-python-builder=={VERSION} --no-cache-dir</code>
33
- </td>
34
- <td align="right" valign="middle" style="padding:14px 16px 14px 0;width:1%;white-space:nowrap;">
35
- <span style="display:inline-block;background:#1f2937;color:#f9fafb;border:1px solid #374151;border-radius:4px;padding:6px 12px;font-size:12px;font-family:Arial,Helvetica,sans-serif;">📋 Copy</span>
36
- </td>
37
- </tr>
38
- </table>
39
- <p style="margin:-12px 0 20px 0;font-size:11px;color:#9ca3af;">Klikoni mbi komandën për ta zgjedhur, pastaj Ctrl+C (ose ⌘+C).</p>
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>
40
30
  <p style="margin:0;font-size:13px;color:#6b7280;">Faleminderit</p>
41
31
  </td>
42
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.1
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.1"
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"