pyrig 2.2.6__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.
Files changed (102) hide show
  1. pyrig/__init__.py +1 -0
  2. pyrig/dev/__init__.py +6 -0
  3. pyrig/dev/builders/__init__.py +1 -0
  4. pyrig/dev/builders/base/__init__.py +5 -0
  5. pyrig/dev/builders/base/base.py +256 -0
  6. pyrig/dev/builders/pyinstaller.py +229 -0
  7. pyrig/dev/cli/__init__.py +5 -0
  8. pyrig/dev/cli/cli.py +95 -0
  9. pyrig/dev/cli/commands/__init__.py +1 -0
  10. pyrig/dev/cli/commands/build_artifacts.py +16 -0
  11. pyrig/dev/cli/commands/create_root.py +25 -0
  12. pyrig/dev/cli/commands/create_tests.py +244 -0
  13. pyrig/dev/cli/commands/init_project.py +160 -0
  14. pyrig/dev/cli/commands/make_inits.py +27 -0
  15. pyrig/dev/cli/commands/protect_repo.py +145 -0
  16. pyrig/dev/cli/shared_subcommands.py +20 -0
  17. pyrig/dev/cli/subcommands.py +73 -0
  18. pyrig/dev/configs/__init__.py +1 -0
  19. pyrig/dev/configs/base/__init__.py +5 -0
  20. pyrig/dev/configs/base/base.py +826 -0
  21. pyrig/dev/configs/containers/__init__.py +1 -0
  22. pyrig/dev/configs/containers/container_file.py +111 -0
  23. pyrig/dev/configs/dot_env.py +95 -0
  24. pyrig/dev/configs/dot_python_version.py +88 -0
  25. pyrig/dev/configs/git/__init__.py +5 -0
  26. pyrig/dev/configs/git/gitignore.py +181 -0
  27. pyrig/dev/configs/git/pre_commit.py +170 -0
  28. pyrig/dev/configs/licence.py +112 -0
  29. pyrig/dev/configs/markdown/__init__.py +1 -0
  30. pyrig/dev/configs/markdown/docs/__init__.py +1 -0
  31. pyrig/dev/configs/markdown/docs/index.py +38 -0
  32. pyrig/dev/configs/markdown/readme.py +132 -0
  33. pyrig/dev/configs/py_typed.py +28 -0
  34. pyrig/dev/configs/pyproject.py +436 -0
  35. pyrig/dev/configs/python/__init__.py +5 -0
  36. pyrig/dev/configs/python/builders_init.py +27 -0
  37. pyrig/dev/configs/python/configs_init.py +28 -0
  38. pyrig/dev/configs/python/dot_experiment.py +46 -0
  39. pyrig/dev/configs/python/main.py +59 -0
  40. pyrig/dev/configs/python/resources_init.py +27 -0
  41. pyrig/dev/configs/python/shared_subcommands.py +29 -0
  42. pyrig/dev/configs/python/src_init.py +27 -0
  43. pyrig/dev/configs/python/subcommands.py +27 -0
  44. pyrig/dev/configs/testing/__init__.py +5 -0
  45. pyrig/dev/configs/testing/conftest.py +64 -0
  46. pyrig/dev/configs/testing/fixtures_init.py +27 -0
  47. pyrig/dev/configs/testing/main_test.py +74 -0
  48. pyrig/dev/configs/testing/zero_test.py +43 -0
  49. pyrig/dev/configs/workflows/__init__.py +5 -0
  50. pyrig/dev/configs/workflows/base/__init__.py +5 -0
  51. pyrig/dev/configs/workflows/base/base.py +1662 -0
  52. pyrig/dev/configs/workflows/build.py +106 -0
  53. pyrig/dev/configs/workflows/health_check.py +133 -0
  54. pyrig/dev/configs/workflows/publish.py +68 -0
  55. pyrig/dev/configs/workflows/release.py +90 -0
  56. pyrig/dev/tests/__init__.py +5 -0
  57. pyrig/dev/tests/conftest.py +40 -0
  58. pyrig/dev/tests/fixtures/__init__.py +1 -0
  59. pyrig/dev/tests/fixtures/assertions.py +147 -0
  60. pyrig/dev/tests/fixtures/autouse/__init__.py +5 -0
  61. pyrig/dev/tests/fixtures/autouse/class_.py +42 -0
  62. pyrig/dev/tests/fixtures/autouse/module.py +40 -0
  63. pyrig/dev/tests/fixtures/autouse/session.py +589 -0
  64. pyrig/dev/tests/fixtures/factories.py +118 -0
  65. pyrig/dev/utils/__init__.py +1 -0
  66. pyrig/dev/utils/cli.py +17 -0
  67. pyrig/dev/utils/git.py +312 -0
  68. pyrig/dev/utils/packages.py +93 -0
  69. pyrig/dev/utils/resources.py +77 -0
  70. pyrig/dev/utils/testing.py +66 -0
  71. pyrig/dev/utils/versions.py +268 -0
  72. pyrig/main.py +9 -0
  73. pyrig/py.typed +0 -0
  74. pyrig/resources/GITIGNORE +216 -0
  75. pyrig/resources/LATEST_PYTHON_VERSION +1 -0
  76. pyrig/resources/MIT_LICENSE_TEMPLATE +21 -0
  77. pyrig/resources/__init__.py +1 -0
  78. pyrig/src/__init__.py +1 -0
  79. pyrig/src/git/__init__.py +6 -0
  80. pyrig/src/git/git.py +146 -0
  81. pyrig/src/graph.py +255 -0
  82. pyrig/src/iterate.py +107 -0
  83. pyrig/src/modules/__init__.py +22 -0
  84. pyrig/src/modules/class_.py +369 -0
  85. pyrig/src/modules/function.py +189 -0
  86. pyrig/src/modules/inspection.py +148 -0
  87. pyrig/src/modules/module.py +658 -0
  88. pyrig/src/modules/package.py +452 -0
  89. pyrig/src/os/__init__.py +6 -0
  90. pyrig/src/os/os.py +121 -0
  91. pyrig/src/project/__init__.py +5 -0
  92. pyrig/src/project/mgt.py +83 -0
  93. pyrig/src/resource.py +58 -0
  94. pyrig/src/string.py +100 -0
  95. pyrig/src/testing/__init__.py +6 -0
  96. pyrig/src/testing/assertions.py +66 -0
  97. pyrig/src/testing/convention.py +203 -0
  98. pyrig-2.2.6.dist-info/METADATA +174 -0
  99. pyrig-2.2.6.dist-info/RECORD +102 -0
  100. pyrig-2.2.6.dist-info/WHEEL +4 -0
  101. pyrig-2.2.6.dist-info/entry_points.txt +3 -0
  102. pyrig-2.2.6.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,27 @@
