gha-utils 4.18.0__py3-none-any.whl → 4.19.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.

Potentially problematic release.


This version of gha-utils might be problematic. Click here for more details.

gha_utils/__init__.py CHANGED
@@ -17,4 +17,4 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- __version__ = "4.18.0"
20
+ __version__ = "4.19.0"
gha_utils/matrix.py CHANGED
@@ -47,18 +47,18 @@ class Matrix:
47
47
  matrix.
48
48
  """
49
49
 
50
- def __init__(self, *args, **kwargs):
51
- self.variations: dict = {}
50
+ def __init__(self, *args, **kwargs) -> None:
51
+ self.variations: dict[str, tuple[str, ...]] = {}
52
52
 
53
53
  # Tuples are used to keep track of the insertion order and force immutability.
54
54
  self.include: tuple[dict[str, str], ...] = tuple()
55
55
  self.exclude: tuple[dict[str, str], ...] = tuple()
56
56
 
57
- self._job_counter = None
57
+ self._job_counter: int = 0
58
58
 
59
59
  def matrix(
60
60
  self, ignore_includes: bool = False, ignore_excludes: bool = False
61
- ) -> FrozenDict[str, str]:
61
+ ) -> FrozenDict[str, tuple[str, ...] | tuple[dict[str, str], ...]]:
62
62
  """Returns a copy of the matrix.
63
63
 
64
64
  The special ``include`` and ``excludes`` directives will be added by default.
@@ -66,9 +66,9 @@ class Matrix:
66
66
  """
67
67
  dict_copy = self.variations.copy()
68
68
  if not ignore_includes and self.include:
69
- dict_copy["include"] = self.include
69
+ dict_copy["include"] = self.include # type: ignore[assignment]
70
70
  if not ignore_excludes and self.exclude:
71
- dict_copy["exclude"] = self.exclude
71
+ dict_copy["exclude"] = self.exclude # type: ignore[assignment]
72
72
  return FrozenDict(dict_copy)
73
73
 
74
74
  def __repr__(self) -> str:
gha_utils/metadata.py CHANGED
@@ -166,11 +166,11 @@ from random import randint
166
166
  from re import escape
167
167
  from typing import Any, Final, cast
168
168
 
169
+ import gitignore_parser
169
170
  from bumpversion.config import get_configuration # type: ignore[import-untyped]
170
171
  from bumpversion.config.files import find_config_file # type: ignore[import-untyped]
171
172
  from bumpversion.show import resolve_name # type: ignore[import-untyped]
172
173
  from extra_platforms import is_github_ci
173
- from gitignore_parser import parse_gitignore
174
174
  from packaging.specifiers import SpecifierSet
175
175
  from packaging.version import Version
176
176
  from pydriller import Commit, Git, Repository # type: ignore[import-untyped]
@@ -352,7 +352,7 @@ MYPY_VERSION_MIN: Final = (3, 8)
352
352
  class JSONMetadata(json.JSONEncoder):
353
353
  """Custom JSON encoder for metadata serialization."""
354
354
 
355
- def default(self, o: Any) -> str:
355
+ def default(self, o: Any) -> Any:
356
356
  if isinstance(o, Matrix):
357
357
  return o.matrix()
358
358
 
@@ -372,9 +372,6 @@ class Metadata:
372
372
  self.unstable_targets = set(unstable_targets)
373
373
  assert self.unstable_targets.issubset(NUITKA_BUILD_TARGETS)
374
374
 
375
- # None indicates the is_python_project variable has not been evaluated yet.
376
- self._is_python_project: bool | None = None
377
-
378
375
  pyproject_path = Path() / "pyproject.toml"
379
376
  sphinx_conf_path = Path() / "docs" / "conf.py"
380
377
 
@@ -592,11 +589,15 @@ class Metadata:
592
589
  events.
593
590
 
594
591
  .. seealso::
595
-
596
592
  - https://stackoverflow.com/a/67204539
597
593
  - https://stackoverflow.com/a/62953566
598
594
  - https://stackoverflow.com/a/61861763
599
595
 
596
+ .. seealso::
597
+ Pull request events on GitHub are a bit complex, see: `The Many SHAs of a
598
+ GitHub Pull Request
599
+ <https://www.kenmuse.com/blog/the-many-shas-of-a-github-pull-request/>`_.
600
+
600
601
  .. todo::
601
602
  Refactor so we can get rid of ``self.github_context``. Maybe there's enough
602
603
  metadata lying around in the environment variables that we can inspect the
@@ -657,11 +658,7 @@ class Metadata:
657
658
  @cached_property
658
659
  def new_commits_hash(self) -> tuple[str, ...] | None:
659
660
  """List all hashes of new commits."""
660
- return (
661
- cast(tuple[str, ...], self.new_commits_matrix["commit"])
662
- if self.new_commits_matrix
663
- else None
664
- )
661
+ return self.new_commits_matrix["commit"] if self.new_commits_matrix else None
665
662
 
666
663
  @cached_property
667
664
  def release_commits(self) -> tuple[Commit, ...] | None:
@@ -695,7 +692,7 @@ class Metadata:
695
692
  def release_commits_hash(self) -> tuple[str, ...] | None:
696
693
  """List all hashes of release commits."""
697
694
  return (
698
- cast(tuple[str, ...], self.release_commits_matrix["commit"])
695
+ self.release_commits_matrix["commit"]
699
696
  if self.release_commits_matrix
700
697
  else None
701
698
  )
@@ -737,7 +734,7 @@ class Metadata:
737
734
  gitignore = None
738
735
  if self.gitignore_exists:
739
736
  logging.debug(f"Load {GITIGNORE_PATH} to filter out ignored files.")
740
- gitignore = parse_gitignore(GITIGNORE_PATH)
737
+ gitignore = gitignore_parser.parse_gitignore(GITIGNORE_PATH)
741
738
 
742
739
  for file_path in iglob(
743
740
  patterns,
@@ -785,41 +782,35 @@ class Metadata:
785
782
  """Returns a list of doc files."""
786
783
  return self.glob_files("**/*.{md,markdown,rst,tex}", "!.venv/**")
787
784
 
788
- @property
785
+ @cached_property
789
786
  def is_python_project(self):
790
787
  """Returns ``True`` if repository is a Python project.
