winipedia-utils 0.1.1__py3-none-any.whl → 0.1.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.
@@ -28,7 +28,7 @@ from winipedia_utils.logging.logger import get_logger
28
28
  logger = get_logger(__name__)
29
29
 
30
30
 
31
- def get_scr_package() -> ModuleType:
31
+ def get_src_package() -> ModuleType:
32
32
  """Identify and return the main source package of the project.
33
33
 
34
34
  Discovers the main source package by finding all top-level packages
@@ -75,7 +75,7 @@ def _pyproject_tool_configs_are_correct() -> bool:
75
75
  return True
76
76
 
77
77
 
78
- def _add_tool_configurations_to_pyproject_toml() -> None:
78
+ def _add_configurations_to_pyproject_toml() -> None:
79
79
  """Add tool.* configurations to pyproject.toml."""
80
80
  expected_tool_dict = _get_pyproject_toml_tool_configs()
81
81
  toml = laod_pyproject_toml()
@@ -0,0 +1,19 @@
1
+ """Utilities for working with Python projects."""
2
+
3
+ from winipedia_utils.modules.module import create_module, to_path
4
+ from winipedia_utils.modules.package import get_src_package
5
+ from winipedia_utils.projects.poetry.config import get_poetry_package_name
6
+
7
+
8
+ def _create_project_root() -> None:
9
+ """Create the project root."""
10
+ src_package_name = get_poetry_package_name()
11
+ create_module(src_package_name, is_package=True)
12
+ _create_py_typed()
13
+
14
+
15
+ def _create_py_typed() -> None:
16
+ """Create the py.typed file."""
17
+ src_package_name = get_src_package().__name__
18
+ py_typed_path = to_path(src_package_name, is_package=True) / "py.typed"
19
+ py_typed_path.touch()
@@ -0,0 +1 @@
1
+
winipedia_utils/setup.py CHANGED
@@ -11,11 +11,12 @@ from winipedia_utils.git.pre_commit.config import _add_package_hook_to_pre_commi
11
11
  from winipedia_utils.git.pre_commit.run_hooks import _run_all_hooks
12
12
  from winipedia_utils.logging.logger import get_logger
13
13
  from winipedia_utils.projects.poetry.config import (
14
- _add_tool_configurations_to_pyproject_toml,
14
+ _add_configurations_to_pyproject_toml,
15
15
  )
16
16
  from winipedia_utils.projects.poetry.poetry import (
17
17
  _install_dev_dependencies,
18
18
  )
19
+ from winipedia_utils.projects.project import _create_project_root
19
20
 
20
21
  logger = get_logger(__name__)
21
22
 
@@ -29,7 +30,9 @@ def _setup() -> None:
29
30
  # add patterns to .gitignore
30
31
  _add_package_patterns_to_gitignore()
31
32
  # add tool.* configurations to pyproject.toml
32
- _add_tool_configurations_to_pyproject_toml()
33
+ _add_configurations_to_pyproject_toml()
34
+ # create the project root
35
+ _create_project_root()
33
36
  # run pre-commit once, create tests is included here
34
37
  _run_all_hooks()
35
38
  logger.info("Setup complete!")
@@ -24,7 +24,7 @@ from winipedia_utils.modules.module import (
24
24
  )
25
25
  from winipedia_utils.modules.package import (
26
26
  copy_package,
27
- get_scr_package,
27
+ get_src_package,
28
28
  walk_package,
29
29
  )
30
30
  from winipedia_utils.testing import tests
@@ -80,7 +80,7 @@ def create_tests_for_src_package() -> None:
80
80
  This function walks through the source package hierarchy and creates corresponding
81
81
  test packages and modules for each package and module found in the source.
82
82
  """
83
- src_package = get_scr_package()
83
+ src_package = get_src_package()
84
84
  for package, modules in walk_package(src_package):
85
85
  create_test_package(package)
86
86
  for module in modules:
@@ -17,7 +17,7 @@ from winipedia_utils.git.pre_commit.config import (
17
17
  from winipedia_utils.modules.module import to_path
18
18
  from winipedia_utils.modules.package import (
19
19
  find_packages,
20
- get_scr_package,
20
+ get_src_package,
21
21
  walk_package,
22
22
  )
23
23
  from winipedia_utils.projects.poetry.config import (
@@ -188,7 +188,7 @@ def _test_all_src_code_in_one_package() -> None:
188
188
 
189
189
  """
190
190
  packages = find_packages(depth=0)
191
- src_package = get_scr_package().__name__
191
+ src_package = get_src_package().__name__
192
192
  expected_packages = {TESTS_PACKAGE_NAME, src_package}
193
193
  assert_with_msg(
194
194
  set(packages) == expected_packages,
@@ -207,7 +207,7 @@ def _test_project_structure_mirrored() -> None:
207
207
  AssertionError: If any package or module doesn't have a corresponding test
208
208
 
209
209
  """
210
- src_package = get_scr_package()
210
+ src_package = get_src_package()
211
211
 
212
212
  # we will now go through all the modules in the src package and check
213
213
  # that there is a corresponding test module
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: winipedia-utils
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A package with many utility functions
5
5
  License: MIT
6
6
  Author: Winipedia
7
+ Author-email: win.steveker@gmx.de
7
8
  Requires-Python: >=3.12
8
9
  Classifier: License :: OSI Approved :: MIT License
9
10
  Classifier: Programming Language :: Python :: 3
@@ -12,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.13
12
13
  Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
13
14
  Requires-Dist: django (>=5.2.1,<6.0.0)
14
15
  Requires-Dist: pathspec (>=0.12.1,<0.13.0)
16
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
15
17
  Requires-Dist: setuptools (>=80.3.1,<81.0.0)
16
18
  Requires-Dist: tomlkit (>=0.13.2,<0.14.0)
17
19
  Requires-Dist: tqdm (>=4.67.1,<5.0.0)
@@ -148,11 +150,11 @@ create_tests()
148
150
  ### Module Introspection
149
151
 
150
152
  ```python
151
- from winipedia_utils.modules.package import get_scr_package, walk_package
153
+ from winipedia_utils.modules.package import get_src_package, walk_package
152
154
  from winipedia_utils.modules.function import get_all_functions_from_module
153
155
 
154
156
  # Discover your main source package
155
- src_package = get_scr_package()
157
+ src_package = get_src_package()
156
158
 
157
159
  # Walk through all modules in a package
158
160
  for package, modules in walk_package(src_package):
@@ -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=iJwUJPhVkxyRjJqHVVWh3GNJFiYf45ZdSfR21puQAmw,12673
30
- winipedia_utils/modules/package.py,sha256=77DiJmIUrsSsJHAdBZwA8iCi5gv2KSmFCwYyF1uvWLw,12485
30
+ winipedia_utils/modules/package.py,sha256=jPI7fcJ5VFWO7nRvjB6cGv_mahx0BUej9qhKARSK_Vk,12485
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
@@ -36,13 +36,15 @@ winipedia_utils/os/__init__.py,sha256=WSLt7tb6HqWRlCGGIEwRfVksF0sLJNeEW3iZeJhGWk
36
36
  winipedia_utils/os/os.py,sha256=ITuiLLfjGBV2jH8tHQfwVzsICT-jY1zUxtwu3ASJBG4,1690
37
37
  winipedia_utils/projects/__init__.py,sha256=6oTiSlUMAwO5xnH4SGVnvspzKcxrxo9kn1L4xkjq1p8,53
38
38
  winipedia_utils/projects/poetry/__init__.py,sha256=0yNMuu9KmM19od4VBxBV3HLK-RdCsa0e2Zhg33J7RmQ,60
39
- winipedia_utils/projects/poetry/config.py,sha256=r8sbhsF26yro5qLg2srjl3s9MftwEbfmE2F9bAFA58E,2976
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/setup.py,sha256=hu-LoIIOEeDa9uUsOSIl5PWrRDjtVCiyucRBjiML1u4,1444
41
+ winipedia_utils/projects/project.py,sha256=GRprpzhasBtV9OtPhQE2HxeufOzcJgbaCZbrW34YnnE,691
42
+ winipedia_utils/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
43
+ winipedia_utils/setup.py,sha256=6zOT-5kXqpADg6wYf-S4ghEY38No_LDQL0YaIRQCFJ0,1560
42
44
  winipedia_utils/testing/__init__.py,sha256=kXhB5xw02ec5xpcW_KV--9CBKdyCjnuR-NZzAJ5tq0g,51
43
45
  winipedia_utils/testing/assertions.py,sha256=0JF4mqVTnLQ1qkAL_FuTwyN_idr00rvVlta7aDdnUXA,851
44
46
  winipedia_utils/testing/convention.py,sha256=NxC_hYaUXshsa6LL6nQoEEKpTzC1KwTloKL8aS2gUPI,5010
45
- winipedia_utils/testing/create_tests.py,sha256=9SrmzyMD7yPKCoLKkM0i_wRASHw2hJ_61sNuvZtYmt4,9820
47
+ winipedia_utils/testing/create_tests.py,sha256=pfjPBFWw0yFd8x0LG5Ym8ohFgjOJ34O0HAGoowKJpcY,9820
46
48
  winipedia_utils/testing/fixtures.py,sha256=e0ax1n1zqzmLawA26k0EtNa3rYSMu10lMNVRjBuIGMs,1061
47
49
  winipedia_utils/testing/tests/__init__.py,sha256=kL-1O6lAO5j4JPOqPdi3dHdbOQ_UXcgPFppj82HhrRU,57
48
50
  winipedia_utils/testing/tests/base/__init__.py,sha256=dBH1yfONmqUC49zshS6BJ4ZgEcw7iFGoFCqRmU7Vhrw,62
@@ -53,13 +55,13 @@ winipedia_utils/testing/tests/base/fixtures/scopes/class_.py,sha256=XCx4HZeHbJJ-
53
55
  winipedia_utils/testing/tests/base/fixtures/scopes/function.py,sha256=5dW7-IPqJ_3Q2j1vftZL5FYKvNSKufqiHzLTTWYhja4,309
54
56
  winipedia_utils/testing/tests/base/fixtures/scopes/module.py,sha256=V0H9WFrdSV7uj__bXM_GKcCJnjResqI7fFjcxyvNaZk,1169
55
57
  winipedia_utils/testing/tests/base/fixtures/scopes/package.py,sha256=IKOfj6vfyjEQdRV5cJoPRQvALmePpGxWkGy23di00-w,309
56
- winipedia_utils/testing/tests/base/fixtures/scopes/session.py,sha256=CP-CY_qsa2bc8FCIvb64LaB_G0C43eGa3Rt8QtnY4LQ,8435
58
+ winipedia_utils/testing/tests/base/fixtures/scopes/session.py,sha256=DLsp_IO1QSYhKsZRbpkYMzGNro3c5ifbbWA3NoR6ec0,8435
57
59
  winipedia_utils/testing/tests/base/utils/__init__.py,sha256=mC-8dCkp8xarqkQu2QQLrPjHi6Ww9hcixWdHeQHWeRs,68
58
60
  winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23MfzacLLuwjy2AO-PQQp_aSI,2820
59
61
  winipedia_utils/testing/tests/conftest.py,sha256=CvLtsr-KhSPzbQYin6SYZQC1Ez3AzIsqCWhuLuXinAs,826
60
62
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
61
63
  winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
62
- winipedia_utils-0.1.1.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
63
- winipedia_utils-0.1.1.dist-info/METADATA,sha256=UBPvyoK1Hk-0TdpO_7_x2uTtrSp2QQ-ElLvsGyTNzDQ,12311
64
- winipedia_utils-0.1.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
65
- winipedia_utils-0.1.1.dist-info/RECORD,,
64
+ winipedia_utils-0.1.3.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
+ winipedia_utils-0.1.3.dist-info/METADATA,sha256=IFivyPvm9Jt1GOCuWT6fLwBHg3c7SYfpbwJ6VnI9cW4,12384
66
+ winipedia_utils-0.1.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
+ winipedia_utils-0.1.3.dist-info/RECORD,,