winipedia-utils 0.4.53__tar.gz → 0.6.7__tar.gz

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.
Files changed (102) hide show
  1. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/PKG-INFO +52 -19
  2. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/README.md +51 -18
  3. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/pyproject.toml +3 -17
  4. winipedia_utils-0.6.7/winipedia_utils/artifacts/build.py +78 -0
  5. winipedia_utils-0.6.7/winipedia_utils/git/github/workflows/base/base.py +889 -0
  6. winipedia_utils-0.6.7/winipedia_utils/git/github/workflows/health_check.py +69 -0
  7. winipedia_utils-0.6.7/winipedia_utils/git/github/workflows/publish.py +51 -0
  8. winipedia_utils-0.6.7/winipedia_utils/git/github/workflows/release.py +90 -0
  9. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/pre_commit/config.py +3 -3
  10. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/pre_commit/hooks.py +15 -35
  11. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/pre_commit/run_hooks.py +18 -8
  12. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/modules/class_.py +11 -4
  13. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/modules/function.py +9 -3
  14. winipedia_utils-0.6.7/winipedia_utils/modules/inspection.py +56 -0
  15. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/modules/module.py +2 -32
  16. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/modules/package.py +2 -28
  17. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/projects/poetry/config.py +88 -26
  18. winipedia_utils-0.6.7/winipedia_utils/projects/poetry/poetry.py +248 -0
  19. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/projects/project.py +1 -2
  20. winipedia_utils-0.6.7/winipedia_utils/resources/svgs/__init__.py +1 -0
  21. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/create_tests.py +1 -1
  22. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/text/config.py +3 -3
  23. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/text/string.py +30 -0
  24. winipedia_utils-0.4.53/winipedia_utils/git/github/workflows/base/base.py +0 -341
  25. winipedia_utils-0.4.53/winipedia_utils/git/github/workflows/health_check.py +0 -58
  26. winipedia_utils-0.4.53/winipedia_utils/git/github/workflows/publish.py +0 -49
  27. winipedia_utils-0.4.53/winipedia_utils/git/github/workflows/release.py +0 -45
  28. winipedia_utils-0.4.53/winipedia_utils/projects/poetry/poetry.py +0 -129
  29. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/LICENSE +0 -0
  30. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/__init__.py +0 -0
  31. {winipedia_utils-0.4.53/winipedia_utils/data/dataframe → winipedia_utils-0.6.7/winipedia_utils/artifacts}/__init__.py +0 -0
  32. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/concurrent/__init__.py +0 -0
  33. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/concurrent/concurrent.py +0 -0
  34. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/concurrent/multiprocessing.py +0 -0
  35. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/concurrent/multithreading.py +0 -0
  36. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/data/__init__.py +0 -0
  37. {winipedia_utils-0.4.53/winipedia_utils/data/structures → winipedia_utils-0.6.7/winipedia_utils/data/dataframe}/__init__.py +0 -0
  38. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/data/dataframe/cleaning.py +0 -0
  39. {winipedia_utils-0.4.53/winipedia_utils/git/github → winipedia_utils-0.6.7/winipedia_utils/data/structures}/__init__.py +0 -0
  40. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/data/structures/dicts.py +0 -0
  41. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/__init__.py +0 -0
  42. {winipedia_utils-0.4.53/winipedia_utils/git/github/repo → winipedia_utils-0.6.7/winipedia_utils/git/github}/__init__.py +0 -0
  43. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/github/github.py +0 -0
  44. {winipedia_utils-0.4.53/winipedia_utils/git/github/workflows/base → winipedia_utils-0.6.7/winipedia_utils/git/github/repo}/__init__.py +0 -0
  45. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/github/repo/protect.py +0 -0
  46. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/github/repo/repo.py +0 -0
  47. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/github/workflows/__init__.py +0 -0
  48. {winipedia_utils-0.4.53/winipedia_utils/resources → winipedia_utils-0.6.7/winipedia_utils/git/github/workflows/base}/__init__.py +0 -0
  49. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/gitignore/__init__.py +0 -0
  50. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/gitignore/config.py +0 -0
  51. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/gitignore/gitignore.py +0 -0
  52. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/git/pre_commit/__init__.py +0 -0
  53. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/iterating/__init__.py +0 -0
  54. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/iterating/iterate.py +0 -0
  55. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/logging/__init__.py +0 -0
  56. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/logging/ansi.py +0 -0
  57. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/logging/config.py +0 -0
  58. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/logging/logger.py +0 -0
  59. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/modules/__init__.py +0 -0
  60. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/oop/__init__.py +0 -0
  61. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/oop/mixins/__init__.py +0 -0
  62. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/oop/mixins/meta.py +0 -0
  63. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/oop/mixins/mixin.py +0 -0
  64. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/os/__init__.py +0 -0
  65. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/os/os.py +0 -0
  66. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/projects/__init__.py +0 -0
  67. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/projects/poetry/__init__.py +0 -0
  68. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/py.typed +0 -0
  69. {winipedia_utils-0.4.53/winipedia_utils/resources/svgs → winipedia_utils-0.6.7/winipedia_utils/resources}/__init__.py +0 -0
  70. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/delete_garbage_can.svg +0 -0
  71. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/download_arrow.svg +0 -0
  72. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/exit_fullscreen_icon.svg +0 -0
  73. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/fullscreen_icon.svg +0 -0
  74. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/menu_icon.svg +0 -0
  75. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/pause_icon.svg +0 -0
  76. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/play_icon.svg +0 -0
  77. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/plus_icon.svg +0 -0
  78. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/resources/svgs/svg.py +0 -0
  79. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/security/__init__.py +0 -0
  80. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/security/cryptography.py +0 -0
  81. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/security/keyring.py +0 -0
  82. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/setup.py +0 -0
  83. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/__init__.py +0 -0
  84. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/assertions.py +0 -0
  85. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/config.py +0 -0
  86. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/convention.py +0 -0
  87. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/fixtures.py +0 -0
  88. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/skip.py +0 -0
  89. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/__init__.py +0 -0
  90. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/__init__.py +0 -0
  91. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/__init__.py +0 -0
  92. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/fixture.py +0 -0
  93. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/__init__.py +0 -0
  94. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +0 -0
  95. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/function.py +0 -0
  96. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/module.py +0 -0
  97. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/package.py +0 -0
  98. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/fixtures/scopes/session.py +0 -0
  99. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/utils/__init__.py +0 -0
  100. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/base/utils/utils.py +0 -0
  101. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/testing/tests/conftest.py +0 -0
  102. {winipedia_utils-0.4.53 → winipedia_utils-0.6.7}/winipedia_utils/text/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winipedia-utils
