crackerjack 0.16.0__py3-none-any.whl → 0.17.0__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.
@@ -491,15 +491,11 @@ 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
- "--no-cov", # Disable coverage which can cause hanging
503
499
  "--capture=fd", # Capture stdout/stderr at file descriptor level
504
500
  "--tb=short", # Shorter traceback format
505
501
  "--no-header", # Reduce output noise
@@ -511,21 +507,15 @@ class Crackerjack:
511
507
  return test
512
508
 
513
509
  def _setup_test_environment(self) -> None:
514
- """Set environment variables for test execution."""
515
- # Set environment variables to improve asyncio behavior
516
510
  os.environ["PYTHONASYNCIO_DEBUG"] = "0" # Disable asyncio debug mode
517
511
  os.environ["RUNNING_UNDER_CRACKERJACK"] = "1" # Signal to conftest.py
518
-
519
- # Set asyncio mode to strict to help prevent hanging
520
512
  if "PYTEST_ASYNCIO_MODE" not in os.environ:
521
513
  os.environ["PYTEST_ASYNCIO_MODE"] = "strict"
522
514
 
523
515
  def _run_pytest_process(
524
516
  self, test_command: list[str]
525
517
  ) -> subprocess.CompletedProcess[str]:
526
- """Run pytest as a subprocess with timeout handling and output capture."""
527
518
  try:
528
- # Use a timeout to ensure the process doesn't hang indefinitely
529
519
  process = subprocess.Popen(
530
520
  test_command,
531
521
  stdout=subprocess.PIPE,
@@ -534,15 +524,10 @@ class Crackerjack:
534
524
  bufsize=1,
535
525
  universal_newlines=True,
536
526
  )
537
-
538
- # Set a timeout (5 minutes)
539
527
  timeout = 300
540
528
  start_time = time.time()
541
-
542
529
  stdout_data = []
543
530
  stderr_data = []
544
-
545
- # Read output while process is running, with timeout
546
531
  while process.poll() is None:
547
532
  if time.time() - start_time > timeout:
