winipedia-utils 0.2.63__py3-none-any.whl → 0.6.6__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.

Files changed (51) hide show
  1. winipedia_utils/artifacts/build.py +78 -0
  2. winipedia_utils/concurrent/concurrent.py +7 -2
  3. winipedia_utils/concurrent/multiprocessing.py +1 -2
  4. winipedia_utils/concurrent/multithreading.py +2 -2
  5. winipedia_utils/data/dataframe/cleaning.py +337 -100
  6. winipedia_utils/git/github/__init__.py +1 -0
  7. winipedia_utils/git/github/github.py +31 -0
  8. winipedia_utils/git/github/repo/__init__.py +1 -0
  9. winipedia_utils/git/github/repo/protect.py +103 -0
  10. winipedia_utils/git/github/repo/repo.py +205 -0
  11. winipedia_utils/git/github/workflows/base/__init__.py +1 -0
  12. winipedia_utils/git/github/workflows/base/base.py +889 -0
  13. winipedia_utils/git/github/workflows/health_check.py +69 -0
  14. winipedia_utils/git/github/workflows/publish.py +51 -0
  15. winipedia_utils/git/github/workflows/release.py +90 -0
  16. winipedia_utils/git/gitignore/config.py +77 -0
  17. winipedia_utils/git/gitignore/gitignore.py +5 -63
  18. winipedia_utils/git/pre_commit/config.py +49 -59
  19. winipedia_utils/git/pre_commit/hooks.py +46 -46
  20. winipedia_utils/git/pre_commit/run_hooks.py +19 -12
  21. winipedia_utils/iterating/iterate.py +63 -1
  22. winipedia_utils/modules/class_.py +69 -12
  23. winipedia_utils/modules/function.py +26 -3
  24. winipedia_utils/modules/inspection.py +56 -0
  25. winipedia_utils/modules/module.py +22 -28
  26. winipedia_utils/modules/package.py +116 -10
  27. winipedia_utils/projects/poetry/config.py +255 -112
  28. winipedia_utils/projects/poetry/poetry.py +230 -13
  29. winipedia_utils/projects/project.py +11 -42
  30. winipedia_utils/setup.py +11 -29
  31. winipedia_utils/testing/config.py +127 -0
  32. winipedia_utils/testing/create_tests.py +5 -19
  33. winipedia_utils/testing/skip.py +19 -0
  34. winipedia_utils/testing/tests/base/fixtures/fixture.py +36 -0
  35. winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +3 -3
  36. winipedia_utils/testing/tests/base/fixtures/scopes/module.py +9 -6
  37. winipedia_utils/testing/tests/base/fixtures/scopes/session.py +27 -176
  38. winipedia_utils/testing/tests/base/utils/utils.py +27 -57
  39. winipedia_utils/text/config.py +250 -0
  40. winipedia_utils/text/string.py +30 -0
  41. winipedia_utils-0.6.6.dist-info/METADATA +390 -0
  42. {winipedia_utils-0.2.63.dist-info → winipedia_utils-0.6.6.dist-info}/RECORD +46 -34
  43. winipedia_utils/consts.py +0 -21
  44. winipedia_utils/git/workflows/base/base.py +0 -77
  45. winipedia_utils/git/workflows/publish.py +0 -79
  46. winipedia_utils/git/workflows/release.py +0 -91
  47. winipedia_utils-0.2.63.dist-info/METADATA +0 -738
  48. /winipedia_utils/{git/workflows/base → artifacts}/__init__.py +0 -0
  49. /winipedia_utils/git/{workflows → github/workflows}/__init__.py +0 -0
  50. {winipedia_utils-0.2.63.dist-info → winipedia_utils-0.6.6.dist-info}/WHEEL +0 -0
  51. {winipedia_utils-0.2.63.dist-info → winipedia_utils-0.6.6.dist-info}/licenses/LICENSE +0 -0