3
- Version: 0.4.53
3
+ Version: 0.6.7
4
4
  Summary: A package with many utility functions
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -105,7 +105,7 @@ The setup creates the following configuration files:
105
105
  - `.pre-commit-config.yaml` - Pre-commit hook configuration
106
106
  - `.gitignore` - Git ignore rules (assumes you added one on GitHub before.)
107
107
  - `pyproject.toml` - Project configuration with Poetry settings
108
- - `.github/workflows/health_check.yaml` - Health check workflow (Runs on every push and pull request, all workfows run on the latest possible python version in pyproject.toml)
108
+ - `.github/workflows/health_check.yaml` - Health check workflow (Runs on every push and pull request using a matrix strategy to test across multiple operating systems and Python versions)
109
109
  - `.github/workflows/release.yaml` - Release workflow (Creates a release on GitHub when the same actions as in health check pass and commits are pushed to main)
110
110
  - `.github/workflows/publish.yaml` - Publishing workflow (Publishes to PyPI when a release is created by the release workflow, if you use this workflow, you need to add a PYPI_TOKEN (named PYPI_TOKEN) to your GitHub secrets that has write access to the package on PyPI.)
111
111
  - `py.typed` - PEP 561 marker for type hints
@@ -114,27 +114,60 @@ The setup creates the following configuration files:
114
114
  - `conftest.py` - Pytest configuration file
115
115
  - `.python-version` - Python version file for pyenv (if you use pyenv, puts in the lowest supported python version in pyproject.toml opposed to the latest possible python version in workflows)
116
116
 
