winipedia-utils 0.5.22__py3-none-any.whl → 0.7.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/artifacts/build.py +27 -0
- winipedia_utils/dev/artifacts/build.py +62 -0
- winipedia_utils/{text → dev/configs/base}/config.py +5 -5
- winipedia_utils/{git/gitignore/config.py → dev/configs/gitignore.py} +2 -2
- winipedia_utils/{git/pre_commit/config.py → dev/configs/pre_commit.py} +5 -5
- winipedia_utils/{projects/poetry/config.py → dev/configs/pyproject.py} +82 -16
- winipedia_utils/{testing/config.py → dev/configs/testing.py} +7 -4
- winipedia_utils/dev/configs/workflows/base/base.py +907 -0
- winipedia_utils/dev/configs/workflows/health_check.py +69 -0
- winipedia_utils/dev/configs/workflows/publish.py +51 -0
- winipedia_utils/dev/configs/workflows/release.py +91 -0
- winipedia_utils/dev/git/github/repo/__init__.py +1 -0
- winipedia_utils/{git → dev/git}/github/repo/protect.py +5 -5
- winipedia_utils/{git → dev/git}/pre_commit/hooks.py +3 -63
- winipedia_utils/{git → dev/git}/pre_commit/run_hooks.py +8 -10
- winipedia_utils/dev/projects/poetry/dev_deps.py +21 -0
- winipedia_utils/{projects → dev/projects}/poetry/poetry.py +2 -2
- winipedia_utils/{projects → dev/projects}/project.py +6 -7
- winipedia_utils/dev/testing/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/convention.py +1 -1
- winipedia_utils/{testing → dev/testing}/create_tests.py +14 -14
- winipedia_utils/dev/testing/tests/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/fixtures/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/fixture.py +1 -1
- winipedia_utils/dev/testing/tests/base/fixtures/scopes/__init__.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/class_.py +2 -2
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/module.py +2 -2
- winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/session.py +10 -10
- winipedia_utils/dev/testing/tests/base/utils/__init__.py +1 -0
- winipedia_utils/dev/testing/tests/base/utils/utils.py +1 -0
- winipedia_utils/{testing → dev/testing}/tests/conftest.py +2 -2
- winipedia_utils/{testing/tests/base/utils → dev/testing}/utils.py +7 -24
- winipedia_utils/setup.py +9 -5
- winipedia_utils/utils/__init__.py +1 -0
- winipedia_utils/utils/data/dataframe/__init__.py +1 -0
- winipedia_utils/{data → utils/data}/dataframe/cleaning.py +1 -1
- winipedia_utils/utils/data/structures/__init__.py +1 -0
- winipedia_utils/{text → utils/data/structures/text}/string.py +36 -3
- winipedia_utils/utils/git/__init__.py +1 -0
- winipedia_utils/utils/git/github/__init__.py +1 -0
- winipedia_utils/{git → utils/git}/github/github.py +1 -1
- winipedia_utils/utils/git/github/repo/__init__.py +1 -0
- winipedia_utils/{git → utils/git}/github/repo/repo.py +1 -1
- winipedia_utils/{git → utils/git}/gitignore/gitignore.py +2 -2
- winipedia_utils/{concurrent → utils/iterating/concurrent}/concurrent.py +4 -4
- winipedia_utils/{concurrent → utils/iterating/concurrent}/multiprocessing.py +2 -2
- winipedia_utils/{concurrent → utils/iterating/concurrent}/multithreading.py +1 -1
- winipedia_utils/{logging → utils/logging}/logger.py +1 -1
- winipedia_utils/{modules → utils/modules}/class_.py +5 -5
- winipedia_utils/{modules → utils/modules}/function.py +2 -2
- winipedia_utils/{modules → utils/modules}/module.py +8 -5
- winipedia_utils/{modules → utils/modules}/package.py +9 -36
- winipedia_utils/{oop → utils/oop}/mixins/meta.py +4 -4
- winipedia_utils/{oop → utils/oop}/mixins/mixin.py +2 -2
- winipedia_utils/{os → utils/os}/os.py +2 -2
- winipedia_utils/utils/resources/__init__.py +1 -0
- winipedia_utils/utils/resources/svgs/__init__.py +1 -0
- winipedia_utils/{resources → utils/resources}/svgs/svg.py +1 -1
- winipedia_utils/utils/testing/__init__.py +1 -0
- winipedia_utils/{testing → utils/testing}/assertions.py +18 -0
- winipedia_utils/{testing → utils/testing}/skip.py +1 -1
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/METADATA +34 -33
- winipedia_utils-0.7.1.dist-info/RECORD +109 -0
- winipedia_utils/git/github/workflows/base/base.py +0 -377
- winipedia_utils/git/github/workflows/health_check.py +0 -80
- winipedia_utils/git/github/workflows/publish.py +0 -49
- winipedia_utils/git/github/workflows/release.py +0 -55
- winipedia_utils/testing/__init__.py +0 -1
- winipedia_utils/testing/tests/__init__.py +0 -1
- winipedia_utils/testing/tests/base/__init__.py +0 -1
- winipedia_utils/testing/tests/base/fixtures/__init__.py +0 -1
- winipedia_utils/testing/tests/base/fixtures/scopes/__init__.py +0 -1
- winipedia_utils/testing/tests/base/utils/__init__.py +0 -1
- winipedia_utils-0.5.22.dist-info/RECORD +0 -95
- /winipedia_utils/{data/dataframe → artifacts}/__init__.py +0 -0
- /winipedia_utils/{data/structures → dev}/__init__.py +0 -0
- /winipedia_utils/{git/github → dev/artifacts}/__init__.py +0 -0
- /winipedia_utils/{git/github/repo → dev/configs}/__init__.py +0 -0
- /winipedia_utils/{git/github/workflows → dev/configs}/base/__init__.py +0 -0
- /winipedia_utils/{git/github → dev/configs}/workflows/__init__.py +0 -0
- /winipedia_utils/{resources → dev/configs/workflows/base}/__init__.py +0 -0
- /winipedia_utils/{git → dev/git}/__init__.py +0 -0
- /winipedia_utils/{resources/svgs → dev/git/github}/__init__.py +0 -0
- /winipedia_utils/{git → dev/git}/pre_commit/__init__.py +0 -0
- /winipedia_utils/{projects → dev/projects}/__init__.py +0 -0
- /winipedia_utils/{projects → dev/projects}/poetry/__init__.py +0 -0
- /winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/function.py +0 -0
- /winipedia_utils/{testing → dev/testing}/tests/base/fixtures/scopes/package.py +0 -0
- /winipedia_utils/{data → utils/data}/__init__.py +0 -0
- /winipedia_utils/{data → utils/data}/structures/dicts.py +0 -0
- /winipedia_utils/{text → utils/data/structures/text}/__init__.py +0 -0
- /winipedia_utils/{git → utils/git}/gitignore/__init__.py +0 -0
- /winipedia_utils/{iterating → utils/iterating}/__init__.py +0 -0
- /winipedia_utils/{concurrent → utils/iterating/concurrent}/__init__.py +0 -0
- /winipedia_utils/{iterating → utils/iterating}/iterate.py +0 -0
- /winipedia_utils/{logging → utils/logging}/__init__.py +0 -0
- /winipedia_utils/{logging → utils/logging}/ansi.py +0 -0
- /winipedia_utils/{logging → utils/logging}/config.py +0 -0
- /winipedia_utils/{modules → utils/modules}/__init__.py +0 -0
- /winipedia_utils/{modules → utils/modules}/inspection.py +0 -0
- /winipedia_utils/{oop → utils/oop}/__init__.py +0 -0
- /winipedia_utils/{oop → utils/oop}/mixins/__init__.py +0 -0
- /winipedia_utils/{os → utils/os}/__init__.py +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/delete_garbage_can.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/download_arrow.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/exit_fullscreen_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/fullscreen_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/menu_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/pause_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/play_icon.svg +0 -0
- /winipedia_utils/{resources → utils/resources}/svgs/plus_icon.svg +0 -0
- /winipedia_utils/{security → utils/security}/__init__.py +0 -0
- /winipedia_utils/{security → utils/security}/cryptography.py +0 -0
- /winipedia_utils/{security → utils/security}/keyring.py +0 -0
- /winipedia_utils/{testing → utils/testing}/fixtures.py +0 -0
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/WHEEL +0 -0
- {winipedia_utils-0.5.22.dist-info → winipedia_utils-0.7.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winipedia-utils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: A package with many utility functions
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -136,7 +136,7 @@ The health check workflow consists of two jobs:
|
|
|
136
136
|
- Add Poetry to PATH (Windows-specific step)
|
|
137
137
|
- Install dependencies
|
|
138
138
|
- Setup CI keyring
|
|
139
|
-
- Protect repository (applies branch protection rules)
|
|
139
|
+
- Protect repository (applies branch protection rules and repository settings)
|
|
140
140
|
- Run pre-commit hooks (linting, formatting, type checking, security, tests)
|
|
141
141
|
|
|
142
142
|
2. **Aggregation Job** (`health_check`) - Aggregates matrix results into a single status check:
|
|
@@ -145,6 +145,7 @@ The health check workflow consists of two jobs:
|
|
|
145
145
|
- Provides a single status check that can be marked as required in branch protection rules
|
|
146
146
|
|
|
147
147
|
The release workflow extends the health check workflow and adds a release job that runs after all health checks pass.
|
|
148
|
+
A build job is added before the release job if a script src/artifacts/build.py exists. This script is created by the setup command and can be modified to create build artifacts for your project. This script then just needs to create artifacts in a folder called artifacts and those will be uploaded as artifacts to the release.
|
|
148
149
|
|
|
149
150
|
### Pre-commit Hook Workflow
|
|
150
151
|
|
|
@@ -152,21 +153,21 @@ When you commit code using `git commit`, the following checks run automatically:
|
|
|
152
153
|
|
|
153
154
|
Info: If git commit fails bc of ModuleNotFoundError or smth similar, you need to run `poetry run git commit` instead.
|
|
154
155
|
winipedia_utils hook is a python script that depends on winipedia_utils being installed. Poetry is needed to install winipedia_utils.
|
|
155
|
-
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.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
+
- Update package manager (poetry self update)
|
|
161
|
+
- Install packages (poetry install --with dev)
|
|
162
|
+
- Update packages (poetry update --with dev (winipedia_utils forces all dependencies with * to be updated to latest compatible version))
|
|
163
|
+
- Lock dependencies (poetry lock)
|
|
164
|
+
- Check package manager configs (poetry check --strict)
|
|
165
|
+
- Create tests (python -m winipedia_utils.dev.testing.create_tests)
|
|
166
|
+
- Lint code (ruff check --fix)
|
|
167
|
+
- Format code (ruff format)
|
|
168
|
+
- Check static types (mypy)
|
|
169
|
+
- Check security (bandit -c pyproject.toml -r .)
|
|
170
|
+
- Run tests (pytest (uses pyproject.toml as config))
|
|
170
171
|
|
|
171
172
|
### Auto-generated Test Structure
|
|
172
173
|
|
|
@@ -202,7 +203,7 @@ Configuration files are managed automatically by the setup system:
|
|
|
202
203
|
|
|
203
204
|
## Branch Protection
|
|
204
205
|
|
|
205
|
-
As soon as you push to `main` on GitHub (provided the `REPO_TOKEN` secret is set up correctly), the `health_check.yaml` workflow will run and execute `winipedia_utils.git.github.repo.protect`, which uses PyGithub to protect the repository.
|
|
206
|
+
As soon as you push to `main` on GitHub (provided the `REPO_TOKEN` secret is set up correctly), the `health_check.yaml` workflow will run and execute `winipedia_utils.dev.git.github.repo.protect`, which uses PyGithub to protect the repository.
|
|
206
207
|
|
|
207
208
|
### Repository Settings
|
|
208
209
|
|
|
@@ -248,8 +249,8 @@ Winipedia Utils provides comprehensive utility modules for common development ta
|
|
|
248
249
|
Unified interface for multiprocessing and multithreading:
|
|
249
250
|
|
|
250
251
|
```python
|
|
251
|
-
from winipedia_utils.concurrent.multiprocessing import multiprocess_loop
|
|
252
|
-
from winipedia_utils.concurrent.multithreading import multithread_loop
|
|
252
|
+
from winipedia_utils.utils.iterating.concurrent.multiprocessing import multiprocess_loop
|
|
253
|
+
from winipedia_utils.utils.iterating.concurrent.multithreading import multithread_loop
|
|
253
254
|
```
|
|
254
255
|
|
|
255
256
|
### Data Cleaning & Handling
|
|
@@ -257,7 +258,7 @@ from winipedia_utils.concurrent.multithreading import multithread_loop
|
|
|
257
258
|
Build data cleaning pipelines using Polars:
|
|
258
259
|
|
|
259
260
|
```python
|
|
260
|
-
from winipedia_utils.data.dataframe.cleaning import CleaningDF
|
|
261
|
+
from winipedia_utils.utils.data.dataframe.cleaning import CleaningDF
|
|
261
262
|
import polars as pl
|
|
262
263
|
```
|
|
263
264
|
|
|
@@ -266,7 +267,7 @@ import polars as pl
|
|
|
266
267
|
Simple, standardized logging setup with automatic method instrumentation:
|
|
267
268
|
|
|
268
269
|
```python
|
|
269
|
-
from winipedia_utils.logging.logger import get_logger
|
|
270
|
+
from winipedia_utils.utils.logging.logger import get_logger
|
|
270
271
|
|
|
271
272
|
logger = get_logger(__name__)
|
|
272
273
|
logger.info("Application started")
|
|
@@ -284,7 +285,7 @@ logger.error("An error occurred")
|
|
|
284
285
|
Advanced metaclasses and mixins for class composition and behavior extension:
|
|
285
286
|
|
|
286
287
|
```python
|
|
287
|
-
from winipedia_utils.oop.mixins.mixin import ABCLoggingMixin, StrictABCLoggingMixin
|
|
288
|
+
from winipedia_utils.utils.oop.mixins.mixin import ABCLoggingMixin, StrictABCLoggingMixin
|
|
288
289
|
```
|
|
289
290
|
|
|
290
291
|
### Security Utilities
|
|
@@ -292,7 +293,7 @@ from winipedia_utils.oop.mixins.mixin import ABCLoggingMixin, StrictABCLoggingMi
|
|
|
292
293
|
Encryption and secure credential storage using keyring:
|
|
293
294
|
|
|
294
295
|
```python
|
|
295
|
-
from winipedia_utils.security.keyring import (
|
|
296
|
+
from winipedia_utils.utils.security.keyring import (
|
|
296
297
|
get_or_create_fernet,
|
|
297
298
|
get_or_create_aes_gcm
|
|
298
299
|
)
|
|
@@ -303,8 +304,8 @@ from winipedia_utils.security.keyring import (
|
|
|
303
304
|
Comprehensive testing framework with automatic test generation:
|
|
304
305
|
|
|
305
306
|
```python
|
|
306
|
-
from winipedia_utils.testing.assertions import assert_with_msg
|
|
307
|
-
from winipedia_utils.testing.convention import (
|
|
307
|
+
from winipedia_utils.utils.testing.assertions import assert_with_msg
|
|
308
|
+
from winipedia_utils.dev.testing.convention import (
|
|
308
309
|
make_test_obj_name,
|
|
309
310
|
get_test_obj_from_obj,
|
|
310
311
|
make_test_obj_importpath_from_obj
|
|
@@ -334,10 +335,10 @@ test_path = make_test_obj_importpath_from_obj(my_function)
|
|
|
334
335
|
Tools for working with Python modules, packages, classes, and functions:
|
|
335
336
|
|
|
336
337
|
```python
|
|
337
|
-
from winipedia_utils.modules.package import find_packages, walk_package
|
|
338
|
-
from winipedia_utils.modules.module import create_module, import_obj_from_importpath
|
|
339
|
-
from winipedia_utils.modules.class_ import get_all_cls_from_module, get_all_methods_from_cls
|
|
340
|
-
from winipedia_utils.modules.function import get_all_functions_from_module
|
|
338
|
+
from winipedia_utils.utils.modules.package import find_packages, walk_package
|
|
339
|
+
from winipedia_utils.utils.modules.module import create_module, import_obj_from_importpath
|
|
340
|
+
from winipedia_utils.utils.modules.class_ import get_all_cls_from_module, get_all_methods_from_cls
|
|
341
|
+
from winipedia_utils.utils.modules.function import get_all_functions_from_module
|
|
341
342
|
```
|
|
342
343
|
|
|
343
344
|
### Text and String Utilities
|
|
@@ -345,7 +346,7 @@ from winipedia_utils.modules.function import get_all_functions_from_module
|
|
|
345
346
|
String manipulation and configuration file handling:
|
|
346
347
|
|
|
347
348
|
```python
|
|
348
|
-
from winipedia_utils.text.string import value_to_truncated_string
|
|
349
|
+
from winipedia_utils.utils.data.structures.text.string import value_to_truncated_string
|
|
349
350
|
```
|
|
350
351
|
|
|
351
352
|
### OS and System Utilities
|
|
@@ -353,7 +354,7 @@ from winipedia_utils.text.string import value_to_truncated_string
|
|
|
353
354
|
Operating system and subprocess utilities:
|
|
354
355
|
|
|
355
356
|
```python
|
|
356
|
-
from winipedia_utils.os.os import run_subprocess
|
|
357
|
+
from winipedia_utils.utils.os.os import run_subprocess
|
|
357
358
|
```
|
|
358
359
|
|
|
359
360
|
### Iteration Utilities
|
|
@@ -361,7 +362,7 @@ from winipedia_utils.os.os import run_subprocess
|
|
|
361
362
|
Utilities for working with iterables and nested structures:
|
|
362
363
|
|
|
363
364
|
```python
|
|
364
|
-
from winipedia_utils.iterating.iterate import get_len_with_default, nested_structure_is_subset
|
|
365
|
+
from winipedia_utils.utils.iterating.iterate import get_len_with_default, nested_structure_is_subset
|
|
365
366
|
```
|
|
366
367
|
|
|
367
368
|
### Philosophy
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
winipedia_utils/__init__.py,sha256=vOWZ8n-YemVIzDLd8eWw1HVPGH3jxuT6VtDKHbmxk_A,43
|
|
2
|
+
winipedia_utils/artifacts/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
3
|
+
winipedia_utils/artifacts/build.py,sha256=idKMw124cO5M8080AujxGzhYbVTQGIETkf-UxCEh8oY,767
|
|
4
|
+
winipedia_utils/dev/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
5
|
+
winipedia_utils/dev/artifacts/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
6
|
+
winipedia_utils/dev/artifacts/build.py,sha256=DZrhVcmHt3J0kbkn8r4ZQNPXviQGcJIhYPozophs5kA,2064
|
|
7
|
+
winipedia_utils/dev/configs/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
8
|
+
winipedia_utils/dev/configs/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
9
|
+
winipedia_utils/dev/configs/base/config.py,sha256=nNtZnsUYBhgppMt8CmxDDmBggFynxaaeEfa1JRJcWPY,7838
|
|
10
|
+
winipedia_utils/dev/configs/gitignore.py,sha256=VYapZJl_K0ss-XIQltjGY6shAp0By_B9QvYQlSk0MVo,2612
|
|
11
|
+
winipedia_utils/dev/configs/pre_commit.py,sha256=ICRAxfHOuFpd6HE9NgziCAj22LNO89JdyOddueE6cTo,1868
|
|
12
|
+
winipedia_utils/dev/configs/pyproject.py,sha256=GpBdNSHVqhw2kpFQibf6NyDlH1-jv-9bNvK0FcQ9aBU,11102
|
|
13
|
+
winipedia_utils/dev/configs/testing.py,sha256=aThPo3fphhzHl6c6Ujvf6AvLAj85jWuhjpDywTgqkUQ,3668
|
|
14
|
+
winipedia_utils/dev/configs/workflows/__init__.py,sha256=BPdntTwFEyBMJ6MyT7gddPHswvRdH9tsRtfK72VSV7Y,57
|
|
15
|
+
winipedia_utils/dev/configs/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
16
|
+
winipedia_utils/dev/configs/workflows/base/base.py,sha256=3dO25DiPcPUHYj_Ha9a6s4_1DD67bb-R9brU3a9-bC0,28775
|
|
17
|
+
winipedia_utils/dev/configs/workflows/health_check.py,sha256=KChweSxamAjgy1uOrRcpIQ5wdn4JzrRhT8x28XhVTXk,2168
|
|
18
|
+
winipedia_utils/dev/configs/workflows/publish.py,sha256=SPrG2E8MERtcgNd9x6adM9Rsvks9zWq-CwzcuJMYEgE,1472
|
|
19
|
+
winipedia_utils/dev/configs/workflows/release.py,sha256=zZr4AHMOaexxZgbS5gdXexK10WcZmUGh_cJG5riMlKo,2923
|
|
20
|
+
winipedia_utils/dev/git/__init__.py,sha256=IRmEVz0sUEw47Eli--57YaypWitxlcYThT_ulwkhNTE,47
|
|
21
|
+
winipedia_utils/dev/git/github/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
22
|
+
winipedia_utils/dev/git/github/repo/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
23
|
+
winipedia_utils/dev/git/github/repo/protect.py,sha256=HYB9cunOkGnqImIR9F0jQfBedkVtlHMaRgOwTqejrpM,3169
|
|
24
|
+
winipedia_utils/dev/git/pre_commit/__init__.py,sha256=gFLVGQRmS6abgy5MfPQy_GZiF1_hGxuXtcOHX95WL-A,58
|
|
25
|
+
winipedia_utils/dev/git/pre_commit/hooks.py,sha256=wwrzeugiwdKh-FIQ7iZWJSp9uqyj7Ec0kkZtVv7VO6U,2483
|
|
26
|
+
winipedia_utils/dev/git/pre_commit/run_hooks.py,sha256=E2GiW88MYd3x4x6whYlmmb8zwoAdyFGmI4dg03LoDs4,1797
|
|
27
|
+
winipedia_utils/dev/projects/__init__.py,sha256=_iYHzUcTPmutpsExPDcMF9OQDgnz-kTSuWens9iP9bI,52
|
|
28
|
+
winipedia_utils/dev/projects/poetry/__init__.py,sha256=tbvV3wYd3H39hjjlKbF84Irj4hYgv1A7KWyXdCQzFro,59
|
|
29
|
+
winipedia_utils/dev/projects/poetry/dev_deps.py,sha256=8QIunGKoqlNlq1Co5bT3UWzoxIiiEGpGP9si7xLI0P0,535
|
|
30
|
+
winipedia_utils/dev/projects/poetry/poetry.py,sha256=Uhuk9nGNWjzv4gql3-dELcFC9Q3f54GH_kWSx0GltYE,8490
|
|
31
|
+
winipedia_utils/dev/projects/project.py,sha256=jGzWNpJ4abMiKNlBLPlFS2TG7MQpd0ijYlmWzjll3k4,537
|
|
32
|
+
winipedia_utils/dev/testing/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
33
|
+
winipedia_utils/dev/testing/convention.py,sha256=YAozeOwrKlq6K6u30_bYXUFtxfFtGP0lf1SdbKrojqU,4839
|
|
34
|
+
winipedia_utils/dev/testing/create_tests.py,sha256=msLIBh8o5W1EJWCOcYy7YLgg3iEs_g5YefAZJvzdY4I,9416
|
|
35
|
+
winipedia_utils/dev/testing/tests/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
36
|
+
winipedia_utils/dev/testing/tests/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
37
|
+
winipedia_utils/dev/testing/tests/base/fixtures/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
38
|
+
winipedia_utils/dev/testing/tests/base/fixtures/fixture.py,sha256=7R4Az6kRiL8sEowenbS4QjvWvnWf9X_ZfxVqvJoMsbs,1220
|
|
39
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
40
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/class_.py,sha256=j9umMWRcFTTKZ5Dt40Cv4pxkxdSlalkDk-DvfHpDb7g,1092
|
|
41
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/function.py,sha256=l1zCCiTkXUSZp0n9QOyejhfszFJiMH88bhGMwNY5r8A,302
|
|
42
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/module.py,sha256=-Ugy1Jsao9Qkk2MHl-6dXHMKKE9hTgqHKgSUZcR1OmM,1228
|
|
43
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/package.py,sha256=pR3so6QPymIRM4PJTODrlBKI-yQnZ2P78BsiyTPaF8o,302
|
|
44
|
+
winipedia_utils/dev/testing/tests/base/fixtures/scopes/session.py,sha256=GpDyhXdroGGYTNX6EgapxKJIc_h0gw6CuKgtA7YpgFI,6141
|
|
45
|
+
winipedia_utils/dev/testing/tests/base/utils/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
46
|
+
winipedia_utils/dev/testing/tests/base/utils/utils.py,sha256=yF8K6oliUsyLmr0lfq-QYIpNy2uWYbQhTK59zJoo0sE,25
|
|
47
|
+
winipedia_utils/dev/testing/tests/conftest.py,sha256=zHeokbp6R2iAn2bmm5BDXqyR9Mtf7QE0evZycTBf_vE,898
|
|
48
|
+
winipedia_utils/dev/testing/utils.py,sha256=ZJeY7_PdoirU0bkSQ-bqByYBYD8ElhBubdMfI2dnYeM,2207
|
|
49
|
+
winipedia_utils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
50
|
+
winipedia_utils/setup.py,sha256=K91g_pK5ezkGMwqnl3rAaeF8PFbgZa2ury53e0tzRM0,1486
|
|
51
|
+
winipedia_utils/utils/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
52
|
+
winipedia_utils/utils/data/__init__.py,sha256=o6SXX1gBCwhb9abo8xTfZtqUNuLqXmdo2VervnJxRzc,48
|
|
53
|
+
winipedia_utils/utils/data/dataframe/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
54
|
+
winipedia_utils/utils/data/dataframe/cleaning.py,sha256=w6N0los24ZfsEQB2FDAzhVpjR8TJeJlt_VBfROmpPuw,23438
|
|
55
|
+
winipedia_utils/utils/data/structures/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
56
|
+
winipedia_utils/utils/data/structures/dicts.py,sha256=jsFzQ96cvyHsvPSnsEUhksuWvLSGq6-Rryfw6gEXq-c,274
|
|
57
|
+
winipedia_utils/utils/data/structures/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
|
|
58
|
+
winipedia_utils/utils/data/structures/text/string.py,sha256=Sq7aQ6YMB6sVBsYQYZ2P9d8uEe9zIvi8aUMYjyRQOwk,4453
|
|
59
|
+
winipedia_utils/utils/git/__init__.py,sha256=IRmEVz0sUEw47Eli--57YaypWitxlcYThT_ulwkhNTE,47
|
|
60
|
+
winipedia_utils/utils/git/github/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
61
|
+
winipedia_utils/utils/git/github/github.py,sha256=FzmvxGOny0oPp-pV0SiZRSMC2HHE0SuA5ak8QFZwt-M,826
|
|
62
|
+
winipedia_utils/utils/git/github/repo/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
63
|
+
winipedia_utils/utils/git/github/repo/repo.py,sha256=85LXlADugpvRY-KHbSdd2z5upLFnMakOHmi3ZFy5J3M,7871
|
|
64
|
+
winipedia_utils/utils/git/gitignore/__init__.py,sha256=k-2E26JaZPkF69UUOJkpQl8T_PudrC7EYCIOxwgIQVU,57
|
|
65
|
+
winipedia_utils/utils/git/gitignore/gitignore.py,sha256=1lNqG9EFFz2b0tWqcO__Go3_3vhw9yeNqg35ATPYdCU,2426
|
|
66
|
+
winipedia_utils/utils/iterating/__init__.py,sha256=rlF9hzxbowq5yOfcXvOKOQdB-EQmfrislQpf659Zeu4,53
|
|
67
|
+
winipedia_utils/utils/iterating/concurrent/__init__.py,sha256=Tu0ig4gVCk_f1n74G35hDwH-WS3P3STVQGWjxTIbbo8,54
|
|
68
|
+
winipedia_utils/utils/iterating/concurrent/concurrent.py,sha256=z0mezS9uvmi5cKdNFud46Ts52U__8hhXObJL0wsGuGg,8692
|
|
69
|
+
winipedia_utils/utils/iterating/concurrent/multiprocessing.py,sha256=8W-dJ6z12z1grxgQH53Dk87N0yse5EYKWUniyVMUkW8,4743
|
|
70
|
+
winipedia_utils/utils/iterating/concurrent/multithreading.py,sha256=4lBuZQUxep-1omnB4Gf-5xXwoBbNwsq52-sNoI8qZ4U,3096
|
|
71
|
+
winipedia_utils/utils/iterating/iterate.py,sha256=k4U6qrnE4zij-GJhI5X0wM3pveSi8wtEsA1i8xQrfG0,3522
|
|
72
|
+
winipedia_utils/utils/logging/__init__.py,sha256=AMt1LwA_E7hexYjMpGzUempoyDdAF-dowWvq59wC5aM,51
|
|
73
|
+
winipedia_utils/utils/logging/ansi.py,sha256=7Z-FITaUn5B1ZE0OUVARjNzuMui1V36iu4YTjlD6QfI,101
|
|
74
|
+
winipedia_utils/utils/logging/config.py,sha256=sdC3GHMkJqlY-WwIsOMeTcy1bihthWV2LbvxLt9dhc4,2895
|
|
75
|
+
winipedia_utils/utils/logging/logger.py,sha256=IZDNiDBWVauA7UsZj5HXnCLMzBQM2zN9YDWhCHg0DbM,707
|
|
76
|
+
winipedia_utils/utils/modules/__init__.py,sha256=e3CFaC3FhK4ibknFOv1bqOZxA7XeVwmLqWX7oajUm78,51
|
|
77
|
+
winipedia_utils/utils/modules/class_.py,sha256=iEtrvbGju1LVlTGP3fUmF5kajW0FDsk9ZSHeM4ns0EI,5685
|
|
78
|
+
winipedia_utils/utils/modules/function.py,sha256=0QtHtfAjKal3GRRU9CP4LfHgoIHpbU88AgTZ2fv6v9k,3491
|
|
79
|
+
winipedia_utils/utils/modules/inspection.py,sha256=XPSJfLN6WnNmbXn-6z9D01cmqmPS-HrTPy6-B6C34tw,1821
|
|
80
|
+
winipedia_utils/utils/modules/module.py,sha256=kMV1wH8S2incHUlMKgP5CmIJXjYXaka_s_e_M5XyV7M,12835
|
|
81
|
+
winipedia_utils/utils/modules/package.py,sha256=zlobKYKqMBYcQsqGCc0v0DeLpLUQTDDayi-fm3bduek,17295
|
|
82
|
+
winipedia_utils/utils/oop/__init__.py,sha256=wGjsVwLbTVEQWOfDJvN9nlvC-3NmAi8Doc2xIrm6e78,47
|
|
83
|
+
winipedia_utils/utils/oop/mixins/__init__.py,sha256=PDK-cJcdRUfDUCz36qQ5pmMW07G133WtN49OpmILGNI,54
|
|
84
|
+
winipedia_utils/utils/oop/mixins/meta.py,sha256=fnH2jVXWMIObdb2PQH0p0-j1kfFdEeD2_QWvWM2UivY,11190
|
|
85
|
+
winipedia_utils/utils/oop/mixins/mixin.py,sha256=h1Fc5ZhESFv7g9dhpSWcMN1B6VPh2BHjPwWmzM9Tomc,1413
|
|
86
|
+
winipedia_utils/utils/os/__init__.py,sha256=cBRq8hWhaWvYeC3cSBYL6Y70kM9COQWHj8vVxxSadIg,46
|
|
87
|
+
winipedia_utils/utils/os/os.py,sha256=giBJDrWewOtxoSExNj6y_afOcxhpDAVGs2W93xUR96k,1777
|
|
88
|
+
winipedia_utils/utils/resources/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
89
|
+
winipedia_utils/utils/resources/svgs/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
90
|
+
winipedia_utils/utils/resources/svgs/delete_garbage_can.svg,sha256=UxEEh46w1JD4VViUBx-Ahaq5_ZR4zOjfeJn5_aM8114,318
|
|
91
|
+
winipedia_utils/utils/resources/svgs/download_arrow.svg,sha256=8g_cBwKFHyoeSmaLMXcGwIHT4_rZDDtDGm35E0PkniE,242
|
|
92
|
+
winipedia_utils/utils/resources/svgs/exit_fullscreen_icon.svg,sha256=sZSexEjab82zhAK3JRtOWH19aAFa1GhuGLChDz9wFFc,523
|
|
93
|
+
winipedia_utils/utils/resources/svgs/fullscreen_icon.svg,sha256=mm2n6WvaSu0OqiQSAw0QPNwzXpPLaF53_XAklUfQQPo,406
|
|
94
|
+
winipedia_utils/utils/resources/svgs/menu_icon.svg,sha256=pA1Z_x5gDkhYLQA0dL0l_8uBP-e6mKLcEOYwlhURUv4,344
|
|
95
|
+
winipedia_utils/utils/resources/svgs/pause_icon.svg,sha256=z-Cj3DOI0rwRbWCOhaiHtDQYM4s6OgkCBVcdip77rQE,179
|
|
96
|
+
winipedia_utils/utils/resources/svgs/play_icon.svg,sha256=7gx1EWZnyu1pA6WboAfVH3OGcp_uYPpT1syqHe-jaGE,953
|
|
97
|
+
winipedia_utils/utils/resources/svgs/plus_icon.svg,sha256=1ucedu8ucLI7LMNsfNN2GYiwNUe8-ViNBcanDwzTqHc,552
|
|
98
|
+
winipedia_utils/utils/resources/svgs/svg.py,sha256=Mqvvwjk_64aHe9T9epZ1ulHt6grBWnZgK3bnPpSyldU,421
|
|
99
|
+
winipedia_utils/utils/security/__init__.py,sha256=HmGXOCROqIGHlBs2bEWRMkEX3rlXNsnA9Tef58AlCo4,52
|
|
100
|
+
winipedia_utils/utils/security/cryptography.py,sha256=5LMat3-9nDW2cQBr_dU7MFRdgbiK53zQqHyacs-Jq-s,793
|
|
101
|
+
winipedia_utils/utils/security/keyring.py,sha256=6kKgSTz1G80F6XeZ3Lskxdl2N6JgUH8gJdFYcGJuysU,2273
|
|
102
|
+
winipedia_utils/utils/testing/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
|
|
103
|
+
winipedia_utils/utils/testing/assertions.py,sha256=FYuDIeeQKCbaKFaGRnNWkxlJ-xNoPyxwCjq3vtM9Oz4,1914
|
|
104
|
+
winipedia_utils/utils/testing/fixtures.py,sha256=G8QIrZXndtud0uOk6PY3f8IIDoyX_ronogjeLAYGjrM,1033
|
|
105
|
+
winipedia_utils/utils/testing/skip.py,sha256=nxBNqysJaXaXaJOVb-J8K8OGCV0xP_YfgjO0pA3m9u4,492
|
|
106
|
+
winipedia_utils-0.7.1.dist-info/METADATA,sha256=6jeyCPlh7JCi9ar2e_1KP-M2BCT3HieDy6vE3FRA57A,16647
|
|
107
|
+
winipedia_utils-0.7.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
108
|
+
winipedia_utils-0.7.1.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
|
|
109
|
+
winipedia_utils-0.7.1.dist-info/RECORD,,
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
"""Contains base utilities for git workflows."""
|
|
2
|
-
|
|
3
|
-
from abc import abstractmethod
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import Any, ClassVar
|
|
6
|
-
|
|
7
|
-
import winipedia_utils
|
|
8
|
-
from winipedia_utils.modules.module import make_obj_importpath
|
|
9
|
-
from winipedia_utils.modules.package import get_src_package
|
|
10
|
-
from winipedia_utils.projects.poetry.config import PyprojectConfigFile
|
|
11
|
-
from winipedia_utils.text.config import YamlConfigFile
|
|
12
|
-
from winipedia_utils.text.string import split_on_uppercase
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Workflow(YamlConfigFile):
|
|
16
|
-
"""Base class for workflows."""
|
|
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
|
-
|
|
49
|
-
@classmethod
|
|
50
|
-
@abstractmethod
|
|
51
|
-
def get_workflow_triggers(cls) -> dict[str, Any]:
|
|
52
|
-
"""Get the workflow triggers."""
|
|
53
|
-
|
|
54
|
-
@classmethod
|
|
55
|
-
@abstractmethod
|
|
56
|
-
def get_permissions(cls) -> dict[str, Any]:
|
|
57
|
-
"""Get the workflow permissions."""
|
|
58
|
-
|
|
59
|
-
@classmethod
|
|
60
|
-
@abstractmethod
|
|
61
|
-
def get_jobs(cls) -> dict[str, Any]:
|
|
62
|
-
"""Get the workflow jobs."""
|
|
63
|
-
|
|
64
|
-
@classmethod
|
|
65
|
-
def get_parent_path(cls) -> Path:
|
|
66
|
-
"""Get the path to the config file."""
|
|
67
|
-
return Path(".github/workflows")
|
|
68
|
-
|
|
69
|
-
@classmethod
|
|
70
|
-
def get_configs(cls) -> dict[str, Any]:
|
|
71
|
-
"""Get the workflow config."""
|
|
72
|
-
return {
|
|
73
|
-
"name": cls.get_workflow_name(),
|
|
74
|
-
"on": cls.get_workflow_triggers(),
|
|
75
|
-
"permissions": cls.get_permissions(),
|
|
76
|
-
"run-name": cls.get_run_name(),
|
|
77
|
-
"defaults": {"run": {"shell": "bash"}},
|
|
78
|
-
"jobs": cls.get_jobs(),
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@classmethod
|
|
82
|
-
def get_standard_job( # noqa: PLR0913
|
|
83
|
-
cls,
|
|
84
|
-
name: str | None = None,
|
|
85
|
-
runs_on: str = "ubuntu-latest",
|
|
86
|
-
strategy: dict[str, Any] | None = None,
|
|
87
|
-
permissions: dict[str, Any] | None = None,
|
|
88
|
-
if_condition: str | None = None,
|
|
89
|
-
steps: list[dict[str, Any]] | None = None,
|
|
90
|
-
needs: list[str] | None = None,
|
|
91
|
-
) -> dict[str, Any]:
|
|
92
|
-
"""Get a standard job."""
|
|
93
|
-
job: dict[str, Any] = {}
|
|
94
|
-
if name is None:
|
|
95
|
-
name = cls.get_filename()
|
|
96
|
-
job[name] = {}
|
|
97
|
-
job_config = job[name]
|
|
98
|
-
|
|
99
|
-
if permissions is not None:
|
|
100
|
-
job_config["permissions"] = permissions
|
|
101
|
-
|
|
102
|
-
if strategy is not None:
|
|
103
|
-
job_config["strategy"] = strategy
|
|
104
|
-
|
|
105
|
-
job_config["runs-on"] = runs_on
|
|
106
|
-
|
|
107
|
-
if needs is not None:
|
|
108
|
-
job_config["needs"] = needs
|
|
109
|
-
|
|
110
|
-
if if_condition is not None:
|
|
111
|
-
job_config["if"] = if_condition
|
|
112
|
-
|
|
113
|
-
if steps is None:
|
|
114
|
-
steps = []
|
|
115
|
-
job_config["steps"] = steps
|
|
116
|
-
|
|
117
|
-
return job
|
|
118
|
-
|
|
119
|
-
@classmethod
|
|
120
|
-
def get_workflow_name(cls) -> str:
|
|
121
|
-
"""Get the workflow name."""
|
|
122
|
-
return " ".join(split_on_uppercase(cls.__name__))
|
|
123
|
-
|
|
124
|
-
@classmethod
|
|
125
|
-
def get_run_name(cls) -> str:
|
|
126
|
-
"""Get the workflow run name."""
|
|
127
|
-
return f"{cls.get_workflow_name()}"
|
|
128
|
-
|
|
129
|
-
@classmethod
|
|
130
|
-
def get_checkout_step(
|
|
131
|
-
cls,
|
|
132
|
-
fetch_depth: int | None = None,
|
|
133
|
-
*,
|
|
134
|
-
token: bool = False,
|
|
135
|
-
) -> dict[str, Any]:
|
|
136
|
-
"""Get the checkout step.
|
|
137
|
-
|
|
138
|
-
Args:
|
|
139
|
-
fetch_depth: The fetch depth to use. If None, no fetch depth is specified.
|
|
140
|
-
token: Whether to use the repository token.
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
The checkout step.
|
|
144
|
-
"""
|
|
145
|
-
step: dict[str, Any] = {
|
|
146
|
-
"name": "Checkout repository",
|
|
147
|
-
"uses": "actions/checkout@main",
|
|
148
|
-
}
|
|
149
|
-
if fetch_depth is not None:
|
|
150
|
-
step.setdefault("with", {})["fetch-depth"] = fetch_depth
|
|
151
|
-
|
|
152
|
-
if token:
|
|
153
|
-
step.setdefault("with", {})["token"] = cls.get_repo_token()
|
|
154
|
-
return step
|
|
155
|
-
|
|
156
|
-
@classmethod
|
|
157
|
-
def get_poetry_setup_steps( # noqa: PLR0913
|
|
158
|
-
cls,
|
|
159
|
-
*,
|
|
160
|
-
install_dependencies: bool = False,
|
|
161
|
-
fetch_depth: int | None = None,
|
|
162
|
-
configure_pipy_token: bool = False,
|
|
163
|
-
force_main_head: bool = False,
|
|
164
|
-
repo_token: bool = False,
|
|
165
|
-
with_keyring: bool = False,
|
|
166
|
-
strategy_matrix: bool = False,
|
|
167
|
-
) -> list[dict[str, Any]]:
|
|
168
|
-
"""Get the poetry steps.
|
|
169
|
-
|
|
170
|
-
Args:
|
|
171
|
-
install_dependencies: Whether to install dependencies.
|
|
172
|
-
fetch_depth: The fetch depth to use. If None, no fetch depth is specified.
|
|
173
|
-
configure_pipy_token: Whether to configure the pipy token.
|
|
174
|
-
force_main_head: Whether to exit if the running branch or current commit is not
|
|
175
|
-
equal to the most recent commit on main. This is useful for workflows that
|
|
176
|
-
should only run on main.
|
|
177
|
-
repo_token: Whether to use the repository token.
|
|
178
|
-
with_keyring: Whether to setup the keyring.
|
|
179
|
-
strategy_matrix: Whether to use the strategy matrix python-version.
|
|
180
|
-
This is useful for jobs that use a matrix.
|
|
181
|
-
|
|
182
|
-
Returns:
|
|
183
|
-
The poetry steps.
|
|
184
|
-
"""
|
|
185
|
-
steps = [cls.get_checkout_step(fetch_depth, token=repo_token)]
|
|
186
|
-
if force_main_head:
|
|
187
|
-
# exit with code 1 if the running branch is not main
|
|
188
|
-
steps.append(
|
|
189
|
-
{
|
|
190
|
-
"name": "Assert running on head of main",
|
|
191
|
-
"run": 'git fetch origin main --depth=1; main_sha=$(git rev-parse origin/main); if [ "$GITHUB_SHA" != "$main_sha" ]; then echo "Tag commit is not the latest commit on main."; exit 1; fi', # noqa: E501
|
|
192
|
-
}
|
|
193
|
-
)
|
|
194
|
-
steps.append(cls.get_setup_git_step())
|
|
195
|
-
steps.append(
|
|
196
|
-
{
|
|
197
|
-
"name": "Setup Python",
|
|
198
|
-
"uses": "actions/setup-python@main",
|
|
199
|
-
"with": {
|
|
200
|
-
# get latest if strategy matrix python-version is not set
|
|
201
|
-
"python-version": "${{ matrix.python-version }}"
|
|
202
|
-
if strategy_matrix
|
|
203
|
-
else str(PyprojectConfigFile.get_latest_possible_python_version())
|
|
204
|
-
},
|
|
205
|
-
}
|
|
206
|
-
)
|
|
207
|
-
steps.append(
|
|
208
|
-
{
|
|
209
|
-
"name": "Setup Poetry",
|
|
210
|
-
"uses": "snok/install-poetry@main",
|
|
211
|
-
}
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
if strategy_matrix:
|
|
215
|
-
steps.append(
|
|
216
|
-
{
|
|
217
|
-
# windows needs this step to find poetry
|
|
218
|
-
"name": "Add Poetry to PATH",
|
|
219
|
-
"run": "echo 'C:/Users/runneradmin/.local/bin' >> $GITHUB_PATH",
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
if configure_pipy_token:
|
|
224
|
-
steps.append(
|
|
225
|
-
{
|
|
226
|
-
"name": "Configure Poetry with PyPI Token",
|
|
227
|
-
"run": "poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}",
|
|
228
|
-
}
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
if install_dependencies:
|
|
232
|
-
steps.append({"name": "Install Dependencies", "run": "poetry install"})
|
|
233
|
-
|
|
234
|
-
if with_keyring:
|
|
235
|
-
steps.append(cls.get_setup_keyring_step())
|
|
236
|
-
|
|
237
|
-
return steps
|
|
238
|
-
|
|
239
|
-
@classmethod
|
|
240
|
-
def get_release_steps(cls) -> list[dict[str, Any]]:
|
|
241
|
-
"""Get the release steps."""
|
|
242
|
-
return [
|
|
243
|
-
*cls.get_poetry_setup_steps(
|
|
244
|
-
install_dependencies=True,
|
|
245
|
-
repo_token=True,
|
|
246
|
-
with_keyring=True,
|
|
247
|
-
),
|
|
248
|
-
cls.get_pre_commit_step(),
|
|
249
|
-
cls.get_commit_step(),
|
|
250
|
-
cls.get_extract_version_step(),
|
|
251
|
-
{
|
|
252
|
-
"name": "Tag and Push",
|
|
253
|
-
"run": f"git push && git tag {cls.get_version()} && git push origin {cls.get_version()}", # noqa: E501
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"name": "Build Changelog",
|
|
257
|
-
"id": "build_changelog",
|
|
258
|
-
"uses": "mikepenz/release-changelog-builder-action@develop",
|
|
259
|
-
"with": {"token": cls.get_github_token()},
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
"name": "Create GitHub Release",
|
|
263
|
-
"uses": "ncipollo/release-action@main",
|
|
264
|
-
"with": {
|
|
265
|
-
"tag": cls.get_version(),
|
|
266
|
-
"name": cls.get_repo_and_version(),
|
|
267
|
-
"body": "${{ steps.build_changelog.outputs.changelog }}",
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
]
|
|
271
|
-
|
|
272
|
-
@classmethod
|
|
273
|
-
def get_extract_version_step(cls) -> dict[str, Any]:
|
|
274
|
-
"""Get the extract version step."""
|
|
275
|
-
return {
|
|
276
|
-
"name": "Extract Version from pyproject.toml",
|
|
277
|
-
"id": "version",
|
|
278
|
-
"run": 'version=$(poetry version -s) && echo "Project version: $version" && echo "version=v$version" >> $GITHUB_OUTPUT', # noqa: E501
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
@classmethod
|
|
282
|
-
def get_publish_to_pypi_step(cls) -> dict[str, Any]:
|
|
283
|
-
"""Get the publish step."""
|
|
284
|
-
return {"name": "Build and publish to PyPI", "run": "poetry publish --build"}
|
|
285
|
-
|
|
286
|
-
@classmethod
|
|
287
|
-
def get_pre_commit_step(cls) -> dict[str, Any]:
|
|
288
|
-
"""Get the pre-commit step.
|
|
289
|
-
|
|
290
|
-
using pre commit in case other hooks are added later
|
|
291
|
-
and bc it fails if files are changed,
|
|
292
|
-
setup script shouldnt change files
|
|
293
|
-
"""
|
|
294
|
-
step: dict[str, Any] = {
|
|
295
|
-
"name": "Run Hooks",
|
|
296
|
-
# poetry run is necessary although the hook itself uses poetry run as well.
|
|
297
|
-
# not sure why, but on windows-latest the venv is not continued to the hooks
|
|
298
|
-
# and if you leave it here then pre-commit command is not found
|
|
299
|
-
"run": "poetry run pre-commit run --all-files --verbose",
|
|
300
|
-
}
|
|
301
|
-
if get_src_package() == winipedia_utils:
|
|
302
|
-
step["env"] = {"REPO_TOKEN": cls.get_repo_token()}
|
|
303
|
-
return step
|
|
304
|
-
|
|
305
|
-
@classmethod
|
|
306
|
-
def get_setup_git_step(cls) -> dict[str, Any]:
|
|
307
|
-
"""Get the setup git step."""
|
|
308
|
-
return {
|
|
309
|
-
"name": "Setup Git",
|
|
310
|
-
"run": 'git config --global user.email "github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"', # noqa: E501
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
@classmethod
|
|
314
|
-
def get_commit_step(cls) -> dict[str, Any]:
|
|
315
|
-
"""Get the commit step."""
|
|
316
|
-
return {
|
|
317
|
-
"name": "Commit added changes",
|
|
318
|
-
"run": "git commit --no-verify -m '[skip ci] CI/CD: Committing possible added changes (e.g.: pyproject.toml and poetry.lock)'", # noqa: E501
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
@classmethod
|
|
322
|
-
def get_setup_keyring_step(cls) -> dict[str, Any]:
|
|
323
|
-
"""Get the setup keyring step."""
|
|
324
|
-
return {
|
|
325
|
-
"name": "Setup CI keyring",
|
|
326
|
-
"run": 'poetry run pip install keyrings.alt && poetry run python -c "import keyring; from keyrings.alt.file import PlaintextKeyring; keyring.set_keyring(PlaintextKeyring());"', # noqa: E501
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
@classmethod
|
|
330
|
-
def get_protect_repository_step(cls) -> dict[str, Any]:
|
|
331
|
-
"""Get the protect repository step."""
|
|
332
|
-
from winipedia_utils.git.github.repo import ( # noqa: PLC0415
|
|
333
|
-
protect, # avoid circular import
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
return {
|
|
337
|
-
"name": "Protect Repository",
|
|
338
|
-
"run": f"poetry run python -m {make_obj_importpath(protect)}",
|
|
339
|
-
"env": {
|
|
340
|
-
"REPO_TOKEN": cls.get_repo_token(),
|
|
341
|
-
},
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
@classmethod
|
|
345
|
-
def get_repository_name(cls) -> str:
|
|
346
|
-
"""Get the repository name."""
|
|
347
|
-
return "${{ github.event.repository.name }}"
|
|
348
|
-
|
|
349
|
-
@classmethod
|
|
350
|
-
def get_ref_name(cls) -> str:
|
|
351
|
-
"""Get the ref name."""
|
|
352
|
-
return "${{ github.ref_name }}"
|
|
353
|
-
|
|
354
|
-
@classmethod
|
|
355
|
-
def get_version(cls) -> str:
|
|
356
|
-
"""Get the version."""
|
|
357
|
-
return "${{ steps.version.outputs.version }}"
|
|
358
|
-
|
|
359
|
-
@classmethod
|
|
360
|
-
def get_repo_and_version(cls) -> str:
|
|
361
|
-
"""Get the repository name and ref name."""
|
|
362
|
-
return f"{cls.get_repository_name()} {cls.get_version()}"
|
|
363
|
-
|
|
364
|
-
@classmethod
|
|
365
|
-
def get_ownwer(cls) -> str:
|
|
366
|
-
"""Get the repository owner."""
|
|
367
|
-
return "${{ github.repository_owner }}"
|
|
368
|
-
|
|
369
|
-
@classmethod
|
|
370
|
-
def get_github_token(cls) -> str:
|
|
371
|
-
"""Get the GitHub token."""
|
|
372
|
-
return "${{ secrets.GITHUB_TOKEN }}"
|
|
373
|
-
|
|
374
|
-
@classmethod
|
|
375
|
-
def get_repo_token(cls) -> str:
|
|
376
|
-
"""Get the repository token."""
|
|
377
|
-
return "${{ secrets.REPO_TOKEN }}"
|