itw-python-builder 0.2.11__tar.gz → 0.2.12__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.2.11 → itw_python_builder-0.2.12}/PKG-INFO +1 -1
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/tasks.py +66 -6
- itw_python_builder-0.2.12/itw_python_builder/templates/task_template.md +27 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/PKG-INFO +1 -1
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/SOURCES.txt +2 -1
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/pyproject.toml +2 -2
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/LICENSE +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/README.md +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/.pylintrc +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/__init__.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/_pyruntime/sitecustomize.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/cli.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/notify.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/ssr_tasks.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/task_utils.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/templates/new_version_email.html +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/templates/server.sitemap.snippet.ts +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/templates/sitemap.routes.ts +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/utils.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder/version.py +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/dependency_links.txt +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/entry_points.txt +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/requires.txt +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/top_level.txt +0 -0
- {itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/setup.cfg +0 -0
|
@@ -47,6 +47,7 @@ from itw_python_builder.task_utils import (
|
|
|
47
47
|
from itw_python_builder.version import Version
|
|
48
48
|
|
|
49
49
|
PYLINTRC = Path(__file__).parent / ".pylintrc"
|
|
50
|
+
TASK_TEMPLATE_PATH = Path(__file__).parent / "templates" / "task_template.md"
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
def _prompt_and_store_token(ctx: Context, username: str = None) -> str:
|
|
@@ -123,6 +124,17 @@ def logout(ctx: Context):
|
|
|
123
124
|
os.environ.pop('GITLAB_USERNAME', None)
|
|
124
125
|
|
|
125
126
|
|
|
127
|
+
@task(name='task-init')
|
|
128
|
+
def task_init(ctx: Context) -> None:
|
|
129
|
+
"""Create a TASK.md template with every /directive and section supported by `itw task`."""
|
|
130
|
+
dest = os.path.join(os.getcwd(), 'TASK.md')
|
|
131
|
+
if os.path.exists(dest):
|
|
132
|
+
log_red('TASK.md already exists in this directory — refusing to overwrite.')
|
|
133
|
+
sys.exit(1)
|
|
134
|
+
shutil.copyfile(TASK_TEMPLATE_PATH, dest)
|
|
135
|
+
log_green(f'Created TASK.md in {os.getcwd()}')
|
|
136
|
+
|
|
137
|
+
|
|
126
138
|
@task(name='task')
|
|
127
139
|
def create_task(ctx: Context, file=None):
|
|
128
140
|
"""Create GitLab issues in the group's _pm repo from a markdown file (--file path.md)."""
|
|
@@ -553,11 +565,52 @@ def release(ctx: Context, skip_pipeline=False, ssr=False) -> None:
|
|
|
553
565
|
propagate_changelog(ctx)
|
|
554
566
|
|
|
555
567
|
|
|
568
|
+
def _list_spec_files() -> list:
|
|
569
|
+
root = Path(os.getcwd())
|
|
570
|
+
return [
|
|
571
|
+
p.relative_to(root)
|
|
572
|
+
for p in root.glob('**/*.spec.ts')
|
|
573
|
+
if 'node_modules' not in p.parts
|
|
574
|
+
]
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
def _resolve_spec_include(target: str) -> str:
|
|
578
|
+
if '/' in target or '*' in target:
|
|
579
|
+
return target
|
|
580
|
+
if target.endswith('.spec.ts'):
|
|
581
|
+
return f'**/{target}'
|
|
582
|
+
|
|
583
|
+
name = target.removesuffix('.ts')
|
|
584
|
+
specs = _list_spec_files()
|
|
585
|
+
if any(name in spec.parts[:-1] for spec in specs):
|
|
586
|
+
return f'**/{name}/**/*.spec.ts'
|
|
587
|
+
if any(spec.name == f'{name}.spec.ts' for spec in specs):
|
|
588
|
+
return f'**/{name}.spec.ts'
|
|
589
|
+
if '.' in name:
|
|
590
|
+
head, rest = name.split('.', 1)
|
|
591
|
+
if any(head in spec.parts[:-1] and spec.name == f'{rest}.spec.ts' for spec in specs):
|
|
592
|
+
return f'**/{head}/**/{rest}.spec.ts'
|
|
593
|
+
|
|
594
|
+
raise RuntimeError(
|
|
595
|
+
f'No spec files match --target={target!r}. Expected a directory name '
|
|
596
|
+
f'(e.g. --target=core), a spec name (e.g. --target=core.service), or a path/glob.'
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
def _resolve_django_label(target: str) -> str:
|
|
601
|
+
return target.strip().removesuffix('.py').replace('/', '.').strip('.')
|
|
602
|
+
|
|
603
|
+
|
|
556
604
|
@task
|
|
557
|
-
def test(ctx: Context, settings='backend.test_settings', warn=True):
|
|
558
|
-
"""Run tests with coverage."""
|
|
605
|
+
def test(ctx: Context, settings='backend.test_settings', target=None, warn=True):
|
|
606
|
+
"""Run tests with coverage. --target=app or --target=app.test_file runs a subset."""
|
|
559
607
|
if detect_project_type() == 'frontend':
|
|
560
|
-
|
|
608
|
+
cmd = 'npx ng test --no-watch --code-coverage --browsers=ChromeHeadlessNoSandbox'
|
|
609
|
+
if target:
|
|
610
|
+
include = _resolve_spec_include(target)
|
|
611
|
+
print(f'[itw] Limiting run to specs matching {include}')
|
|
612
|
+
cmd += f' --include="{include}"'
|
|
613
|
+
ctx.run(cmd, warn=warn)
|
|
561
614
|
print("✓ Tests completed")
|
|
562
615
|
return
|
|
563
616
|
detect_and_activate_venv()
|
|
@@ -566,16 +619,23 @@ def test(ctx: Context, settings='backend.test_settings', warn=True):
|
|
|
566
619
|
patch_dir = str(Path(__file__).parent / '_pyruntime')
|
|
567
620
|
existing_pp = os.environ.get('PYTHONPATH', '')
|
|
568
621
|
injected_pp = f'{patch_dir}:{existing_pp}' if existing_pp else patch_dir
|
|
622
|
+
label = ''
|
|
623
|
+
if target:
|
|
624
|
+
label = f' {_resolve_django_label(target)}'
|
|
625
|
+
print(f'[itw] Limiting run to{label}')
|
|
569
626
|
try:
|
|
570
627
|
ctx.run(
|
|
571
|
-
f'python -m coverage run manage.py test --settings={settings} --noinput -v 2',
|
|
628
|
+
f'python -m coverage run manage.py test{label} --settings={settings} --noinput -v 2',
|
|
572
629
|
warn=warn,
|
|
573
630
|
env={'PYTHONPATH': injected_pp},
|
|
574
631
|
)
|
|
575
632
|
finally:
|
|
576
633
|
terminate_stale_test_db_sessions(ctx, settings)
|
|
577
|
-
|
|
578
|
-
|
|
634
|
+
if target:
|
|
635
|
+
ctx.run('python -m coverage report -m --fail-under=0')
|
|
636
|
+
else:
|
|
637
|
+
ctx.run('python -m coverage report -m')
|
|
638
|
+
ctx.run('python -m coverage xml -o coverage.xml')
|
|
579
639
|
print("✓ Tests completed")
|
|
580
640
|
|
|
581
641
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!-- OPTIONAL -->
|
|
2
|
+
/glab_host <gitlab-host>
|
|
3
|
+
/glab_username <gitlab-username>
|
|
4
|
+
/glab_token <personal-access-token>
|
|
5
|
+
|
|
6
|
+
<!-- REQUIRED -->
|
|
7
|
+
/title <issue title>
|
|
8
|
+
|
|
9
|
+
<!-- OPTIONAL -->
|
|
10
|
+
/repo namespace/project
|
|
11
|
+
/milestone %"Milestone name"
|
|
12
|
+
/milestone-start YYYY-MM-DD
|
|
13
|
+
/milestone-end YYYY-MM-DD
|
|
14
|
+
/assignee @username
|
|
15
|
+
/estimate 2h
|
|
16
|
+
/due YYYY-MM-DD
|
|
17
|
+
|
|
18
|
+
<!-- OPTIONAL -->
|
|
19
|
+
## Acceptance Criteria
|
|
20
|
+
- [ ]
|
|
21
|
+
- [ ]
|
|
22
|
+
## Acceptance Criteria
|
|
23
|
+
|
|
24
|
+
<!-- OPTIONAL -->
|
|
25
|
+
## Comment
|
|
26
|
+
|
|
27
|
+
## Comment
|
{itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/SOURCES.txt
RENAMED
|
@@ -19,4 +19,5 @@ itw_python_builder.egg-info/top_level.txt
|
|
|
19
19
|
itw_python_builder/_pyruntime/sitecustomize.py
|
|
20
20
|
itw_python_builder/templates/new_version_email.html
|
|
21
21
|
itw_python_builder/templates/server.sitemap.snippet.ts
|
|
22
|
-
itw_python_builder/templates/sitemap.routes.ts
|
|
22
|
+
itw_python_builder/templates/sitemap.routes.ts
|
|
23
|
+
itw_python_builder/templates/task_template.md
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "itw_python_builder"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.12"
|
|
8
8
|
description = "Standardized Django deployment pipeline with Docker, testing, and SonarQube integration"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -41,7 +41,7 @@ Issues = "https://git.it-works.io/"
|
|
|
41
41
|
include-package-data = true
|
|
42
42
|
|
|
43
43
|
[tool.setuptools.package-data]
|
|
44
|
-
itw_python_builder = [".pylintrc", "templates/*.ts", "templates/*.html", "_pyruntime/*.py"]
|
|
44
|
+
itw_python_builder = [".pylintrc", "templates/*.ts", "templates/*.html", "templates/*.md", "_pyruntime/*.py"]
|
|
45
45
|
|
|
46
46
|
[project.scripts]
|
|
47
47
|
itw = "itw_python_builder.cli:main"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/requires.txt
RENAMED
|
File without changes
|
{itw_python_builder-0.2.11 → itw_python_builder-0.2.12}/itw_python_builder.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|