117
+ ### GitHub Workflows and Matrix Strategy
118
+
119
+ The project uses GitHub Actions workflows with a **matrix strategy** to ensure cross-platform compatibility:
120
+
121
+ #### Matrix Configuration
122
+
123
+ The health check and release workflows test your code across:
124
+ - **Operating Systems**: Ubuntu (latest), Windows (latest), macOS (latest)
125
+ - **Python Versions**: All versions specified in your `pyproject.toml` (e.g., 3.12, 3.13, 3.14)
126
+
127
+ This matrix strategy ensures your code works reliably across different environments before merging or releasing.
128
+
129
+ #### Workflow Structure
130
+
131
+ The health check workflow consists of two jobs:
132
+
133
+ 1. **Matrix Job** (`health_check_matrix`) - Runs all checks in parallel across the matrix of OS and Python versions:
134
+ - Checkout repository
135
+ - Setup Git, Python, and Poetry
136
+ - Add Poetry to PATH (Windows-specific step)
137
+ - Install dependencies
138
+ - Setup CI keyring
139
+ - Protect repository (applies branch protection rules and repository settings)
140
+ - Run pre-commit hooks (linting, formatting, type checking, security, tests)
141
+
142
+ 2. **Aggregation Job** (`health_check`) - Aggregates matrix results into a single status check:
143
+ - Required for branch protection compatibility
144
+ - Only runs after all matrix jobs complete successfully
145
+ - Provides a single status check that can be marked as required in branch protection rules
146
+
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.
149
+
117
150
  ### Pre-commit Hook Workflow
118
151
 
119
152
  When you commit code using `git commit`, the following checks run automatically:
120
153
 
121
154
  Info: If git commit fails bc of ModuleNotFoundError or smth similar, you need to run `poetry run git commit` instead.
122
155
  winipedia_utils hook is a python script that depends on winipedia_utils being installed. Poetry is needed to install winipedia_utils.
123
- 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.
124
-
125
- 1. Patch version (poetry version patch)
126
- 2. Add version patch to git (git add pyproject.toml)
127
- 3. Update package manager (poetry self update)
128
- 4. Install packages (poetry install --with dev)
129
- 5. Update packages (poetry update --with dev (winipedia_utils forces all dependencies with * to be updated to latest compatible version))
130
- 6. Lock dependencies (poetry lock)
131
- 7. Check package manager configs (poetry check --strict)
132
- 8. Create tests (python -m winipedia_utils.testing.create_tests)
133
- 9. Lint code (ruff check --fix)
134
- 10. Format code (ruff format)
135
- 11. Check static types (mypy)
136
- 12. Check security (bandit -c pyproject.toml -r .)
137
- 13. Run tests (pytest (uses pyproject.toml as config))
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.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))
138
171
 
139
172
  ### Auto-generated Test Structure
140
173
 
@@ -203,8 +236,8 @@ A ruleset named `main protection` is created for the `main` branch with the foll
203
236
  - Requires review thread resolution (all comments in reviews must be resolved before merge)
204
237
  - Allowed merge methods: `squash` and `rebase` (no merge commits, keeps history clean)
205
238
  - **Required Status Checks:**
206
- - Strict mode enabled (all status checks must pass on the latest commit, not older ones (sets the health check as required status check))
207
- - Health check workflow must pass (the CI/CD pipeline must complete successfully)
239
+ - Strict mode enabled (all status checks must pass on the latest commit, not older ones)
240
+ - Health check workflow must pass (the aggregated `health_check` job ensures all matrix combinations passed successfully)
208
241
  - **Bypass Actors** - Repository admins can bypass all rules (for emergency situations)
209
242
 
210
243
  ## Utilities
@@ -78,7 +78,7 @@ The setup creates the following configuration files:
78
78
  - `.pre-commit-config.yaml` - Pre-commit hook configuration
79
79
  - `.gitignore` - Git ignore rules (assumes you added one on GitHub before.)
80
80
  - `pyproject.toml` - Project configuration with Poetry settings
81
- - `.github/workflows/health_check.yaml` - Health check workflow (Runs on every push and pull request, all workfows run on the latest possible python version in pyproject.toml)
81
+ - `.github/workflows/health_check.yaml` - Health check workflow (Runs on every push and pull request using a matrix strategy to test across multiple operating systems and Python versions)
82
82
  - `.github/workflows/release.yaml` - Release workflow (Creates a release on GitHub when the same actions as in health check pass and commits are pushed to main)
83
83
  - `.github/workflows/publish.yaml` - Publishing workflow (Publishes to PyPI when a release is created by the release workflow, if you use this workflow, you need to add a PYPI_TOKEN (named PYPI_TOKEN) to your GitHub secrets that has write access to the package on PyPI.)
84
84
  - `py.typed` - PEP 561 marker for type hints
@@ -87,27 +87,60 @@ The setup creates the following configuration files:
87
87
  - `conftest.py` - Pytest configuration file
88
88
  - `.python-version` - Python version file for pyenv (if you use pyenv, puts in the lowest supported python version in pyproject.toml opposed to the latest possible python version in workflows)
89
89
 
