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
@@ -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()
@@ -20,8 +20,6 @@ from typing import TYPE_CHECKING, Any, cast
20
20
 
21
21
  from tqdm import tqdm
22
22
 
23
- from winipedia_utils.concurrent.multiprocessing import get_spwan_pool
24
- from winipedia_utils.concurrent.multithreading import imap_unordered
25
23
  from winipedia_utils.iterating.iterate import get_len_with_default
26
24
  from winipedia_utils.logging.logger import get_logger
27
25
 
@@ -210,6 +208,13 @@ def concurrent_loop( # noqa: PLR0913
210
208
  Returns:
211
209
  list[Any]: Results from the process_function executions
212
210
  """
211
+ from winipedia_utils.concurrent.multiprocessing import ( # noqa: PLC0415 # avoid circular import
212
+ get_spwan_pool,
213
+ )
214
+ from winipedia_utils.concurrent.multithreading import ( # noqa: PLC0415 # avoid circular import
215
+ imap_unordered,
216
+ )
217
+
213
218
  process_args_len = get_len_with_default(process_args, process_args_len)
214
219
  process_args = generate_process_args(
215
220
  process_function=process_function,
@@ -15,6 +15,7 @@ from functools import wraps
15
15
  from multiprocessing.pool import Pool
16
16
  from typing import Any
17
17
 
18
+ from winipedia_utils.concurrent.concurrent import concurrent_loop
18
19
  from winipedia_utils.logging.logger import get_logger
19
20
 
20
21
  logger = get_logger(__name__)
@@ -118,8 +119,6 @@ def multiprocess_loop(
118
119
  Also given functions must be pickle-able.
119
120
 
120
121
  """
121
- from winipedia_utils.concurrent.concurrent import concurrent_loop
122
-
123
122
  return concurrent_loop(
124
123
  threading=False,
125
124
  process_function=process_function,
@@ -15,6 +15,8 @@ from collections.abc import Callable, Generator, Iterable
15
15
  from concurrent.futures import Future, ThreadPoolExecutor, as_completed
16
16
  from typing import Any
17
17
 
18
+ from winipedia_utils.concurrent.concurrent import concurrent_loop
19
+
18
20
 
19
21
  def get_future_results_as_completed(
20
22
  futures: Iterable[Future[Any]],
@@ -62,8 +64,6 @@ def multithread_loop(
62
64
  ThreadPoolExecutor is used for I/O-bound tasks, not for CPU-bound tasks.
63
65
 
64
66
  """
65
- from winipedia_utils.concurrent.concurrent import concurrent_loop
66
-
67
67
  return concurrent_loop(
68
68
  threading=True,
69
69
  process_function=process_function,