791
788
 
792
- Presence of a ``pyproject.toml`` file is not enough, as 3rd party tools can use
793
- that file to store their own configuration.
794
- """
795
- return self._is_python_project
796
-
797
- @is_python_project.getter
798
- def is_python_project(self):
799
- """Try to read and validate the ``pyproject.toml`` file on access to the
800
- ``is_python_project`` property.
789
+ Presence of a ``pyproject.toml`` file that respects the standards is enough
790
+ to consider the project as a Python one.
801
791
  """
802
- if self._is_python_project is None:
803
- self.pyproject
804
- return self._is_python_project
792
+ return False if self.pyproject is None else True
805
793
 
806
794
  @cached_property
807
795
  def pyproject(self) -> StandardMetadata | None:
808
796
  """Returns metadata stored in the ``pyproject.toml`` file.
809
797
 
810
- Also sets the internal ``_is_python_project`` value to ``True`` if the
811
- ``pyproject.toml`` exists and respects the standards. ``False`` otherwise.
798
+ Returns ``None`` if the ``pyproject.toml`` does not exists or does not respects
799
+ the PEP standards.
800
+
801
+ .. warning::
802
+ Some third-party apps have their configuration saved into
803
+ ``pyproject.toml`` file, but that does not means the project is a Python
804
+ one. For that, the ``pyproject.toml`` needs to respect the PEPs.
812
805
  """
813
806
  if self.pyproject_path.exists() and self.pyproject_path.is_file():
814
807
  toml = tomllib.loads(self.pyproject_path.read_text(encoding="UTF-8"))
815
808
  try:
816
809
  metadata = StandardMetadata.from_pyproject(toml)
817
- self._is_python_project = True
818
810
  return metadata
819
811
  except ConfigurationError:
820
812
  pass
821
813
 
822
- self._is_python_project = False
823
814
  return None
824
815
 
825
816
  @cached_property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gha-utils
3
- Version: 4.18.0
3
+ Version: 4.19.0
4
4
  Summary: ⚙️ CLI helpers for GitHub Actions + reuseable workflows
5
5
  Author-email: Kevin Deldycke <kevin@deldycke.com>
6
6
  Project-URL: Homepage, https://github.com/kdeldycke/workflows
@@ -46,9 +46,9 @@ Requires-Python: >=3.11
46
46
  Description-Content-Type: text/markdown
47
47
  Requires-Dist: boltons>=24.0.0
48
48
  Requires-Dist: bump-my-version<1.1.1,>=0.32.2
49
- Requires-Dist: click-extra~=5.0.2
49
+ Requires-Dist: click-extra~=5.1.1
50
50
  Requires-Dist: extra-platforms~=3.2.0
51
- Requires-Dist: gitignore-parser~=0.1.12
51
+ Requires-Dist: gitignore-parser~=0.1.13
52
52
  Requires-Dist: packaging~=25.0
53
53
  Requires-Dist: PyDriller~=2.6
54
54
  Requires-Dist: pyproject-metadata~=0.9.0
@@ -58,10 +58,11 @@ Provides-Extra: test
58
58
  Requires-Dist: coverage[toml]~=7.10.0; extra == "test"
59
59
  Requires-Dist: pytest~=8.4.0; extra == "test"
60
60
  Requires-Dist: pytest-cases~=3.9.1; extra == "test"
61
- Requires-Dist: pytest-cov~=6.2.1; extra == "test"
61
+ Requires-Dist: pytest-cov~=7.0.0; extra == "test"
62
62
  Requires-Dist: pytest-github-actions-annotate-failures~=0.3.0; extra == "test"
63
- Requires-Dist: pytest-randomly~=3.16.0; extra == "test"
63
+ Requires-Dist: pytest-randomly~=4.0.0; extra == "test"
64
64
  Provides-Extra: typing
65
+ Requires-Dist: types-boltons~=25.0.0.20250822; extra == "typing"
65
66
  Requires-Dist: types-PyYAML~=6.0.12.9; extra == "typing"
66
67
 
67
68
  # `gha-utils` CLI + reusable workflows
@@ -162,16 +163,11 @@ $ file ./gha-utils-*
162
163
 
163
164
  ### Development version
164
165
 
165
- To play with the latest development version of `gha-utils`, you can install it directly from the repository:
166
+ To play with the latest development version of `gha-utils`, you can run it directly from the repository:
166
167
 
167
168
  ```shell-session
168
- $ git clone https://github.com/kdeldycke/workflows
169
- $ cd workflows
170
- $ python -m pip install uv
171
- $ uv venv
172
- $ source .venv/bin/activate
173
- $ uv sync
174
- $ uv run -- gha-utils
169
+ $ uvx --from git+https://github.com/kdeldycke/workflows -- gha-utils --version
170
+ gha-utils, version 4.18.2
175
171
  ```
176
172
 
177
173
  ## Reusable workflows collection
@@ -333,19 +329,19 @@ A [detailed changelog](changelog.md) is available.
333
329
 
334
330
  Check these projects to get real-life examples of usage and inspiration:
335
331
 
336
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-falsehood?label=%E2%AD%90&style=flat-square) [Awesome Falsehood](https://github.com/kdeldycke/awesome-falsehood#readme) - Falsehoods Programmers Believe in.
337
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-engineering-team-management?label=%E2%AD%90&style=flat-square) [Awesome Engineering Team Management](https://github.com/kdeldycke/awesome-engineering-team-management#readme) - How to transition from software development to engineering management.
338
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-iam?label=%E2%AD%90&style=flat-square) [Awesome IAM](https://github.com/kdeldycke/awesome-iam#readme) - Identity and Access Management knowledge for cloud platforms.
339
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-billing?label=%E2%AD%90&style=flat-square) [Awesome Billing](https://github.com/kdeldycke/awesome-billing#readme) - Billing & Payments knowledge for cloud platforms.
340
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/meta-package-manager?label=%E2%AD%90&style=flat-square) [Meta Package Manager](https://github.com/kdeldycke/meta-package-manager#readme) - A unifying CLI for multiple package managers.
341
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/mail-deduplicate?label=%E2%AD%90&style=flat-square) [Mail Deduplicate](https://github.com/kdeldycke/mail-deduplicate#readme) - A CLI to deduplicate similar emails.
342
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/dotfiles?label=%E2%AD%90&style=flat-square) [dotfiles](https://github.com/kdeldycke/dotfiles#readme) - macOS dotfiles for Python developers.
343
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/click-extra?label=%E2%AD%90&style=flat-square) [Click Extra](https://github.com/kdeldycke/click-extra#readme) - Extra colorization and configuration loading for Click.
344
- - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/wikibot?label=%E2%AD%90&style=flat-square) [Wiki bot](https://github.com/themagicalmammal/wikibot#readme) - A bot which provides features from Wikipedia like summary, title searches, location API etc.
345
- - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/workflows?label=%E2%AD%90&style=flat-square) [workflows](https://github.com/kdeldycke/workflows#readme) - Itself. Eat your own dog-food.
346
- - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/stock-analyser?label=%E2%AD%90&style=flat-square) [Stock Analysis](https://github.com/themagicalmammal/stock-analyser#readme) - Simple to use interfaces for basic technical analysis of stocks.
347
- - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/genetictabler?label=%E2%AD%90&style=flat-square) [GeneticTabler](https://github.com/themagicalmammal/genetictabler#readme) - Time Table Scheduler using Genetic Algorithms.
348
- - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/excel-write?label=%E2%AD%90&style=flat-square) [Excel Write](https://github.com/themagicalmammal/excel-write#readme) - Optimised way to write in excel files.
332
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-falsehood?label=%E2%AD%90&style=flat-square) [Awesome Falsehood](https://github.com/kdeldycke/awesome-falsehood) - Falsehoods Programmers Believe in.
333
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-engineering-team-management?label=%E2%AD%90&style=flat-square) [Awesome Engineering Team Management](https://github.com/kdeldycke/awesome-engineering-team-management) - How to transition from software development to engineering management.
334
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-iam?label=%E2%AD%90&style=flat-square) [Awesome IAM](https://github.com/kdeldycke/awesome-iam) - Identity and Access Management knowledge for cloud platforms.
335
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/awesome-billing?label=%E2%AD%90&style=flat-square) [Awesome Billing](https://github.com/kdeldycke/awesome-billing) - Billing & Payments knowledge for cloud platforms.
336
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/meta-package-manager?label=%E2%AD%90&style=flat-square) [Meta Package Manager](https://github.com/kdeldycke/meta-package-manager) - A unifying CLI for multiple package managers.
337
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/mail-deduplicate?label=%E2%AD%90&style=flat-square) [Mail Deduplicate](https://github.com/kdeldycke/mail-deduplicate) - A CLI to deduplicate similar emails.
338
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/dotfiles?label=%E2%AD%90&style=flat-square) [dotfiles](https://github.com/kdeldycke/dotfiles) - macOS dotfiles for Python developers.
339
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/click-extra?label=%E2%AD%90&style=flat-square) [Click Extra](https://github.com/kdeldycke/click-extra) - Extra colorization and configuration loading for Click.
340
+ - ![GitHub stars](https://img.shields.io/github/stars/kdeldycke/workflows?label=%E2%AD%90&style=flat-square) [workflows](https://github.com/kdeldycke/workflows) - Itself. Eat your own dog-food.
341
+ - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/wikibot?label=%E2%AD%90&style=flat-square) [Wiki bot](https://github.com/themagicalmammal/wikibot) - A bot which provides features from Wikipedia like summary, title searches, location API etc.
342
+ - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/stock-analyser?label=%E2%AD%90&style=flat-square) [Stock Analysis](https://github.com/themagicalmammal/stock-analyser) - Simple to use interfaces for basic technical analysis of stocks.
343
+ - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/genetictabler?label=%E2%AD%90&style=flat-square) [GeneticTabler](https://github.com/themagicalmammal/genetictabler) - Time Table Scheduler using Genetic Algorithms.
344
+ - ![GitHub stars](https://img.shields.io/github/stars/themagicalmammal/excel-write?label=%E2%AD%90&style=flat-square) [Excel Write](https://github.com/themagicalmammal/excel-write) - Optimised way to write in excel files.
349
345
 
350
346
  Feel free to send a PR to add your project in this list if you are relying on these scripts.
351
347
 
@@ -0,0 +1,14 @@
1
+ gha_utils/__init__.py,sha256=bEngs6FLDcIl_HHmlBzsaQaFhTdsUS8V63134NzUghI,866
2
+ gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
3
+ gha_utils/changelog.py,sha256=JR7iQrWjLoIOpVNe6iXQSyEii82_hM_zrYpR7QO_Uxo,5777
4
+ gha_utils/cli.py,sha256=jmrSI05qfrkxcB3fQuiB6xf4eumXqg-MBiCITdeW104,15273
5
+ gha_utils/mailmap.py,sha256=g3LQiPNjHsAgCbEYOJcQwdlXqxzmFh697vv2sxHZq-s,7014
6
+ gha_utils/matrix.py,sha256=eBAU3bKrCif7FQ74EWhK_AwDcNUkGp8Om1NtlFdYJpI,12431
7
+ gha_utils/metadata.py,sha256=lAnBC2p17cwpgzpTFw5qYjqvI29wsWtvMlBx4B3rFc4,53791
8
+ gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ gha_utils/test_plan.py,sha256=AE8Mf1vSQG5EZTytoTts-gzMwUg2Zy21gUwkMlzXT94,13394
10
+ gha_utils-4.19.0.dist-info/METADATA,sha256=1Rf8_8osaqLptLSoPxjPcXie67O47B7Qm_u5F_qYIwY,21212
11
+ gha_utils-4.19.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ gha_utils-4.19.0.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
13
+ gha_utils-4.19.0.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
14
+ gha_utils-4.19.0.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- gha_utils/__init__.py,sha256=KNIydaZSQDWkUZrmo5UJzpgBt-OmcHis97wXDtM0gu8,866
2
- gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
3
- gha_utils/changelog.py,sha256=JR7iQrWjLoIOpVNe6iXQSyEii82_hM_zrYpR7QO_Uxo,5777
4
- gha_utils/cli.py,sha256=jmrSI05qfrkxcB3fQuiB6xf4eumXqg-MBiCITdeW104,15273
5
- gha_utils/mailmap.py,sha256=g3LQiPNjHsAgCbEYOJcQwdlXqxzmFh697vv2sxHZq-s,7014
6
- gha_utils/matrix.py,sha256=4WM2ORH3n-Ohi3q6XnmAA2PtOdpLvhwaePy6kmlClmQ,12302
7
- gha_utils/metadata.py,sha256=-b6R7UjleS1Y6HA7aA0Z7q4LfMky-lXuzuzBZjGpkTw,53970
8
- gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- gha_utils/test_plan.py,sha256=AE8Mf1vSQG5EZTytoTts-gzMwUg2Zy21gUwkMlzXT94,13394
10
- gha_utils-4.18.0.dist-info/METADATA,sha256=ySyh9n8_a3brTZFPiMn6tldA3calXtlEXT3gb44h8yg,21301
11
- gha_utils-4.18.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- gha_utils-4.18.0.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
13
- gha_utils-4.18.0.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
14
- gha_utils-4.18.0.dist-info/RECORD,,