90
+ ### GitHub Workflows and Matrix Strategy
91
+
92
+ The project uses GitHub Actions workflows with a **matrix strategy** to ensure cross-platform compatibility:
93
+
94
+ #### Matrix Configuration
95
+
96
+ The health check and release workflows test your code across:
97
+ - **Operating Systems**: Ubuntu (latest), Windows (latest), macOS (latest)
98
+ - **Python Versions**: All versions specified in your `pyproject.toml` (e.g., 3.12, 3.13, 3.14)
99
+
100
+ This matrix strategy ensures your code works reliably across different environments before merging or releasing.
101
+
102
+ #### Workflow Structure
103
+
104
+ The health check workflow consists of two jobs:
105
+
106
+ 1. **Matrix Job** (`health_check_matrix`) - Runs all checks in parallel across the matrix of OS and Python versions:
107
+ - Checkout repository
108
+ - Setup Git, Python, and Poetry
109
+ - Add Poetry to PATH (Windows-specific step)
110
+ - Install dependencies
111
+ - Setup CI keyring
112
+ - Protect repository (applies branch protection rules and repository settings)
113
+ - Run pre-commit hooks (linting, formatting, type checking, security, tests)
114
+
115
+ 2. **Aggregation Job** (`health_check`) - Aggregates matrix results into a single status check:
116
+ - Required for branch protection compatibility
117
+ - Only runs after all matrix jobs complete successfully
118
+ - Provides a single status check that can be marked as required in branch protection rules
119
+
120
+ The release workflow extends the health check workflow and adds a release job that runs after all health checks pass.
121
+ 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.
122
+
90
123
  ### Pre-commit Hook Workflow
91
124
 
92
125
  When you commit code using `git commit`, the following checks run automatically:
93
126
 
94
127
  Info: If git commit fails bc of ModuleNotFoundError or smth similar, you need to run `poetry run git commit` instead.
95
128
  winipedia_utils hook is a python script that depends on winipedia_utils being installed. Poetry is needed to install winipedia_utils.
96
- 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.
97
-
98
- 1. Patch version (poetry version patch)
99
- 2. Add version patch to git (git add pyproject.toml)
100
- 3. Update package manager (poetry self update)
101
- 4. Install packages (poetry install --with dev)
102
- 5. Update packages (poetry update --with dev (winipedia_utils forces all dependencies with * to be updated to latest compatible version))
103
- 6. Lock dependencies (poetry lock)
104
- 7. Check package manager configs (poetry check --strict)
105
- 8. Create tests (python -m winipedia_utils.testing.create_tests)
106
- 9. Lint code (ruff check --fix)
107
- 10. Format code (ruff format)
108
- 11. Check static types (mypy)
109
- 12. Check security (bandit -c pyproject.toml -r .)
110
- 13. Run tests (pytest (uses pyproject.toml as config))
129
+ 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.
130
+
131
+ Hooks run in the following order:
132
+
133
+ - Update package manager (poetry self update)
134
+ - Install packages (poetry install --with dev)
135
+ - Update packages (poetry update --with dev (winipedia_utils forces all dependencies with * to be updated to latest compatible version))
136
+ - Lock dependencies (poetry lock)
137
+ - Check package manager configs (poetry check --strict)
138
+ - Create tests (python -m winipedia_utils.testing.create_tests)
139
+ - Lint code (ruff check --fix)
140
+ - Format code (ruff format)
141
+ - Check static types (mypy)
142
+ - Check security (bandit -c pyproject.toml -r .)
143
+ - Run tests (pytest (uses pyproject.toml as config))
111
144
 
112
145
  ### Auto-generated Test Structure
113
146
 
@@ -176,8 +209,8 @@ A ruleset named `main protection` is created for the `main` branch with the foll
176
209
  - Requires review thread resolution (all comments in reviews must be resolved before merge)
177
210
  - Allowed merge methods: `squash` and `rebase` (no merge commits, keeps history clean)
178
211
  - **Required Status Checks:**
179
- - Strict mode enabled (all status checks must pass on the latest commit, not older ones (sets the health check as required status check))
180
- - Health check workflow must pass (the CI/CD pipeline must complete successfully)
212
+ - Strict mode enabled (all status checks must pass on the latest commit, not older ones)
213
+ - Health check workflow must pass (the aggregated `health_check` job ensures all matrix combinations passed successfully)
181
214
  - **Bypass Actors** - Repository admins can bypass all rules (for emergency situations)
182
215
 
183
216
  ## Utilities
@@ -1,17 +1,17 @@
1
1
  # Project section
2
2
  [project]
3
3
  name = "winipedia-utils"
