winipedia-utils 0.1.7__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.
- winipedia_utils/git/pre_commit/config.py +8 -0
- winipedia_utils/projects/project.py +29 -0
- winipedia_utils/setup.py +5 -4
- {winipedia_utils-0.1.7.dist-info → winipedia_utils-0.1.9.dist-info}/METADATA +1 -1
- {winipedia_utils-0.1.7.dist-info → winipedia_utils-0.1.9.dist-info}/RECORD +7 -7
- {winipedia_utils-0.1.7.dist-info → winipedia_utils-0.1.9.dist-info}/LICENSE +0 -0
- {winipedia_utils-0.1.7.dist-info → winipedia_utils-0.1.9.dist-info}/WHEEL +0 -0
@@ -6,6 +6,8 @@ from typing import Any
|
|
6
6
|
import yaml
|
7
7
|
|
8
8
|
from winipedia_utils.logging.logger import get_logger
|
9
|
+
from winipedia_utils.os.os import run_subprocess
|
10
|
+
from winipedia_utils.projects.poetry.poetry import POETRY_RUN_ARGS
|
9
11
|
|
10
12
|
logger = get_logger(__name__)
|
11
13
|
|
@@ -58,3 +60,9 @@ def _add_package_hook_to_pre_commit_config() -> None:
|
|
58
60
|
logger.info("Adding winipedia-utils hook to pre-commit config")
|
59
61
|
config["repos"] = [package_hook_config, *config.get("repos", [])]
|
60
62
|
dump_pre_commit_config(config)
|
63
|
+
|
64
|
+
|
65
|
+
def _pre_commit_install() -> None:
|
66
|
+
"""Install pre-commit."""
|
67
|
+
logger.info("Running pre-commit install")
|
68
|
+
run_subprocess([*POETRY_RUN_ARGS, "pre-commit", "install"], check=True)
|
@@ -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)
|
winipedia_utils/setup.py
CHANGED
@@ -7,15 +7,16 @@ This script is intended to be called once at the beginning of a project.
|
|
7
7
|
"""
|
8
8
|
|
9
9
|
from winipedia_utils.git.gitignore.gitignore import _add_package_patterns_to_gitignore
|
10
|
-
from winipedia_utils.git.pre_commit.config import
|
10
|
+
from winipedia_utils.git.pre_commit.config import (
|
11
|
+
_add_package_hook_to_pre_commit_config,
|
12
|
+
_pre_commit_install,
|
13
|
+
)
|
11
14
|
from winipedia_utils.git.pre_commit.run_hooks import _run_all_hooks
|
12
15
|
from winipedia_utils.logging.logger import get_logger
|
13
|
-
from winipedia_utils.os.os import run_subprocess
|
14
16
|
from winipedia_utils.projects.poetry.config import (
|
15
17
|
_add_configurations_to_pyproject_toml,
|
16
18
|
)
|
17
19
|
from winipedia_utils.projects.poetry.poetry import (
|
18
|
-
POETRY_RUN_ARGS,
|
19
20
|
_install_dev_dependencies,
|
20
21
|
)
|
21
22
|
from winipedia_utils.projects.project import _create_project_root
|
@@ -30,7 +31,7 @@ def _setup() -> None:
|
|
30
31
|
# create pre-commit config
|
31
32
|
_add_package_hook_to_pre_commit_config()
|
32
33
|
# install pre-commit
|
33
|
-
|
34
|
+
_pre_commit_install()
|
34
35
|
# add patterns to .gitignore
|
35
36
|
_add_package_patterns_to_gitignore()
|
36
37
|
# add tool.* configurations to pyproject.toml
|
@@ -14,7 +14,7 @@ winipedia_utils/git/__init__.py,sha256=pPo5DDqaQkFim8L6x22DXjqthLnKAxLyXlXl7JXGU
|
|
14
14
|
winipedia_utils/git/gitignore/__init__.py,sha256=t65uvpOaNvh7ICgwuJFRr7vS2nWfxzWUGIpnJs0_jzE,58
|
15
15
|
winipedia_utils/git/gitignore/gitignore.py,sha256=wCU2lRztTFKQ7JrKnCqPLCsuVRjfx8wGfTy42BLgFJI,4512
|
16
16
|
winipedia_utils/git/pre_commit/__init__.py,sha256=2sBe5nOqmm3qb8YjhZzE4tCHhqxWOZ6R2ECljSVG7i4,59
|
17
|
-
winipedia_utils/git/pre_commit/config.py,sha256=
|
17
|
+
winipedia_utils/git/pre_commit/config.py,sha256=gxRdR36_3ZLG_XcQsuGXApCsklCXvkc0_ToP1cpXPQk,2272
|
18
18
|
winipedia_utils/git/pre_commit/hooks.py,sha256=Q6rXvbpUf9UasQ8vSBruoLA-wjm37jamvIUkXJ1B3FE,3210
|
19
19
|
winipedia_utils/git/pre_commit/run_hooks.py,sha256=WoF1WDr07mS2GpKt0M-TpnuWfS0-Hwa4tP6z_9-JqlU,1572
|
20
20
|
winipedia_utils/iterating/__init__.py,sha256=TZ0SSFA3zCJLk0z3IsLMxJqsfGzfxOSUKbQmwW-Dsqg,54
|
@@ -38,9 +38,9 @@ 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=
|
41
|
+
winipedia_utils/projects/project.py,sha256=2nz1Hh51A-shjgdPCgiDw-ODrVtOtiHEHQnMPjAJZ-A,1587
|
42
42
|
winipedia_utils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
43
|
-
winipedia_utils/setup.py,sha256=
|
43
|
+
winipedia_utils/setup.py,sha256=F4NneO0wVTf7JCXLorWjTOdJl36N5fLSksoWMe4p86o,1650
|
44
44
|
winipedia_utils/testing/__init__.py,sha256=kXhB5xw02ec5xpcW_KV--9CBKdyCjnuR-NZzAJ5tq0g,51
|
45
45
|
winipedia_utils/testing/assertions.py,sha256=0JF4mqVTnLQ1qkAL_FuTwyN_idr00rvVlta7aDdnUXA,851
|
46
46
|
winipedia_utils/testing/convention.py,sha256=NxC_hYaUXshsa6LL6nQoEEKpTzC1KwTloKL8aS2gUPI,5010
|
@@ -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.
|
65
|
-
winipedia_utils-0.1.
|
66
|
-
winipedia_utils-0.1.
|
67
|
-
winipedia_utils-0.1.
|
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,,
|
File without changes
|
File without changes
|