winipedia-utils 0.1.8__py3-none-any.whl → 0.1.9__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.
@@ -1,5 +1,7 @@
1
1
  """Utilities for working with Python projects."""
2
2
 
3
+ from types import ModuleType
4
+
3
5
  from winipedia_utils.modules.module import create_module, to_path
4
6
  from winipedia_utils.modules.package import get_src_package
5
7
  from winipedia_utils.projects.poetry.config import get_poetry_package_name
@@ -17,3 +19,30 @@ def _create_py_typed() -> None:
17
19
  src_package_name = get_src_package().__name__
18
20
  py_typed_path = to_path(src_package_name, is_package=True) / "py.typed"
19
21
  py_typed_path.touch()
22
+
23
+
24
+ def make_name_from_package(
25
+ package: ModuleType,
26
+ split_on: str = "_",
27
+ join_on: str = "-",
28
+ *,
29
+ capitalize: bool = True,
30
+ ) -> str:
31
+ """Make a name from a package.
32
+
33
+ takes a package and makes a name from it that is readable by humans.
34
+
35
+ Args:
36
+ package (ModuleType): The package to make a name from
37
+ split_on (str, optional): what to split the package name on. Defaults to "_".
38
+ join_on (str, optional): what to join the package name with. Defaults to "-".
39
+ capitalize (bool, optional): Whether to capitalize each part. Defaults to True.
40
+
41
+ Returns:
42
+ str: _description_
43
+ """
44
+ package_name = package.__name__.split(".")[-1]
45
+ parts = package_name.split(split_on)
46
+ if capitalize:
47
+ parts = [part.capitalize() for part in parts]
48
+ return join_on.join(parts)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: winipedia-utils
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A package with many utility functions
5
5
  License: MIT
6
6
  Author: Winipedia
@@ -38,7 +38,7 @@ winipedia_utils/projects/__init__.py,sha256=6oTiSlUMAwO5xnH4SGVnvspzKcxrxo9kn1L4
38
38
  winipedia_utils/projects/poetry/__init__.py,sha256=0yNMuu9KmM19od4VBxBV3HLK-RdCsa0e2Zhg33J7RmQ,60
39
39
  winipedia_utils/projects/poetry/config.py,sha256=eEAU-9_uCEeOYx2lTAfydmH3D_YYTx6nOJ204q38BVY,2971
40
40
  winipedia_utils/projects/poetry/poetry.py,sha256=5jyUSMxhCZ7pz9bOaz5E9r7Da9qIrGOp6wcBzI1y7Cg,932
41
- winipedia_utils/projects/project.py,sha256=GRprpzhasBtV9OtPhQE2HxeufOzcJgbaCZbrW34YnnE,691
41
+ winipedia_utils/projects/project.py,sha256=2nz1Hh51A-shjgdPCgiDw-ODrVtOtiHEHQnMPjAJZ-A,1587
42
42
  winipedia_utils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
43
43
  winipedia_utils/setup.py,sha256=F4NneO0wVTf7JCXLorWjTOdJl36N5fLSksoWMe4p86o,1650
44
44
  winipedia_utils/testing/__init__.py,sha256=kXhB5xw02ec5xpcW_KV--9CBKdyCjnuR-NZzAJ5tq0g,51
@@ -61,7 +61,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23Mfz
61
61
  winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
62
62
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
63
63
  winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
64
- winipedia_utils-0.1.8.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
- winipedia_utils-0.1.8.dist-info/METADATA,sha256=ivNItMjWP4li1SPXuTUCK_amIfCZfJtBBCfoW4vGMkc,12384
66
- winipedia_utils-0.1.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
- winipedia_utils-0.1.8.dist-info/RECORD,,
64
+ winipedia_utils-0.1.9.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
+ winipedia_utils-0.1.9.dist-info/METADATA,sha256=K-tV678jB4FVxS6eQzunfkIa0uUk_oem2VQagsLA7Y0,12384
66
+ winipedia_utils-0.1.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
+ winipedia_utils-0.1.9.dist-info/RECORD,,