@@ -1,79 +0,0 @@
1
- """Contains the publish workflow.
2
-
3
- This workflow is used to publish the package to PyPI with poetry.
4
- """
5
-
6
- from pathlib import Path
7
- from typing import Any
8
-
9
- import yaml
10
-
11
- from winipedia_utils.git.workflows.base.base import _get_poetry_setup_steps
12
- from winipedia_utils.git.workflows.release import WORKFLOW_NAME
13
-
14
- PUBLISH_WORKFLOW_PATH = Path(".github/workflows/publish.yaml")
15
-
16
-
17
- def load_publish_workflow() -> dict[str, Any]:
18
- """Load the publish workflow."""
19
- path = PUBLISH_WORKFLOW_PATH
20
- if not path.exists():
21
- path.parent.mkdir(parents=True, exist_ok=True)
22
- path.touch()
23
- return yaml.safe_load(path.read_text()) or {}
24
-
25
-
26
- def dump_publish_workflow(config: dict[str, Any]) -> None:
27
- """Dump the publish workflow."""
28
- path = PUBLISH_WORKFLOW_PATH
29
- with path.open("w") as f:
30
- yaml.safe_dump(config, f, sort_keys=False)
31
-
32
-
33
- def _get_publish_config() -> dict[str, Any]:
34
- """Dict that represents the publish workflow yaml."""
35
- return {
36
- "name": "Publish to PyPI",
37
- "on": {
38
- "workflow_run": {
39
- "workflows": [WORKFLOW_NAME],
40
- "types": ["completed"],
41
- },
42
- },
43
- "jobs": {
44
- "publish": {
45
- "runs-on": "ubuntu-latest",
46
- "if": "${{ github.event.workflow_run.conclusion == 'success' }}",
47
- "steps": [
48
- *(
49
- _get_poetry_setup_steps(
50
- configure_pipy_token=True,
51
- )
52
- ),
53
- {
54
- "name": "Build and publish to PyPI",
55
- "run": "poetry publish --build",
56
- },
57
- ],
58
- }
59
- },
60
- }
61
-
62
-
63
- def _publish_config_is_correct() -> bool:
64
- """Check if the publish workflow is correct."""
65
- config = load_publish_workflow()
66
- return bool(config == _get_publish_config())
67
-
68
-
69
- def _add_publish_workflow() -> None:
70
- """Add the publish workflow.
71
-
72
- If you delete the .github/workflows/publish.yaml file, then the tests will not fail.
73
- Not all projects need publishing to pypi. It is added on setup, but if you remove
74
- the file, then the tests will not fail and the tests will assume you don't want it.
75
- """
76
- if _publish_config_is_correct():
77
- return
78
- config = _get_publish_config()
79
- dump_publish_workflow(config)
@@ -1,91 +0,0 @@
1
- """Contains the release workflow.
2
-
3
- This workflow is used to create a release on GitHub.
4
- """
5
-
6
- from pathlib import Path
7
- from typing import Any
8
-
9
- import yaml
10
-
11
- from winipedia_utils.git.workflows.base.base import _get_poetry_setup_steps
12
-
13
- RELEASE_WORKFLOW_PATH = Path(".github/workflows/release.yaml")
14
-
15
- WORKFLOW_NAME = "Create Release"
16
-
17
-
18
- def load_release_workflow() -> dict[str, Any]:
19
- """Load the release workflow."""
20
- path = RELEASE_WORKFLOW_PATH
21
- if not path.exists():
22
- path.parent.mkdir(parents=True, exist_ok=True)
23
- path.touch()
24
- return yaml.safe_load(path.read_text()) or {}
25
-
26
-
27
- def dump_release_workflow(config: dict[str, Any]) -> None:
28
- """Dump the release workflow."""
29
- path = RELEASE_WORKFLOW_PATH
30
- with path.open("w") as f:
31
- yaml.safe_dump(config, f, sort_keys=False)
32
-
33
-
34
- def _get_release_config() -> dict[str, Any]:
35
- """Dict that represents the release workflow yaml."""
36
- repo_plus_ref = "${{ github.event.repository.name }}-${{ github.ref_name }}"
37
- return {
38
- "name": WORKFLOW_NAME,
39
- "on": {"push": {"tags": ["v*"]}},
40
- "permissions": {
41
- "contents": "write",
42
- },
43
- "run-name": WORKFLOW_NAME + ": " + repo_plus_ref,
44
- "jobs": {
45
- "release": {
46
- "runs-on": "ubuntu-latest",
47
- "steps": [
48
- *(
49
- _get_poetry_setup_steps(
50
- install_dependencies=True,
51
- fetch_depth=0,
52
- force_main_head=True,
53
- )
54
- ),
55
- {
56
- "name": "Run Pre-commit Hooks",
57
- "run": "poetry run pre-commit run --all-files",
58
- },
59
- {
60
- "name": "Build Changelog",
61
- "id": "build_changelog",
62
- "uses": "mikepenz/release-changelog-builder-action@v5",
63
- "with": {"token": "${{ secrets.GITHUB_TOKEN }}"},
64
- },
65
- {
66
- "name": "Create GitHub Release",
67
- "uses": "ncipollo/release-action@v1",
68
- "with": {
69
- "tag": "${{ github.ref_name }}",
70
- "name": repo_plus_ref,
71
- "body": "${{ steps.build_changelog.outputs.changelog }}",
72
- },
73
- },
74
- ],
75
- }
76
- },
77
- }
78
-
79
-
80
- def _release_config_is_correct() -> bool:
81
- """Check if the release workflow is correct."""
82
- config = load_release_workflow()
83
- return bool(config == _get_release_config())
84
-
85
-
86
- def _add_release_workflow() -> None:
87
- """Add the release workflow."""
88
- if _release_config_is_correct():
89
- return
90
- config = _get_release_config()
91
- dump_release_workflow(config)