winipedia-utils 0.4.48__py3-none-any.whl → 0.4.56__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 +49 -2
- winipedia_utils/git/github/workflows/health_check.py +1 -0
- winipedia_utils/modules/package.py +2 -1
- {winipedia_utils-0.4.48.dist-info → winipedia_utils-0.4.56.dist-info}/METADATA +1 -1
- {winipedia_utils-0.4.48.dist-info → winipedia_utils-0.4.56.dist-info}/RECORD +7 -7
- {winipedia_utils-0.4.48.dist-info → winipedia_utils-0.4.56.dist-info}/WHEEL +0 -0
- {winipedia_utils-0.4.48.dist-info → winipedia_utils-0.4.56.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from abc import abstractmethod
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any, ClassVar
|
|
6
6
|
|
|
7
7
|
import winipedia_utils
|
|
8
8
|
from winipedia_utils.modules.module import make_obj_importpath
|
|
@@ -15,6 +15,37 @@ from winipedia_utils.text.string import split_on_uppercase
|
|
|
15
15
|
class Workflow(YamlConfigFile):
|
|
16
16
|
"""Base class for workflows."""
|
|
17
17
|
|
|
18
|
+
EMPTY_CONFIG: ClassVar[dict[str, Any]] = {
|
|
19
|
+
"on": {
|
|
20
|
+
"workflow_dispatch": {},
|
|
21
|
+
},
|
|
22
|
+
"jobs": {
|
|
23
|
+
"empty": {
|
|
24
|
+
"runs-on": "ubuntu-latest",
|
|
25
|
+
"steps": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Empty Step",
|
|
28
|
+
"run": "echo 'Empty Step'",
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def is_correct(cls) -> bool:
|
|
37
|
+
"""Check if the config is correct.
|
|
38
|
+
|
|
39
|
+
Needs some special handling since workflow files cannot be empty.
|
|
40
|
+
We need a workflow that will never trigger and even if doesnt do anything.
|
|
41
|
+
"""
|
|
42
|
+
correct = super().is_correct()
|
|
43
|
+
if cls.get_path().read_text() == "":
|
|
44
|
+
# dump a dispatch in there for on and an empty job for jobs
|
|
45
|
+
cls.dump(cls.EMPTY_CONFIG)
|
|
46
|
+
|
|
47
|
+
return correct or cls.load() == cls.EMPTY_CONFIG
|
|
48
|
+
|
|
18
49
|
@classmethod
|
|
19
50
|
@abstractmethod
|
|
20
51
|
def get_workflow_triggers(cls) -> dict[str, Any]:
|
|
@@ -113,7 +144,7 @@ class Workflow(YamlConfigFile):
|
|
|
113
144
|
return step
|
|
114
145
|
|
|
115
146
|
@classmethod
|
|
116
|
-
def get_poetry_setup_steps(
|
|
147
|
+
def get_poetry_setup_steps( # noqa: PLR0913
|
|
117
148
|
cls,
|
|
118
149
|
*,
|
|
119
150
|
install_dependencies: bool = False,
|
|
@@ -121,6 +152,7 @@ class Workflow(YamlConfigFile):
|
|
|
121
152
|
configure_pipy_token: bool = False,
|
|
122
153
|
force_main_head: bool = False,
|
|
123
154
|
token: bool = False,
|
|
155
|
+
with_keyring: bool = False,
|
|
124
156
|
) -> list[dict[str, Any]]:
|
|
125
157
|
"""Get the poetry steps.
|
|
126
158
|
|
|
@@ -132,6 +164,7 @@ class Workflow(YamlConfigFile):
|
|
|
132
164
|
equal to the most recent commit on main. This is useful for workflows that
|
|
133
165
|
should only run on main.
|
|
134
166
|
token: Whether to use the repository token.
|
|
167
|
+
with_keyring: Whether to setup the keyring.
|
|
135
168
|
|
|
136
169
|
Returns:
|
|
137
170
|
The poetry steps.
|
|
@@ -161,6 +194,7 @@ class Workflow(YamlConfigFile):
|
|
|
161
194
|
"run": "curl -sSL https://install.python-poetry.org | python3 -",
|
|
162
195
|
}
|
|
163
196
|
)
|
|
197
|
+
|
|
164
198
|
if configure_pipy_token:
|
|
165
199
|
steps.append(
|
|
166
200
|
{
|
|
@@ -168,8 +202,13 @@ class Workflow(YamlConfigFile):
|
|
|
168
202
|
"run": "poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}",
|
|
169
203
|
}
|
|
170
204
|
)
|
|
205
|
+
|
|
171
206
|
if install_dependencies:
|
|
172
207
|
steps.append({"name": "Install Dependencies", "run": "poetry install"})
|
|
208
|
+
|
|
209
|
+
if with_keyring:
|
|
210
|
+
steps.append(cls.get_setup_keyring_step())
|
|
211
|
+
|
|
173
212
|
return steps
|
|
174
213
|
|
|
175
214
|
@classmethod
|
|
@@ -243,6 +282,14 @@ class Workflow(YamlConfigFile):
|
|
|
243
282
|
"run": "git commit --no-verify -m '[skip ci] CI/CD: Committing possible added changes (e.g.: pyproject.toml and poetry.lock)'", # noqa: E501
|
|
244
283
|
}
|
|
245
284
|
|
|
285
|
+
@classmethod
|
|
286
|
+
def get_setup_keyring_step(cls) -> dict[str, Any]:
|
|
287
|
+
"""Get the setup keyring step."""
|
|
288
|
+
return {
|
|
289
|
+
"name": "Setup CI keyring",
|
|
290
|
+
"run": """poetry run pip install keyrings.alt && poetry run python -c "import keyring; from keyrings.alt.file import PlaintextKeyring; keyring.set_keyring(PlaintextKeyring()); keyring.set_password('video_vault','ci_user','ci-secret-token'); print('Keyring OK:', keyring.get_password('video_vault','ci_user'))" """, # noqa: E501
|
|
291
|
+
}
|
|
292
|
+
|
|
246
293
|
@classmethod
|
|
247
294
|
def get_protect_repository_step(cls) -> dict[str, Any]:
|
|
248
295
|
"""Get the protect repository step."""
|
|
@@ -472,7 +472,8 @@ class DependencyGraph(nx.DiGraph): # type: ignore [type-arg]
|
|
|
472
472
|
def parse_pkg_name_from_req(req: str) -> str | None:
|
|
473
473
|
"""Extract the bare dependency name from a requirement string."""
|
|
474
474
|
# split on the first non alphanumeric character like >, <, =, etc.
|
|
475
|
-
|
|
475
|
+
# keep - and _ for names like winipedia-utils or winipedia_utils
|
|
476
|
+
dep = re.split(r"[^a-zA-Z0-9_-]", req.strip())[0].strip()
|
|
476
477
|
return DependencyGraph.normalize_package_name(dep) if dep else None
|
|
477
478
|
|
|
478
479
|
def get_all_depending_on(
|
|
@@ -16,8 +16,8 @@ winipedia_utils/git/github/repo/protect.py,sha256=nOVjb5GVinGIClp7k9_qqgKnAl_gk1
|
|
|
16
16
|
winipedia_utils/git/github/repo/repo.py,sha256=OqoOfqDhe_Iik71dNqi4h3fGrMno33hSjk0bpNg3eZk,7865
|
|
17
17
|
winipedia_utils/git/github/workflows/__init__.py,sha256=BPdntTwFEyBMJ6MyT7gddPHswvRdH9tsRtfK72VSV7Y,57
|
|
18
18
|
winipedia_utils/git/github/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
19
|
-
winipedia_utils/git/github/workflows/base/base.py,sha256=
|
|
20
|
-
winipedia_utils/git/github/workflows/health_check.py,sha256=
|
|
19
|
+
winipedia_utils/git/github/workflows/base/base.py,sha256=4MAHU_oPqicwO7tZE0B99RK9ZKRMFIZhUYkWr1NrYqo,11405
|
|
20
|
+
winipedia_utils/git/github/workflows/health_check.py,sha256=pjGZckvfPHuR6QepHia6_FKcwUQAXuhGGVaVCpLQNaY,1614
|
|
21
21
|
winipedia_utils/git/github/workflows/publish.py,sha256=TPbSp5QH2vVl55UdqE_kjf1HIkdubcgqWlkLjWFX5EA,1378
|
|
22
22
|
winipedia_utils/git/github/workflows/release.py,sha256=hnMT12J17LmFpPCTzva-lW95MOFDQ-1bAOrTVCxeaR8,1301
|
|
23
23
|
winipedia_utils/git/gitignore/__init__.py,sha256=k-2E26JaZPkF69UUOJkpQl8T_PudrC7EYCIOxwgIQVU,57
|
|
@@ -37,7 +37,7 @@ winipedia_utils/modules/__init__.py,sha256=e3CFaC3FhK4ibknFOv1bqOZxA7XeVwmLqWX7o
|
|
|
37
37
|
winipedia_utils/modules/class_.py,sha256=908MgZZzcJBPmlVmMPZCFssHnRzbQYOQlrF3GQhpWm4,5411
|
|
38
38
|
winipedia_utils/modules/function.py,sha256=cjD6dXkZzhtCClUs4uiOLaDOURVASp64iwTwXmI3ICo,3217
|
|
39
39
|
winipedia_utils/modules/module.py,sha256=s48epfMHKjEgEHRO7rGICIX0JaXppOfst2uT-jLQM6M,13766
|
|
40
|
-
winipedia_utils/modules/package.py,sha256=
|
|
40
|
+
winipedia_utils/modules/package.py,sha256=6Wb8Pu-SgRWGmKM2r1nhU-yftE7USSKWAuHQn2jRXlg,18058
|
|
41
41
|
winipedia_utils/oop/__init__.py,sha256=wGjsVwLbTVEQWOfDJvN9nlvC-3NmAi8Doc2xIrm6e78,47
|
|
42
42
|
winipedia_utils/oop/mixins/__init__.py,sha256=PDK-cJcdRUfDUCz36qQ5pmMW07G133WtN49OpmILGNI,54
|
|
43
43
|
winipedia_utils/oop/mixins/meta.py,sha256=0G4CzzzCoeP1Eas3vWe-uxvB5n5ncyw7Wc-sI9zmEBc,11150
|
|
@@ -88,7 +88,7 @@ winipedia_utils/testing/tests/conftest.py,sha256=BLgUJtLecOwuEsIyJ__0buqovd5AhiG
|
|
|
88
88
|
winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
|
89
89
|
winipedia_utils/text/config.py,sha256=BPpuD4ywzzzt6Jz2M5Eln5d1NLlDp4r7CPwQOgHkxcg,7782
|
|
90
90
|
winipedia_utils/text/string.py,sha256=yXmwOab5hXyVQG1NwlWDpy2prj0U7Vb2F5HKLT2Y77Q,3382
|
|
91
|
-
winipedia_utils-0.4.
|
|
92
|
-
winipedia_utils-0.4.
|
|
93
|
-
winipedia_utils-0.4.
|
|
94
|
-
winipedia_utils-0.4.
|
|
91
|
+
winipedia_utils-0.4.56.dist-info/METADATA,sha256=xoEmD_adGarIu4ypEGgR_NK5r3nWMoewxXVNprR6Exg,14694
|
|
92
|
+
winipedia_utils-0.4.56.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
93
|
+
winipedia_utils-0.4.56.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
|
|
94
|
+
winipedia_utils-0.4.56.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|