crackerjack 0.16.0__py3-none-any.whl → 0.16.1__py3-none-any.whl
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.
- crackerjack/.ruff_cache/0.11.8/530407680854991027 +0 -0
- crackerjack/crackerjack.py +0 -72
- crackerjack/pyproject.toml +5 -3
- {crackerjack-0.16.0.dist-info → crackerjack-0.16.1.dist-info}/METADATA +1 -1
- {crackerjack-0.16.0.dist-info → crackerjack-0.16.1.dist-info}/RECORD +8 -9
- crackerjack/.coverage +0 -0
- {crackerjack-0.16.0.dist-info → crackerjack-0.16.1.dist-info}/WHEEL +0 -0
- {crackerjack-0.16.0.dist-info → crackerjack-0.16.1.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.16.0.dist-info → crackerjack-0.16.1.dist-info}/licenses/LICENSE +0 -0
Binary file
|
crackerjack/crackerjack.py
CHANGED
@@ -491,12 +491,9 @@ class Crackerjack:
|
|
491
491
|
self.code_cleaner.clean_files(tests_dir)
|
492
492
|
|
493
493
|
def _prepare_pytest_command(self, options: OptionsProtocol) -> list[str]:
|
494
|
-
"""Prepare the pytest command with appropriate options."""
|
495
494
|
test = ["pytest"]
|
496
495
|
if options.verbose:
|
497
496
|
test.append("-v")
|
498
|
-
|
499
|
-
# Add optimized options for all packages to prevent hanging
|
500
497
|
test.extend(
|
501
498
|
[
|
502
499
|
"--no-cov", # Disable coverage which can cause hanging
|
@@ -511,21 +508,15 @@ class Crackerjack:
|
|
511
508
|
return test
|
512
509
|
|
513
510
|
def _setup_test_environment(self) -> None:
|
514
|
-
"""Set environment variables for test execution."""
|
515
|
-
# Set environment variables to improve asyncio behavior
|
516
511
|
os.environ["PYTHONASYNCIO_DEBUG"] = "0" # Disable asyncio debug mode
|
517
512
|
os.environ["RUNNING_UNDER_CRACKERJACK"] = "1" # Signal to conftest.py
|
518
|
-
|
519
|
-
# Set asyncio mode to strict to help prevent hanging
|
520
513
|
if "PYTEST_ASYNCIO_MODE" not in os.environ:
|
521
514
|
os.environ["PYTEST_ASYNCIO_MODE"] = "strict"
|
522
515
|
|
523
516
|
def _run_pytest_process(
|
524
517
|
self, test_command: list[str]
|
525
518
|
) -> subprocess.CompletedProcess[str]:
|
526
|
-
"""Run pytest as a subprocess with timeout handling and output capture."""
|
527
519
|
try:
|
528
|
-
# Use a timeout to ensure the process doesn't hang indefinitely
|
529
520
|
process = subprocess.Popen(
|
530
521
|
test_command,
|
531
522
|
stdout=subprocess.PIPE,
|
@@ -534,15 +525,10 @@ class Crackerjack:
|
|
534
525
|
bufsize=1,
|
535
526
|
universal_newlines=True,
|
536
527
|
)
|
537
|
-
|
538
|
-
# Set a timeout (5 minutes)
|
539
528
|
timeout = 300
|
540
529
|
start_time = time.time()
|
541
|
-
|
542
530
|
stdout_data = []
|
543
531
|
stderr_data = []
|
544
|
-
|
545
|
-
# Read output while process is running, with timeout
|
546
532
|
while process.poll() is None:
|
547
533
|
if time.time() - start_time > timeout:
|
548
534
|
self.console.print(
|
@@ -554,38 +540,28 @@ class Crackerjack:
|
|
554
540
|
except subprocess.TimeoutExpired:
|
555
541
|
process.kill()
|
556
542
|
break
|
557
|
-
|
558
|
-
# Read output without blocking
|
559
543
|
if process.stdout:
|
560
544
|
line = process.stdout.readline()
|
561
545
|
if line:
|
562
546
|
stdout_data.append(line)
|
563
547
|
self.console.print(line, end="")
|
564
|
-
|
565
548
|
if process.stderr:
|
566
549
|
line = process.stderr.readline()
|
567
550
|
if line:
|
568
551
|
stderr_data.append(line)
|
569
552
|
self.console.print(f"[red]{line}[/red]", end="")
|
570
|
-
|
571
553
|
time.sleep(0.1)
|
572
|
-
|
573
|
-
# Get any remaining output
|
574
554
|
if process.stdout:
|
575
555
|
for line in process.stdout:
|
576
556
|
stdout_data.append(line)
|
577
557
|
self.console.print(line, end="")
|
578
|
-
|
579
558
|
if process.stderr:
|
580
559
|
for line in process.stderr:
|
581
560
|
stderr_data.append(line)
|
582
561
|
self.console.print(f"[red]{line}[/red]", end="")
|
583
|
-
|
584
562
|
returncode = process.returncode or 0
|
585
563
|
stdout = "".join(stdout_data)
|
586
564
|
stderr = "".join(stderr_data)
|
587
|
-
|
588
|
-
# Create a CompletedProcess object to match the expected interface
|
589
565
|
return subprocess.CompletedProcess(
|
590
566
|
args=test_command, returncode=returncode, stdout=stdout, stderr=stderr
|
591
567
|
)
|
@@ -597,13 +573,10 @@ class Crackerjack:
|
|
597
573
|
def _report_test_results(
|
598
574
|
self, result: subprocess.CompletedProcess[str], ai_agent: str
|
599
575
|
) -> None:
|
600
|
-
"""Report test results and handle AI agent output if needed."""
|
601
576
|
if result.returncode > 0:
|
602
577
|
if result.stderr:
|
603
578
|
self.console.print(result.stderr)
|
604
|
-
|
605
579
|
if ai_agent:
|
606
|
-
# Use structured output for AI agents
|
607
580
|
self.console.print(
|
608
581
|
'[json]{"status": "failed", "action": "tests", "returncode": '
|
609
582
|
+ str(result.returncode)
|
@@ -614,35 +587,22 @@ class Crackerjack:
|
|
614
587
|
raise SystemExit(1)
|
615
588
|
|
616
589
|
if ai_agent:
|
617
|
-
# Use structured output for AI agents
|
618
590
|
self.console.print('[json]{"status": "success", "action": "tests"}[/json]')
|
619
591
|
else:
|
620
592
|
self.console.print("\n\n✅ Tests passed successfully!\n")
|
621
593
|
|
622
594
|
def _run_tests(self, options: OptionsProtocol) -> None:
|
623
|
-
"""Run tests if the test option is enabled."""
|
624
595
|
if options.test:
|
625
|
-
# Check if we're being called by an AI agent
|
626
596
|
ai_agent = os.environ.get("AI_AGENT", "")
|
627
|
-
|
628
597
|
if ai_agent:
|
629
|
-
# Use structured output for AI agents
|
630
598
|
self.console.print(
|
631
599
|
'[json]{"status": "running", "action": "tests"}[/json]'
|
632
600
|
)
|
633
601
|
else:
|
634
602
|
self.console.print("\n\nRunning tests...\n")
|
635
|
-
|
636
|
-
# Prepare the test command
|
637
603
|
test_command = self._prepare_pytest_command(options)
|
638
|
-
|
639
|
-
# Set up the test environment
|
640
604
|
self._setup_test_environment()
|
641
|
-
|
642
|
-
# Run the tests
|
643
605
|
result = self._run_pytest_process(test_command)
|
644
|
-
|
645
|
-
# Report the results
|
646
606
|
self._report_test_results(result, ai_agent)
|
647
607
|
|
648
608
|
def _bump_version(self, options: OptionsProtocol) -> None:
|
@@ -683,30 +643,21 @@ class Crackerjack:
|
|
683
643
|
def _create_pull_request(self, options: OptionsProtocol) -> None:
|
684
644
|
if options.create_pr:
|
685
645
|
self.console.print("\nCreating pull request...")
|
686
|
-
|
687
|
-
# Get the current branch name
|
688
646
|
current_branch = self.execute_command(
|
689
647
|
["git", "branch", "--show-current"], capture_output=True, text=True
|
690
648
|
).stdout.strip()
|
691
|
-
|
692
|
-
# Get the remote URL to determine if it's GitHub or GitLab
|
693
649
|
remote_url = self.execute_command(
|
694
650
|
["git", "remote", "get-url", "origin"], capture_output=True, text=True
|
695
651
|
).stdout.strip()
|
696
|
-
|
697
|
-
# Determine if we're using GitHub or GitLab
|
698
652
|
is_github = "github.com" in remote_url
|
699
653
|
is_gitlab = "gitlab.com" in remote_url
|
700
|
-
|
701
654
|
if is_github:
|
702
|
-
# Check if GitHub CLI is installed
|
703
655
|
gh_installed = (
|
704
656
|
self.execute_command(
|
705
657
|
["which", "gh"], capture_output=True, text=True
|
706
658
|
).returncode
|
707
659
|
== 0
|
708
660
|
)
|
709
|
-
|
710
661
|
if not gh_installed:
|
711
662
|
self.console.print(
|
712
663
|
"\n[red]GitHub CLI (gh) is not installed. Please install it first:[/red]\n"
|
@@ -714,20 +665,15 @@ class Crackerjack:
|
|
714
665
|
" or visit https://cli.github.com/ for other installation methods"
|
715
666
|
)
|
716
667
|
return
|
717
|
-
|
718
|
-
# Check if user is authenticated with GitHub
|
719
668
|
auth_status = self.execute_command(
|
720
669
|
["gh", "auth", "status"], capture_output=True, text=True
|
721
670
|
).returncode
|
722
|
-
|
723
671
|
if auth_status != 0:
|
724
672
|
self.console.print(
|
725
673
|
"\n[red]You need to authenticate with GitHub first. Run:[/red]\n"
|
726
674
|
" gh auth login"
|
727
675
|
)
|
728
676
|
return
|
729
|
-
|
730
|
-
# Prompt for PR title and description
|
731
677
|
pr_title = input("\nEnter a title for your pull request: ")
|
732
678
|
self.console.print(
|
733
679
|
"Enter a description for your pull request (press Ctrl+D when done):"
|
@@ -735,8 +681,6 @@ class Crackerjack:
|
|
735
681
|
pr_description = ""
|
736
682
|
with suppress(EOFError):
|
737
683
|
pr_description = "".join(iter(input, ""))
|
738
|
-
|
739
|
-
# Create the pull request
|
740
684
|
self.console.print("Creating pull request to GitHub repository...")
|
741
685
|
result = self.execute_command(
|
742
686
|
[
|
@@ -751,7 +695,6 @@ class Crackerjack:
|
|
751
695
|
capture_output=True,
|
752
696
|
text=True,
|
753
697
|
)
|
754
|
-
|
755
698
|
if result.returncode == 0:
|
756
699
|
self.console.print(
|
757
700
|
f"\n[green]Pull request created successfully![/green]\n{result.stdout}"
|
@@ -760,16 +703,13 @@ class Crackerjack:
|
|
760
703
|
self.console.print(
|
761
704
|
f"\n[red]Failed to create pull request:[/red]\n{result.stderr}"
|
762
705
|
)
|
763
|
-
|
764
706
|
elif is_gitlab:
|
765
|
-
# Check if GitLab CLI is installed
|
766
707
|
glab_installed = (
|
767
708
|
self.execute_command(
|
768
709
|
["which", "glab"], capture_output=True, text=True
|
769
710
|
).returncode
|
770
711
|
== 0
|
771
712
|
)
|
772
|
-
|
773
713
|
if not glab_installed:
|
774
714
|
self.console.print(
|
775
715
|
"\n[red]GitLab CLI (glab) is not installed. Please install it first:[/red]\n"
|
@@ -777,20 +717,15 @@ class Crackerjack:
|
|
777
717
|
" or visit https://gitlab.com/gitlab-org/cli for other installation methods"
|
778
718
|
)
|
779
719
|
return
|
780
|
-
|
781
|
-
# Check if user is authenticated with GitLab
|
782
720
|
auth_status = self.execute_command(
|
783
721
|
["glab", "auth", "status"], capture_output=True, text=True
|
784
722
|
).returncode
|
785
|
-
|
786
723
|
if auth_status != 0:
|
787
724
|
self.console.print(
|
788
725
|
"\n[red]You need to authenticate with GitLab first. Run:[/red]\n"
|
789
726
|
" glab auth login"
|
790
727
|
)
|
791
728
|
return
|
792
|
-
|
793
|
-
# Prompt for MR title and description
|
794
729
|
mr_title = input("\nEnter a title for your merge request: ")
|
795
730
|
self.console.print(
|
796
731
|
"Enter a description for your merge request (press Ctrl+D when done):"
|
@@ -798,8 +733,6 @@ class Crackerjack:
|
|
798
733
|
mr_description = ""
|
799
734
|
with suppress(EOFError):
|
800
735
|
mr_description = "".join(iter(input, ""))
|
801
|
-
|
802
|
-
# Create the merge request
|
803
736
|
self.console.print("Creating merge request to GitLab repository...")
|
804
737
|
result = self.execute_command(
|
805
738
|
[
|
@@ -818,7 +751,6 @@ class Crackerjack:
|
|
818
751
|
capture_output=True,
|
819
752
|
text=True,
|
820
753
|
)
|
821
|
-
|
822
754
|
if result.returncode == 0:
|
823
755
|
self.console.print(
|
824
756
|
f"\n[green]Merge request created successfully![/green]\n{result.stdout}"
|
@@ -842,9 +774,7 @@ class Crackerjack:
|
|
842
774
|
return execute(cmd, **kwargs)
|
843
775
|
|
844
776
|
def process(self, options: OptionsProtocol) -> None:
|
845
|
-
# Track actions performed for AI agent output
|
846
777
|
actions_performed = []
|
847
|
-
|
848
778
|
if options.all:
|
849
779
|
options.clean = True
|
850
780
|
options.test = True
|
@@ -892,9 +822,7 @@ class Crackerjack:
|
|
892
822
|
if options.create_pr:
|
893
823
|
actions_performed.append("create_pull_request")
|
894
824
|
|
895
|
-
# Check if we're being called by an AI agent
|
896
825
|
if getattr(options, "ai_agent", False):
|
897
|
-
# Use structured output for AI agents
|
898
826
|
import json
|
899
827
|
|
900
828
|
result = {
|
crackerjack/pyproject.toml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[tool.pytest.ini_options]
|
2
|
-
addopts = "--cov=crackerjack"
|
2
|
+
addopts = "--cov=crackerjack --cov-report=term"
|
3
3
|
asyncio_default_fixture_loop_scope = "function"
|
4
4
|
python_files = ["test_*.py", "*_test.py"]
|
5
5
|
asyncio_mode = "auto"
|
@@ -8,8 +8,10 @@ python_classes = ["Test*"]
|
|
8
8
|
python_functions = ["test_*"]
|
9
9
|
|
10
10
|
[tool.coverage.run]
|
11
|
-
branch =
|
11
|
+
branch = false
|
12
12
|
source = ["crackerjack"]
|
13
|
+
data_file = ".coverage"
|
14
|
+
parallel = false
|
13
15
|
omit = [
|
14
16
|
"*/tests/*",
|
15
17
|
"*/site-packages/*",
|
@@ -150,7 +152,7 @@ pythonPlatform = "Darwin"
|
|
150
152
|
|
151
153
|
[project]
|
152
154
|
name = "crackerjack"
|
153
|
-
version = "0.
|
155
|
+
version = "0.16.0"
|
154
156
|
description = "Default template for PDM package"
|
155
157
|
requires-python = ">=3.13"
|
156
158
|
readme = "README.md"
|
@@ -1,8 +1,7 @@
|
|
1
|
-
crackerjack-0.16.
|
2
|
-
crackerjack-0.16.
|
3
|
-
crackerjack-0.16.
|
4
|
-
crackerjack-0.16.
|
5
|
-
crackerjack/.coverage,sha256=dLzPzp72qZEXohNfxnOAlRwvM9dqF06-HoFqfvXZd1U,53248
|
1
|
+
crackerjack-0.16.1.dist-info/METADATA,sha256=LcPI6pQw65EjvvvfYskS2uXl5dYBwr9-gKrnDv1E_7A,13198
|
2
|
+
crackerjack-0.16.1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
crackerjack-0.16.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.16.1.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
6
5
|
crackerjack/.gitignore,sha256=oho3dNx7a7y36_y9AsalCkssU4in0MMsNAANWdc-h1c,153
|
7
6
|
crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
|
8
7
|
crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
|
@@ -25,7 +24,7 @@ crackerjack/.ruff_cache/0.11.4/9818742842212983150,sha256=QF9j6-3MH_d0pDNotdbF2h
|
|
25
24
|
crackerjack/.ruff_cache/0.11.6/3557596832929915217,sha256=yR2iXWDkSHVRw2eTiaCE8Eh34JPRUGc8vE3HYEEBk9k,224
|
26
25
|
crackerjack/.ruff_cache/0.11.7/10386934055395314831,sha256=lBNwN5zAgM4OzbkXIOzCczUtfooATrD10htj9ASlFkc,224
|
27
26
|
crackerjack/.ruff_cache/0.11.7/3557596832929915217,sha256=fKlwUbsvT3YIKV6UR-aA_i64lLignWeVfVu-MMmVbU0,207
|
28
|
-
crackerjack/.ruff_cache/0.11.8/530407680854991027,sha256=
|
27
|
+
crackerjack/.ruff_cache/0.11.8/530407680854991027,sha256=YcYcc-evwInMm79oLuKBlIm6Ppm5dvfCMyEU6FChvdM,224
|
29
28
|
crackerjack/.ruff_cache/0.2.0/10047773857155985907,sha256=j9LNa_RQ4Plor7go1uTYgz17cEENKvZQ-dP6b9MX0ik,248
|
30
29
|
crackerjack/.ruff_cache/0.2.1/8522267973936635051,sha256=u_aPBMibtAp_iYvLwR88GMAECMcIgHezxMyuapmU2P4,248
|
31
30
|
crackerjack/.ruff_cache/0.2.2/18053836298936336950,sha256=Xb_ebP0pVuUfSqPEZKlhQ70so_vqkEfMYpuHQ06iR5U,248
|
@@ -55,6 +54,6 @@ crackerjack/.ruff_cache/0.9.9/8843823720003377982,sha256=e4ymkXfQsUg5e_mtO34xTsa
|
|
55
54
|
crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
56
55
|
crackerjack/__init__.py,sha256=r9SuEjHUrW99hFWifRk4ofmYPSgf9rblcnzqhdV5bP0,157
|
57
56
|
crackerjack/__main__.py,sha256=O2BZxkwH8FKIhQJyWEaLAxvFT2pRGSyr4J7nXpDKV9U,4291
|
58
|
-
crackerjack/crackerjack.py,sha256=
|
59
|
-
crackerjack/pyproject.toml,sha256=
|
60
|
-
crackerjack-0.16.
|
57
|
+
crackerjack/crackerjack.py,sha256=opucnTRRlBfV4jU5qZcHS7p4R9yuS3Tl7mcAD7JRNO4,33439
|
58
|
+
crackerjack/pyproject.toml,sha256=s_hdetdy4oH4zIQ8VdZVr8yUPWi-WIIOKEyhQuHSwsI,4199
|
59
|
+
crackerjack-0.16.1.dist-info/RECORD,,
|
crackerjack/.coverage
DELETED
Binary file
|
File without changes
|
File without changes
|
File without changes
|