1
+ """Configuration for the subcommands.py CLI extension file.
2
+
3
+ This module provides the SubcommandsConfigFile class for creating
4
+ a subcommands.py file where users can define custom CLI subcommands.
5
+ """
6
+
7
+ from types import ModuleType
8
+
9
+ from pyrig.dev.cli import subcommands
10
+ from pyrig.dev.configs.base.base import CopyModuleOnlyDocstringConfigFile
11
+
12
+
13
+ class SubcommandsConfigFile(CopyModuleOnlyDocstringConfigFile):
14
+ """Configuration file manager for subcommands.py.
15
+
16
+ Creates a subcommands.py file with only the docstring from pyrig's
17
+ subcommands module, allowing users to add custom CLI subcommands.
18
+ """
19
+
20
+ @classmethod
21
+ def get_src_module(cls) -> ModuleType:
22
+ """Get the source module to copy docstring from.
23
+
24
+ Returns:
25
+ The pyrig.dev.cli.subcommands module.
26
+ """
27
+ return subcommands
@@ -0,0 +1,5 @@
1
+ """Test configuration file management.
2
+
3
+ This package provides ConfigFile subclasses for creating and managing
4
+ test infrastructure files like conftest.py and test skeleton files.
5
+ """
@@ -0,0 +1,64 @@
1
+ """Configuration for the pytest conftest.py file.
2
+
3
+ This module provides the ConftestConfigFile class for creating
4
+ the tests/conftest.py file that configures pytest plugins.
5
+ """
6
+
7
+ from pyrig.dev.configs.base.base import PythonTestsConfigFile
8
+ from pyrig.src.modules.module import make_obj_importpath
9
+ from pyrig.src.os.os import run_subprocess
10
+ from pyrig.src.project.mgt import PROJECT_MGT_RUN_ARGS
11
+
12
+
13
+ class ConftestConfigFile(PythonTestsConfigFile):
14
+ """Configuration file manager for conftest.py.
15
+
16
+ Creates a conftest.py that imports pyrig's test fixtures and
17
+ plugins for consistent test infrastructure.
18
+ """
19
+
20
+ @classmethod
21
+ def get_content_str(cls) -> str:
22
+ """Get the conftest.py content.
23
+
24
+ Returns:
25
+ Python code that imports pyrig's conftest as a pytest plugin.
26
+ """
27
+ from pyrig.dev.tests import conftest # noqa: PLC0415
28
+
29
+ return f'''"""Pytest configuration for tests.
30
+
31
+ This module configures pytest plugins for the test suite, setting up the necessary
32
+ fixtures and hooks for the different
33
+ test scopes (function, class, module, package, session).
34
+ It also import custom plugins from tests/base/scopes.
35
+ This file should not be modified manually.
36
+ """
37
+
38
+ pytest_plugins = ["{make_obj_importpath(conftest)}"]
39
+ '''
40
+
41
+ @classmethod
42
+ def is_correct(cls) -> bool:
43
+ """Check if the conftest.py file is valid.
44
+
45
+ Allows modifications as long as the file contains the required import.
46
+
47
+ Returns:
48
+ True if the file has required structure.
49
+ """
50
+ from pyrig.dev.tests import conftest # noqa: PLC0415
51
+
52
+ return super().is_correct() or (
53
+ f'pytest_plugins = ["{make_obj_importpath(conftest)}"]'
54
+ in cls.get_file_content()
55
+ )
56
+
57
+ @classmethod
58
+ def run_tests(cls, *, check: bool = True) -> None:
59
+ """Run the project's test suite using pytest.
60
+
61
+ Args:
62
+ check: Whether to raise on test failure.
63
+ """
64
+ run_subprocess([*PROJECT_MGT_RUN_ARGS, "pytest"], check=check)
@@ -0,0 +1,27 @@
1
+ """Configuration for the fixture.py base fixture file.
2
+
3
+ This module provides the FixtureConfigFile class for creating
4
+ a fixture.py file where users can define custom test fixtures.
5
+ """
6
+
7
+ from types import ModuleType
8
+
9
+ from pyrig.dev.configs.base.base import InitConfigFile
10
+ from pyrig.dev.tests import fixtures
11
+
12
+
13
+ class FixturesInitConfigFile(InitConfigFile):
14
+ """Configuration file manager for fixture.py.
15
+
16
+ Creates a fixture.py file with only the docstring from pyrig's
17
+ fixture module, allowing users to add custom fixtures.
18
+ """
19
+
20
+ @classmethod
21
+ def get_src_module(cls) -> ModuleType:
22
+ """Get the source module to copy docstring from.
23
+
24
+ Returns:
25
+ The pyrig.dev.tests.fixtures.fixture module.
26
+ """
27
+ return fixtures
@@ -0,0 +1,74 @@
1
+ """Configuration for the test_main.py test file.
2
+
3
+ This module provides the MainTestConfigFile class for creating
4
+ a test file that verifies the CLI entry point works correctly.
5
+ """
6
+
7
+ from pathlib import Path
8
+
9
+ from pyrig import main
10
+ from pyrig.dev.configs.base.base import PythonPackageConfigFile
11
+ from pyrig.dev.configs.pyproject import PyprojectConfigFile
12
+ from pyrig.src.modules.module import to_path
13
+ from pyrig.src.testing.convention import make_test_obj_importpath_from_obj
14
+
15
+
16
+ class MainTestConfigFile(PythonPackageConfigFile):
17
+ """Configuration file manager for test_main.py.
18
+
19
+ Creates a test file that verifies the CLI entry point
20
+ responds correctly to --help.
21
+ """
22
+
23
+ @classmethod
24
+ def get_parent_path(cls) -> Path:
25
+ """Get the test directory path.
26
+
27
+ Returns:
28
+ Path to the tests/pkg_name/src directory.
29
+ """
30
+ test_module_path = to_path(
31
+ make_test_obj_importpath_from_obj(main), is_package=False
32
+ ).parent
33
+ # replace pyrig with project name
34
+
35
+ package_name = PyprojectConfigFile.get_package_name()
36
+ test_module_path = Path(
37
+ test_module_path.as_posix().replace("pyrig", package_name, 1)
38
+ )
39
+ return Path(test_module_path)
40
+
41
+ @classmethod
42
+ def get_filename(cls) -> str:
43
+ """Get the test filename.
44
+
45
+ Returns:
46
+ The string "test_main".
47
+ """
48
+ return "test_main"
49
+
50
+ @classmethod
51
+ def get_content_str(cls) -> str:
52
+ """Get the test file content.
53
+
54
+ Returns:
55
+ Python code with a test that verifies CLI --help works.
56
+ """
57
+ return '''"""test module."""
58
+
59
+
60
+ def test_main(main_test_fixture: None) -> None:
61
+ """Test func for main."""
62
+ assert main_test_fixture is None
63
+ '''
64
+
65
+ @classmethod
66
+ def is_correct(cls) -> bool:
67
+ """Check if the test file is valid.
68
+
69
+ Allows modifications as long as test_main function exists.
70
+
71
+ Returns:
72
+ True if the file contains a test_main function.
73
+ """
74
+ return super().is_correct() or "def test_main" in cls.get_file_content()
@@ -0,0 +1,43 @@
1
+ """Configuration for the test_zero.py placeholder test.
2
+
3
+ This module provides the ZeroTestConfigFile class for creating
4
+ a minimal test file that ensures pytest runs even when no other
5
+ tests exist.
6
+ """
7
+
8
+ from pyrig.dev.configs.base.base import PythonTestsConfigFile
9
+
10
+
11
+ class ZeroTestConfigFile(PythonTestsConfigFile):
12
+ """Configuration file manager for test_zero.py.
13
+
14
+ Creates a placeholder test file that ensures pytest runs
15
+ successfully even when no other tests have been written.
16
+ """
17
+
18
+ @classmethod
19
+ def get_filename(cls) -> str:
20
+ """Get the test filename with reversed prefix.
21
+
22
+ Returns:
23
+ The string "test_zero" (reversed from "zero_test").
24
+ """
25
+ filename = super().get_filename()
26
+ return "_".join(reversed(filename.split("_")))
27
+
28
+ @classmethod
29
+ def get_content_str(cls) -> str:
30
+ """Get the placeholder test content.
31
+
32
+ Returns:
33
+ Python code with an empty test function.
34
+ """
35
+ return '''"""Contains an empty test."""
36
+
37
+
38
+ def test_zero() -> None:
39
+ """Empty test.
40
+
41
+ Exists so that when no tests are written yet the base fixtures are executed.
42
+ """
43
+ '''
@@ -0,0 +1,5 @@
1
+ """GitHub Actions workflow configuration management.
2
+
3
+ This package provides ConfigFile subclasses for creating and managing
4
+ GitHub Actions workflow files for CI/CD automation.
5
+ """
@@ -0,0 +1,5 @@
1
+ """Base workflow configuration utilities.
2
+
3
+ This package provides the Workflow base class for creating
4
+ GitHub Actions workflow configuration files.
5
+ """