4
- version = "0.4.53"
4
+ version = "0.6.7"
5
5
  description = "A package with many utility functions"
6
6
  readme = "README.md"
7
7
  requires-python = ">=3.12"
8
- dynamic = [ "dependencies",]
9
8
  authors = [
10
9
  { name = "Winipedia", email = "win.steveker@gmx.de"}
11
10
  ]
12
11
  license = "MIT"
12
+ dependencies = ["polars", "pyyaml", "keyring", "pygithub", "pathspec", "networkx", "setuptools", "tqdm", "defusedxml", "cryptography", "tomlkit", "dotenv"]
13
13
 
14
- # Build system section
14
+ # Build system section[build-system]
15
15
  [build-system]
16
16
  requires = [ "poetry-core>=2.0.0,<3.0.0",]
17
17
  build-backend = "poetry.core.masonry.api"
@@ -20,20 +20,6 @@ build-backend = "poetry.core.masonry.api"
20
20
  [[tool.poetry.packages]]
21
21
  include = "winipedia_utils"
22
22
 
23
- [tool.poetry.dependencies]
24
- tqdm = "*"
25
- setuptools = "*"
26
- defusedxml = "*"
27
- tomlkit = "*"
28
- pathspec = "*"
29
- pyyaml = "*"
30
- keyring = "*"
31
- cryptography = "*"
32
- polars = "*"
33
- pygithub = "*"
34
- dotenv = "*"
35
- networkx = "*"
36
-
37
23
  [tool.poetry.group.dev.dependencies]
38
24
  ruff = "*"
39
25
  pre-commit = "*"
@@ -0,0 +1,78 @@
1
+ """Build utilities for creating and managing project builds.
2
+
3
+ This module provides functions for building and managing project artifacts,
4
+ including creating build scripts, configuring build environments, and
5
+ handling build dependencies. These utilities help with the packaging and
6
+ distribution of project code.
7
+ """
8
+
9
+ import platform
10
+ from abc import abstractmethod
11
+ from pathlib import Path
12
+
13
+ from winipedia_utils.git.github.workflows.base.base import Workflow
14
+ from winipedia_utils.oop.mixins.mixin import ABCLoggingMixin
15
+
16
+
17
+ class Build(ABCLoggingMixin):
18
+ """Base class for build scripts.
19
+
20
+ Subclass this class and implement the get_artifacts method to create
21
+ a build script for your project. The build method will be called
22
+ automatically when the class is initialized. At the end of the file add
23
+ if __name__ == "__main__":
24
+ YourBuildClass()
25
+ """
26
+
27
+ ARTIFACTS_PATH = Workflow.ARTIFACTS_PATH
28
+
29
+ @classmethod
30
+ @abstractmethod
31
+ def get_artifacts(cls) -> list[Path]:
32
+ """Build the project.
33
+
34
+ Returns:
35
+ list[Path]: List of paths to the built artifacts
36
+ """
37
+
38
+ @classmethod
39
+ def __init__(cls) -> None:
40
+ """Initialize the build script."""
41
+ cls.build()
42
+
43
+ @classmethod
44
+ def build(cls) -> None:
45
+ """Build the project.
46
+
47
+ This method is called by the __init__ method.
48
+ It takes all the files and renames them with -platform.system()
49
+ and puts them in the artifacts folder.
50
+ """
51
+ cls.ARTIFACTS_PATH.mkdir(parents=True, exist_ok=True)
52
+ artifacts = cls.get_artifacts()
53
+ for artifact in artifacts:
54
+ parent = artifact.parent
55
+ if parent != cls.ARTIFACTS_PATH:
56
+ msg = f"You must create {artifact} in {cls.ARTIFACTS_PATH}"
57
+ raise FileNotFoundError(msg)
58
+
59
+ # rename the files with -platform.system()
60
+ new_name = f"{artifact.stem}-{platform.system()}{artifact.suffix}"
61
+ new_path = cls.ARTIFACTS_PATH / new_name
62
+ artifact.rename(new_path)
63
+
64
+
65
+ class WinipediaUtilsBuild(Build):
66
+ """Build script for winipedia_utils."""
67
+
68
+ @classmethod
69
+ def get_artifacts(cls) -> list[Path]:
70
+ """Build the project."""
71
+ paths = [cls.ARTIFACTS_PATH / "build.txt"]
72
+ for path in paths:
73
+ path.write_text("Hello World!")
74
+ return paths
75
+
76
+
77
+ if __name__ == "__main__":
78
+ WinipediaUtilsBuild()