548
533
  self.console.print(
@@ -554,38 +539,28 @@ class Crackerjack:
554
539
  except subprocess.TimeoutExpired:
555
540
  process.kill()
556
541
  break
557
-
558
- # Read output without blocking
559
542
  if process.stdout:
560
543
  line = process.stdout.readline()
561
544
  if line:
562
545
  stdout_data.append(line)
563
546
  self.console.print(line, end="")
564
-
565
547
  if process.stderr:
566
548
  line = process.stderr.readline()
567
549
  if line:
568
550
  stderr_data.append(line)
569
551
  self.console.print(f"[red]{line}[/red]", end="")
570
-
571
552
  time.sleep(0.1)
572
-
573
- # Get any remaining output
574
553
  if process.stdout:
575
554
  for line in process.stdout:
576
555
  stdout_data.append(line)
577
556
  self.console.print(line, end="")
578
-
579
557
  if process.stderr:
580
558
  for line in process.stderr:
581
559
  stderr_data.append(line)
582
560
  self.console.print(f"[red]{line}[/red]", end="")
583
-
584
561
  returncode = process.returncode or 0
585
562
  stdout = "".join(stdout_data)
586
563
  stderr = "".join(stderr_data)
587
-
588
- # Create a CompletedProcess object to match the expected interface
589
564
  return subprocess.CompletedProcess(
590
565
  args=test_command, returncode=returncode, stdout=stdout, stderr=stderr
591
566
  )
@@ -597,13 +572,10 @@ class Crackerjack:
597
572
  def _report_test_results(
598
573
  self, result: subprocess.CompletedProcess[str], ai_agent: str
599
574
  ) -> None:
600
- """Report test results and handle AI agent output if needed."""
601
575
  if result.returncode > 0:
602
576
  if result.stderr:
603
577
  self.console.print(result.stderr)
604
-
605
578
  if ai_agent:
606
- # Use structured output for AI agents
607
579
  self.console.print(
608
580
  '[json]{"status": "failed", "action": "tests", "returncode": '
609
581
  + str(result.returncode)
@@ -614,35 +586,22 @@ class Crackerjack:
614
586
  raise SystemExit(1)
615
587
 
616
588
  if ai_agent:
617
- # Use structured output for AI agents
618
589
  self.console.print('[json]{"status": "success", "action": "tests"}[/json]')
619
590
  else:
620
591
  self.console.print("\n\n✅ Tests passed successfully!\n")
621
592
 
622
593
  def _run_tests(self, options: OptionsProtocol) -> None:
623
- """Run tests if the test option is enabled."""
624
594
  if options.test:
625
- # Check if we're being called by an AI agent
626
595
  ai_agent = os.environ.get("AI_AGENT", "")
627
-
628
596
  if ai_agent:
629
- # Use structured output for AI agents
630
597
  self.console.print(
631
598
  '[json]{"status": "running", "action": "tests"}[/json]'
632
599
  )
633
600
  else:
634
601
  self.console.print("\n\nRunning tests...\n")
635
-
636
- # Prepare the test command
637
602
  test_command = self._prepare_pytest_command(options)
638
-
639
- # Set up the test environment
640
603
  self._setup_test_environment()
641
-
642
- # Run the tests
643
604
  result = self._run_pytest_process(test_command)
644
-
645
- # Report the results
646
605
  self._report_test_results(result, ai_agent)
647
606
 
648
607
  def _bump_version(self, options: OptionsProtocol) -> None:
@@ -683,30 +642,21 @@ class Crackerjack:
683
642
  def _create_pull_request(self, options: OptionsProtocol) -> None:
684
643
  if options.create_pr:
685
644
  self.console.print("\nCreating pull request...")
686
-
687
- # Get the current branch name
688
645
  current_branch = self.execute_command(
689
646
  ["git", "branch", "--show-current"], capture_output=True, text=True
690
647
  ).stdout.strip()
691
-
692
- # Get the remote URL to determine if it's GitHub or GitLab
693
648
  remote_url = self.execute_command(
694
649
  ["git", "remote", "get-url", "origin"], capture_output=True, text=True
695
650
  ).stdout.strip()
696
-
697
- # Determine if we're using GitHub or GitLab
698
651
  is_github = "github.com" in remote_url
699
652
  is_gitlab = "gitlab.com" in remote_url
700
-
701
653
  if is_github:
702
- # Check if GitHub CLI is installed
703
654
  gh_installed = (
704
655
  self.execute_command(
705
656
  ["which", "gh"], capture_output=True, text=True
706
657
  ).returncode
707
658
  == 0
708
659
  )
709
-
710
660
  if not gh_installed:
711
661
  self.console.print(
712
662
  "\n[red]GitHub CLI (gh) is not installed. Please install it first:[/red]\n"
@@ -714,20 +664,15 @@ class Crackerjack:
714
664
  " or visit https://cli.github.com/ for other installation methods"
715
665
  )
716
666
  return
717
-
718
- # Check if user is authenticated with GitHub
719
667
  auth_status = self.execute_command(
720
668
  ["gh", "auth", "status"], capture_output=True, text=True
721
669
  ).returncode
722
-
723
670
  if auth_status != 0:
724
671
  self.console.print(
725
672
  "\n[red]You need to authenticate with GitHub first. Run:[/red]\n"
726
673
  " gh auth login"
727
674
  )
728
675
  return
729
-
730
- # Prompt for PR title and description
731
676
  pr_title = input("\nEnter a title for your pull request: ")
732
677
  self.console.print(
733
678
  "Enter a description for your pull request (press Ctrl+D when done):"
@@ -735,8 +680,6 @@ class Crackerjack:
735
680
  pr_description = ""
736
681
  with suppress(EOFError):
737
682
  pr_description = "".join(iter(input, ""))
738
-
739
- # Create the pull request
740
683
  self.console.print("Creating pull request to GitHub repository...")
741
684
  result = self.execute_command(
742
685
  [
@@ -751,7 +694,6 @@ class Crackerjack:
751
694
  capture_output=True,
752
695
  text=True,
753
696
  )
754
-
755
697
  if result.returncode == 0:
756
698
  self.console.print(
757
699
  f"\n[green]Pull request created successfully![/green]\n{result.stdout}"
@@ -760,16 +702,13 @@ class Crackerjack:
760
702
  self.console.print(
761
703
  f"\n[red]Failed to create pull request:[/red]\n{result.stderr}"
762
704
  )
763
-
764
705
  elif is_gitlab:
765
- # Check if GitLab CLI is installed
766
706
  glab_installed = (
767
707
  self.execute_command(
768
708
  ["which", "glab"], capture_output=True, text=True
769
709
  ).returncode
770
710
  == 0
771
711
  )
772
-
773
712
  if not glab_installed:
774
713
  self.console.print(
775
714
  "\n[red]GitLab CLI (glab) is not installed. Please install it first:[/red]\n"
@@ -777,20 +716,15 @@ class Crackerjack:
777
716
  " or visit https://gitlab.com/gitlab-org/cli for other installation methods"
778
717
  )
779
718
  return
780
-
781
- # Check if user is authenticated with GitLab
782
719
  auth_status = self.execute_command(
783
720
  ["glab", "auth", "status"], capture_output=True, text=True
784
721
  ).returncode
785
-
786
722
  if auth_status != 0:
787
723
  self.console.print(
788
724
  "\n[red]You need to authenticate with GitLab first. Run:[/red]\n"
789
725
  " glab auth login"
790
726
  )
791
727
  return
792
-
793
- # Prompt for MR title and description
794
728
  mr_title = input("\nEnter a title for your merge request: ")
795
729
  self.console.print(
796
730
  "Enter a description for your merge request (press Ctrl+D when done):"
@@ -798,8 +732,6 @@ class Crackerjack:
798
732
  mr_description = ""
799
733
  with suppress(EOFError):
800
734
  mr_description = "".join(iter(input, ""))
801
-
802
- # Create the merge request
803
735
  self.console.print("Creating merge request to GitLab repository...")
804
736
  result = self.execute_command(
805
737
  [
@@ -818,7 +750,6 @@ class Crackerjack:
818
750
  capture_output=True,
819
751
  text=True,
820
752
  )
821
-
822
753
  if result.returncode == 0:
823
754
  self.console.print(
824
755
  f"\n[green]Merge request created successfully![/green]\n{result.stdout}"
@@ -842,9 +773,7 @@ class Crackerjack:
842
773
  return execute(cmd, **kwargs)
843
774
 
844
775
  def process(self, options: OptionsProtocol) -> None:
845
- # Track actions performed for AI agent output
846
776
  actions_performed = []
847
-
848
777
  if options.all:
849
778
  options.clean = True
850
779
  options.test = True
@@ -892,9 +821,7 @@ class Crackerjack:
892
821
  if options.create_pr:
893
822
  actions_performed.append("create_pull_request")
894
823
 
895
- # Check if we're being called by an AI agent
896
824
  if getattr(options, "ai_agent", False):
897
- # Use structured output for AI agents
898
825
  import json
899
826
 
900
827
  result = {
@@ -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 = true
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.15.10"
155
+ version = "0.16.1"
154
156
  description = "Default template for PDM package"
155
157
  requires-python = ">=3.13"
156
158
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crackerjack
3
- Version: 0.16.0
3
+ Version: 0.17.0
4
4
  Summary: Default template for PDM package
5
5
  Keywords: black,ruff,mypy,creosote,refurb
6
6
  Author-Email: lesleslie <les@wedgwoodwebworks.com>
@@ -1,8 +1,7 @@
1
- crackerjack-0.16.0.dist-info/METADATA,sha256=MYUBgU4OZEhpRTkR7xgUq_kpY2tUPTKSfUxKneqzovI,13198
2
- crackerjack-0.16.0.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- crackerjack-0.16.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- crackerjack-0.16.0.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
5
- crackerjack/.coverage,sha256=dLzPzp72qZEXohNfxnOAlRwvM9dqF06-HoFqfvXZd1U,53248
1
+ crackerjack-0.17.0.dist-info/METADATA,sha256=eXJTW8gmXKHAaQEB42tfna-7KUMZY-L5SyR7P95--o8,13198
2
+ crackerjack-0.17.0.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ crackerjack-0.17.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ crackerjack-0.17.0.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=vY6TL3JxF2uAWURP-oNnw8Nni9A9uL8kJjfg0T4XF3o,224
27
+ crackerjack/.ruff_cache/0.11.8/530407680854991027,sha256=WX373h-OwsiDzy8IaHd9dYiGOw0Vtu0_pm-HL1PjEzQ,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=jZ-giToWrfXR13lIQfEN7pSd2T-F9WAkD5VkkOfuoEc,35451
59
- crackerjack/pyproject.toml,sha256=yC7E9G8aYuaOwlk59cmMW4atBjMzJDgDyeEkRmqkD4Q,4140
60
- crackerjack-0.16.0.dist-info/RECORD,,
57
+ crackerjack/crackerjack.py,sha256=4iZ5s4Qh0lW0RbVw2kziv6GhS5K5NBDb6i7k-rcJStY,33367
58
+ crackerjack/pyproject.toml,sha256=8analz1QJPGjDx-lyVuVoaWSr7MCQ17Ld_HVVLTszQw,4199
59
+ crackerjack-0.17.0.dist-info/RECORD,,
crackerjack/.coverage DELETED
Binary file