winipedia-utils 0.5.29__py3-none-any.whl → 0.6.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.
Potentially problematic release.
This version of winipedia-utils might be problematic. Click here for more details.
- winipedia_utils/git/github/workflows/base/base.py +24 -4
- winipedia_utils/git/pre_commit/hooks.py +46 -5
- winipedia_utils/git/pre_commit/run_hooks.py +3 -5
- {winipedia_utils-0.5.29.dist-info → winipedia_utils-0.6.1.dist-info}/METADATA +23 -16
- {winipedia_utils-0.5.29.dist-info → winipedia_utils-0.6.1.dist-info}/RECORD +7 -7
- {winipedia_utils-0.5.29.dist-info → winipedia_utils-0.6.1.dist-info}/WHEEL +0 -0
- {winipedia_utils-0.5.29.dist-info → winipedia_utils-0.6.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -441,6 +441,19 @@ class Workflow(YamlConfigFile):
|
|
|
441
441
|
step=step,
|
|
442
442
|
)
|
|
443
443
|
|
|
444
|
+
@classmethod
|
|
445
|
+
def step_patch_version(
|
|
446
|
+
cls,
|
|
447
|
+
*,
|
|
448
|
+
step: dict[str, Any] | None = None,
|
|
449
|
+
) -> dict[str, Any]:
|
|
450
|
+
"""Get the patch version step."""
|
|
451
|
+
return cls.get_step(
|
|
452
|
+
step_func=cls.step_patch_version,
|
|
453
|
+
run="poetry version patch && git add pyproject.toml",
|
|
454
|
+
step=step,
|
|
455
|
+
)
|
|
456
|
+
|
|
444
457
|
@classmethod
|
|
445
458
|
def step_checkout_repository(
|
|
446
459
|
cls,
|
|
@@ -596,10 +609,15 @@ class Workflow(YamlConfigFile):
|
|
|
596
609
|
*,
|
|
597
610
|
step: dict[str, Any] | None = None,
|
|
598
611
|
) -> dict[str, Any]:
|
|
599
|
-
"""Get the run pre-commit hooks step.
|
|
612
|
+
"""Get the run pre-commit hooks step.
|
|
613
|
+
|
|
614
|
+
Patching version is useful to have at least a minimal version bump when
|
|
615
|
+
creating a release and it also makes sure git stash pop does not fail when
|
|
616
|
+
there are no changes.
|
|
617
|
+
"""
|
|
600
618
|
return cls.get_step(
|
|
601
619
|
step_func=cls.step_run_pre_commit_hooks,
|
|
602
|
-
run="poetry run pre-commit run --all-files --verbose",
|
|
620
|
+
run="poetry version patch && git add pyproject.toml && poetry run pre-commit run --all-files --verbose", # noqa: E501
|
|
603
621
|
env={"REPO_TOKEN": cls.insert_repo_token()},
|
|
604
622
|
step=step,
|
|
605
623
|
)
|
|
@@ -707,6 +725,7 @@ class Workflow(YamlConfigFile):
|
|
|
707
725
|
with_: dict[str, Any] = {"path": str(path)}
|
|
708
726
|
if name is not None:
|
|
709
727
|
with_["name"] = name
|
|
728
|
+
with_["merge-multiple"] = "true"
|
|
710
729
|
return cls.get_step(
|
|
711
730
|
step_func=cls.step_download_artifacts,
|
|
712
731
|
uses="actions/download-artifact@main",
|
|
@@ -749,12 +768,13 @@ class Workflow(YamlConfigFile):
|
|
|
749
768
|
artifacts_pattern: str = ARTIFACTS_PATTERN,
|
|
750
769
|
) -> dict[str, Any]:
|
|
751
770
|
"""Get the create release step."""
|
|
771
|
+
version = cls.insert_version_from_extract_version_step()
|
|
752
772
|
return cls.get_step(
|
|
753
773
|
step_func=cls.step_create_release,
|
|
754
774
|
uses="ncipollo/release-action@main",
|
|
755
775
|
with_={
|
|
756
|
-
"tag":
|
|
757
|
-
"name": f"{cls.insert_repository_name()} {
|
|
776
|
+
"tag": version,
|
|
777
|
+
"name": f"{cls.insert_repository_name()} {version}",
|
|
758
778
|
"body": cls.insert_changelog(),
|
|
759
779
|
cls.ARTIFACTS_FOLDER: artifacts_pattern,
|
|
760
780
|
},
|
|
@@ -13,13 +13,54 @@ from winipedia_utils.projects.poetry.poetry import (
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
"""
|
|
16
|
+
def fetch_latest_changes() -> list[str]:
|
|
17
|
+
"""Fetch the latest changes from origin.
|
|
18
18
|
|
|
19
|
-
This function returns the input for subprocess.run() to
|
|
20
|
-
|
|
19
|
+
This function returns the input for subprocess.run() to fetch the latest
|
|
20
|
+
changes from origin.
|
|
21
21
|
"""
|
|
22
|
-
return [
|
|
22
|
+
return ["git", "fetch", "origin"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def stash_changes() -> list[str]:
|
|
26
|
+
"""Stash the changes.
|
|
27
|
+
|
|
28
|
+
This function returns the input for subprocess.run() to stash the changes.
|
|
29
|
+
"""
|
|
30
|
+
return [
|
|
31
|
+
"git",
|
|
32
|
+
"stash",
|
|
33
|
+
"push",
|
|
34
|
+
"-m",
|
|
35
|
+
"WIP: Temporarily stashed changes before rebasing",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def rebase_on_main() -> list[str]:
|
|
40
|
+
"""Rebase the current branch on origin/main.
|
|
41
|
+
|
|
42
|
+
This function returns the input for subprocess.run() to rebase the current
|
|
43
|
+
branch on origin/main.
|
|
44
|
+
"""
|
|
45
|
+
return ["git", "rebase", "origin/main"]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def pop_stashed_changes() -> list[str]:
|
|
49
|
+
"""Pop the stashed changes.
|
|
50
|
+
|
|
51
|
+
This function returns the input for subprocess.run() to pop the stashed changes.
|
|
52
|
+
"""
|
|
53
|
+
return ["git", "stash", "pop"]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def add_popped_stash_to_git() -> list[str]:
|
|
57
|
+
"""Add the unstashed changes to git.
|
|
58
|
+
|
|
59
|
+
This function returns the input for subprocess.run() to add the unstashed
|
|
60
|
+
changes to git.
|
|
61
|
+
We must do git add . because unstashing unadds the changes and pre-commit fails
|
|
62
|
+
"""
|
|
63
|
+
return ["git", "add", "."]
|
|
23
64
|
|
|
24
65
|
|
|
25
66
|
def add_version_patch_to_git() -> list[str]:
|
|
@@ -19,7 +19,6 @@ def run_hooks() -> None:
|
|
|
19
19
|
"""Import all funcs defined in hooks.py and runs them."""
|
|
20
20
|
hook_funcs = get_all_functions_from_module(hooks)
|
|
21
21
|
|
|
22
|
-
exit_code = 0
|
|
23
22
|
for hook_func in hook_funcs:
|
|
24
23
|
subprocess_args = hook_func()
|
|
25
24
|
result = run_subprocess(
|
|
@@ -44,7 +43,7 @@ Stderr:
|
|
|
44
43
|
|
|
45
44
|
---------------------------------------------------------------------------------------------
|
|
46
45
|
"""
|
|
47
|
-
|
|
46
|
+
|
|
48
47
|
# make the dashes always the same lentgth by adjusting to len of hook name
|
|
49
48
|
num_dashes = 50 - len(hook_func.__name__)
|
|
50
49
|
log_method(
|
|
@@ -53,6 +52,5 @@ Stderr:
|
|
|
53
52
|
"-" * num_dashes,
|
|
54
53
|
status_str,
|
|
55
54
|
)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
sys.exit(exit_code)
|
|
55
|
+
if not passed:
|
|
56
|
+
sys.exit(1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winipedia-utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: A package with many utility functions
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -153,21 +153,28 @@ When you commit code using `git commit`, the following checks run automatically:
|
|
|
153
153
|
|
|
154
154
|
Info: If git commit fails bc of ModuleNotFoundError or smth similar, you need to run `poetry run git commit` instead.
|
|
155
155
|
winipedia_utils hook is a python script that depends on winipedia_utils being installed. Poetry is needed to install winipedia_utils.
|
|
156
|
-
Usually VSCode or other IDEs activates the venv automatically when opening the terminal but if not you need to activate it manually or run `poetry run git commit` instead.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
Usually VSCode or other IDEs activates the venv automatically when opening the terminal but if not you need to activate it manually or run `poetry run git commit` instead. It fails fast, so if one hook in winipedia_utils hook fails, the others don't run bc sys.exit(1) is called.
|
|
157
|
+
|
|
158
|
+
Hooks run in the following order:
|
|
159
|
+
|
|
160
|
+
- Fetch latest changes (git fetch origin)
|
|
161
|
+
- Stash changes (git stash push -m "WIP: Stashed changes before rebasing")
|
|
162
|
+
- Rebase on main (git rebase origin/main)
|
|
163
|
+
- Pop stashed changes (git stash pop)
|
|
164
|
+
- Add popped stash to git (git add ., bc unstashing unadds the changes and pre-commit fails, be aware that this might add changes you didn't want to commit, so inspect the changes before committing)
|
|
165
|
+
- Patch version (poetry version patch)
|
|
166
|
+
- Add version patch to git (git add pyproject.toml)
|
|
167
|
+
- Update package manager (poetry self update)
|
|
168
|
+
- Install packages (poetry install --with dev)
|
|
169
|
+
- Update packages (poetry update --with dev (winipedia_utils forces all dependencies with * to be updated to latest compatible version))
|
|
170
|
+
- Lock dependencies (poetry lock)
|
|
171
|
+
- Check package manager configs (poetry check --strict)
|
|
172
|
+
- Create tests (python -m winipedia_utils.testing.create_tests)
|
|
173
|
+
- Lint code (ruff check --fix)
|
|
174
|
+
- Format code (ruff format)
|
|
175
|
+
- Check static types (mypy)
|
|
176
|
+
- Check security (bandit -c pyproject.toml -r .)
|
|
177
|
+
- Run tests (pytest (uses pyproject.toml as config))
|
|
171
178
|
|
|
172
179
|
### Auto-generated Test Structure
|
|
173
180
|
|
|
@@ -18,7 +18,7 @@ winipedia_utils/git/github/repo/protect.py,sha256=nOVjb5GVinGIClp7k9_qqgKnAl_gk1
|
|
|
18
18
|
winipedia_utils/git/github/repo/repo.py,sha256=OqoOfqDhe_Iik71dNqi4h3fGrMno33hSjk0bpNg3eZk,7865
|
|
19
19
|
winipedia_utils/git/github/workflows/__init__.py,sha256=BPdntTwFEyBMJ6MyT7gddPHswvRdH9tsRtfK72VSV7Y,57
|
|
20
20
|
winipedia_utils/git/github/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
21
|
-
winipedia_utils/git/github/workflows/base/base.py,sha256=
|
|
21
|
+
winipedia_utils/git/github/workflows/base/base.py,sha256=Ra1Wyywi78Ptt3U6M7smAH6keHUEe2UCNoU6a7BEFGw,28281
|
|
22
22
|
winipedia_utils/git/github/workflows/health_check.py,sha256=Ghehk7LWV3ZH2283DRoNBEF3PDZtwNhiWwMq93CeDrk,2205
|
|
23
23
|
winipedia_utils/git/github/workflows/publish.py,sha256=dNCcSBu7eTjmzomk3qX7BZpTzhwT5oM3Ap3hw22uoJE,1470
|
|
24
24
|
winipedia_utils/git/github/workflows/release.py,sha256=WEAUglUFBE4OslzC_rnCHyLeIqo09majt2ps7UzA8jM,2928
|
|
@@ -27,8 +27,8 @@ winipedia_utils/git/gitignore/config.py,sha256=Oi1gAf2mbR7vxMi0zsAFpCGzDaLNDd5S2
|
|
|
27
27
|
winipedia_utils/git/gitignore/gitignore.py,sha256=uE2MdynWgQuTG-y2YLR0FU5_giSE7s_TqSVQ6vnNOf8,2419
|
|
28
28
|
winipedia_utils/git/pre_commit/__init__.py,sha256=gFLVGQRmS6abgy5MfPQy_GZiF1_hGxuXtcOHX95WL-A,58
|
|
29
29
|
winipedia_utils/git/pre_commit/config.py,sha256=t0CETAbworS_1g3U4BijVsI1pzcArWTT2-WOexh8aVA,1822
|
|
30
|
-
winipedia_utils/git/pre_commit/hooks.py,sha256=
|
|
31
|
-
winipedia_utils/git/pre_commit/run_hooks.py,sha256=
|
|
30
|
+
winipedia_utils/git/pre_commit/hooks.py,sha256=TTxsKJR82g2sNgicENliFuVc_8OLcu-a6Cx6R1F_SZY,5181
|
|
31
|
+
winipedia_utils/git/pre_commit/run_hooks.py,sha256=pLdqV75-uvZZj0cYSC5pQ4VMv_8WwrhqSRJ_hw4H_gg,1769
|
|
32
32
|
winipedia_utils/iterating/__init__.py,sha256=rlF9hzxbowq5yOfcXvOKOQdB-EQmfrislQpf659Zeu4,53
|
|
33
33
|
winipedia_utils/iterating/iterate.py,sha256=k4U6qrnE4zij-GJhI5X0wM3pveSi8wtEsA1i8xQrfG0,3522
|
|
34
34
|
winipedia_utils/logging/__init__.py,sha256=AMt1LwA_E7hexYjMpGzUempoyDdAF-dowWvq59wC5aM,51
|
|
@@ -91,7 +91,7 @@ winipedia_utils/testing/tests/conftest.py,sha256=BLgUJtLecOwuEsIyJ__0buqovd5AhiG
|
|
|
91
91
|
winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
|
92
92
|
winipedia_utils/text/config.py,sha256=jjKmn-tSbyaK6jGL0FxFHSREP6A6V1ZSX3RuIgvQ4io,7794
|
|
93
93
|
winipedia_utils/text/string.py,sha256=uHqpm1yXumiSDD7MZxfdkRS_4paQ5wIJweeBJK2bCdQ,4332
|
|
94
|
-
winipedia_utils-0.
|
|
95
|
-
winipedia_utils-0.
|
|
96
|
-
winipedia_utils-0.
|
|
97
|
-
winipedia_utils-0.
|
|
94
|
+
winipedia_utils-0.6.1.dist-info/METADATA,sha256=SUraKQGys7X-VrmNyEqVsNRaw_vkxJvFhII6cIIOOSI,17002
|
|
95
|
+
winipedia_utils-0.6.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
96
|
+
winipedia_utils-0.6.1.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
|
|
97
|
+
winipedia_utils-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|