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

@@ -6,14 +6,73 @@ handling build dependencies. These utilities help with the packaging and
6
6
  distribution of project code.
7
7
  """
8
8
 
9
+ import platform
10
+ from abc import abstractmethod
11
+ from pathlib import Path
12
+
9
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.name}-{platform.system()}"
61
+ new_path = cls.ARTIFACTS_PATH / new_name
62
+ artifact.rename(new_path)
63
+
10
64
 
65
+ class WinipediaUtilsBuild(Build):
66
+ """Build script for winipedia_utils."""
11
67
 
12
- def build_project() -> None:
13
- """Build the project."""
14
- # create a file with random content in BUILD_DIR
15
- (Workflow.ARTIFACTS_PATH / "build.txt").write_text("Hello World!")
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
16
75
 
17
76
 
18
77
  if __name__ == "__main__":
19
- build_project()
78
+ WinipediaUtilsBuild()
@@ -67,7 +67,6 @@ class ReleaseWorkflow(HealthCheckWorkflow):
67
67
  return [cls.step_no_build_script()]
68
68
  return [
69
69
  *cls.steps_core_matrix_setup(),
70
- cls.step_create_artifacts_folder(),
71
70
  cls.step_build_artifacts(),
72
71
  cls.step_upload_artifacts(),
73
72
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winipedia-utils
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: A package with many utility functions
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  winipedia_utils/__init__.py,sha256=vOWZ8n-YemVIzDLd8eWw1HVPGH3jxuT6VtDKHbmxk_A,43
2
2
  winipedia_utils/artifacts/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
3
- winipedia_utils/artifacts/build.py,sha256=WMlNcHwozg3oTmGSJLzsGAb-d4xuMvq51jetJNBkw-g,617
3
+ winipedia_utils/artifacts/build.py,sha256=PsTJ1dMbNLZGG96s_4smUb_cDIEajFa6HI94hQgXTzU,2411
4
4
  winipedia_utils/concurrent/__init__.py,sha256=Tu0ig4gVCk_f1n74G35hDwH-WS3P3STVQGWjxTIbbo8,54
5
5
  winipedia_utils/concurrent/concurrent.py,sha256=h2vgxeDFsagZ10LnHKkswwF2bjY_L1hXKutejeJo48U,8648
6
6
  winipedia_utils/concurrent/multiprocessing.py,sha256=1pnAU-CS3crNOKlp68gCCvNbTvNJs0in_VASMpZ7M1c,4721
@@ -21,7 +21,7 @@ winipedia_utils/git/github/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3le
21
21
  winipedia_utils/git/github/workflows/base/base.py,sha256=Q2vTN98XlhDvLVjNEjDpAwQFchFXkPNuPNwAinqcPXE,28281
22
22
  winipedia_utils/git/github/workflows/health_check.py,sha256=Ghehk7LWV3ZH2283DRoNBEF3PDZtwNhiWwMq93CeDrk,2205
23
23
  winipedia_utils/git/github/workflows/publish.py,sha256=dNCcSBu7eTjmzomk3qX7BZpTzhwT5oM3Ap3hw22uoJE,1470
24
- winipedia_utils/git/github/workflows/release.py,sha256=WEAUglUFBE4OslzC_rnCHyLeIqo09majt2ps7UzA8jM,2928
24
+ winipedia_utils/git/github/workflows/release.py,sha256=KgtbsAKlkBqNCsYKfdeN2OXINk4v2f9IK1Oh5eGplI0,2880
25
25
  winipedia_utils/git/gitignore/__init__.py,sha256=k-2E26JaZPkF69UUOJkpQl8T_PudrC7EYCIOxwgIQVU,57
26
26
  winipedia_utils/git/gitignore/config.py,sha256=Oi1gAf2mbR7vxMi0zsAFpCGzDaLNDd5S2vXEmA3eKg4,2595
27
27
  winipedia_utils/git/gitignore/gitignore.py,sha256=uE2MdynWgQuTG-y2YLR0FU5_giSE7s_TqSVQ6vnNOf8,2419
@@ -91,7 +91,7 @@ winipedia_utils/testing/tests/conftest.py,sha256=BLgUJtLecOwuEsIyJ__0buqovd5AhiG
91
91
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
92
92
  winipedia_utils/text/config.py,sha256=jjKmn-tSbyaK6jGL0FxFHSREP6A6V1ZSX3RuIgvQ4io,7794
93
93
  winipedia_utils/text/string.py,sha256=uHqpm1yXumiSDD7MZxfdkRS_4paQ5wIJweeBJK2bCdQ,4332
94
- winipedia_utils-0.6.2.dist-info/METADATA,sha256=O4RWXegoBUm5RKCD3VdC7zUOonCCJSiDvRcawVL77Io,17002
95
- winipedia_utils-0.6.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
96
- winipedia_utils-0.6.2.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
97
- winipedia_utils-0.6.2.dist-info/RECORD,,
94
+ winipedia_utils-0.6.3.dist-info/METADATA,sha256=_DzRAci7xJlhCmg3i216qV0cjsFPKAMvIGLsXuwqmow,17002
95
+ winipedia_utils-0.6.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
96
+ winipedia_utils-0.6.3.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
97
+ winipedia_utils-0.6.3.dist-info/RECORD,,