winipedia-utils 0.1.8__py3-none-any.whl → 0.1.10__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.
@@ -143,6 +143,10 @@ def get_modules_and_packages_from_package(
143
143
  else:
144
144
  modules.append(mod)
145
145
 
146
+ # make consistent order
147
+ packages.sort(key=lambda p: p.__name__)
148
+ modules.sort(key=lambda m: m.__name__)
149
+
146
150
  return packages, modules
147
151
 
148
152
 
@@ -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.10
4
4
  Summary: A package with many utility functions
5
5
  License: MIT
6
6
  Author: Winipedia
@@ -27,7 +27,7 @@ winipedia_utils/modules/__init__.py,sha256=e3CFaC3FhK4ibknFOv1bqOZxA7XeVwmLqWX7o
27
27
  winipedia_utils/modules/class_.py,sha256=RDjal6QYYs9z81DT1mIFrnEhQ9vgN2tCAYN1WWnN24Y,2462
28
28
  winipedia_utils/modules/function.py,sha256=Qn1OPV5dwO-7f3a0f0RpWcrH-E9teGPwldRtwbFYzRM,2551
29
29
  winipedia_utils/modules/module.py,sha256=mxaAsRl02CAq_bTW2HsmzRWoyC9jKNM8Q4xdgdQlgd0,12719
30
- winipedia_utils/modules/package.py,sha256=jPI7fcJ5VFWO7nRvjB6cGv_mahx0BUej9qhKARSK_Vk,12485
30
+ winipedia_utils/modules/package.py,sha256=kCm4pXQdllafo-2dmWZTvaAqRruzh3iF4hseHlCmTlU,12605
31
31
  winipedia_utils/oop/__init__.py,sha256=wGjsVwLbTVEQWOfDJvN9nlvC-3NmAi8Doc2xIrm6e78,47
32
32
  winipedia_utils/oop/mixins/__init__.py,sha256=PDK-cJcdRUfDUCz36qQ5pmMW07G133WtN49OpmILGNI,54
33
33
  winipedia_utils/oop/mixins/meta.py,sha256=UpHags1j80OABxW4Q3QYt7A7lLIArvgUrGcWeYJaRyU,10576
@@ -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.10.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
+ winipedia_utils-0.1.10.dist-info/METADATA,sha256=-jB1-lzknCwX6DQlK-fiAt8jkwg86Z5xlzHa5OyQ6CA,12385
66
+ winipedia_utils-0.1.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
+ winipedia_utils-0.1.10.dist-info/RECORD,,