wexample-filestate-python 0.0.5__tar.gz → 0.0.7__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-filestate-python
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Helpers for Python.
5
5
  Home-page: https://github.com/wexample/python-filestate-python
6
6
  Author: weeger
@@ -19,6 +19,7 @@ setup(
19
19
  'python-dotenv',
20
20
  'pydantic',
21
21
  'wexample-filestate',
22
+ 'wexample-app',
22
23
  ],
23
24
  python_requires='>=3.6',
24
25
  )
@@ -0,0 +1 @@
1
+ NAME_PATTERN_PYTHON_NOT_PYCACHE = "^(?!__pycache__$).+$"
@@ -0,0 +1,87 @@
1
+ from typing import Optional, List, Type, TYPE_CHECKING
2
+
3
+ from wexample_filestate.config_option.children_file_factory_config_option import ChildrenFileFactoryConfigOption
4
+ from wexample_filestate.const.globals import NAME_PATTERN_NO_LEADING_DOT
5
+ from wexample_app.workdir.app_workdir import AppWorkdir
6
+ from wexample_config.config_value.callback_render_config_value import CallbackRenderConfigValue
7
+ from wexample_config.const.types import DictConfig
8
+ from wexample_config.options_provider.abstract_options_provider import AbstractOptionsProvider
9
+ from wexample_helpers.helpers.string_helper import string_to_snake_case
10
+
11
+ if TYPE_CHECKING:
12
+ from wexample_filestate.operations_provider.abstract_operations_provider import AbstractOperationsProvider
13
+ from wexample_filestate.config_option.mixin.item_config_option_mixin import ItemTreeConfigOptionMixin
14
+
15
+
16
+ class PythonWorkdir(AppWorkdir):
17
+ def get_options_providers(self) -> List[Type["AbstractOptionsProvider"]]:
18
+ from wexample_filestate.options_provider.default_options_provider import DefaultOptionsProvider
19
+ from wexample_filestate_git.options_provider.git_options_provider import GitOptionsProvider
20
+
21
+ return [
22
+ DefaultOptionsProvider,
23
+ GitOptionsProvider
24
+ ]
25
+
26
+ def get_operations_providers(self) -> List[Type["AbstractOperationsProvider"]]:
27
+ from wexample_filestate.operations_provider.default_operations_provider import DefaultOperationsProvider
28
+ from wexample_filestate_git.operations_provider.git_operations_provider import GitOperationsProvider
29
+
30
+ return [
31
+ DefaultOperationsProvider,
32
+ GitOperationsProvider
33
+ ]
34
+
35
+ @staticmethod
36
+ def _create_package_name_snake(option: "ItemTreeConfigOptionMixin") -> str:
37
+ import os
38
+ return "wexample_" + string_to_snake_case(
39
+ os.path.basename(os.path.realpath(option.get_parent_item().get_path())))
40
+
41
+ def prepare_value(self, config: Optional[DictConfig] = None) -> DictConfig:
42
+ from wexample_filestate.const.disk import DiskItemType
43
+ from wexample_filestate_python.const.name_pattern import NAME_PATTERN_PYTHON_NOT_PYCACHE
44
+
45
+ config = super().prepare_value(config)
46
+
47
+ config.update({
48
+ "children": [
49
+ {
50
+ 'name': 'setup.py',
51
+ 'type': DiskItemType.FILE,
52
+ 'should_exist': True,
53
+ },
54
+ {
55
+ 'name': 'tests',
56
+ 'type': DiskItemType.DIRECTORY,
57
+ 'should_exist': True,
58
+ },
59
+ # Remove unwanted files
60
+ # Should only be created during deployment
61
+ {
62
+ 'name': 'build',
63
+ 'type': DiskItemType.DIRECTORY,
64
+ 'should_exist': False,
65
+ },
66
+ {
67
+ 'name': 'dist',
68
+ 'type': DiskItemType.DIRECTORY,
69
+ 'should_exist': False,
70
+ },
71
+ {
72
+ 'name': CallbackRenderConfigValue(raw=self._create_package_name_snake),
73
+ 'type': DiskItemType.DIRECTORY,
74
+ 'should_exist': True,
75
+ "children": [
76
+ ChildrenFileFactoryConfigOption(pattern={
77
+ "name": "__init__.py",
78
+ "type": DiskItemType.FILE,
79
+ "recursive": True,
80
+ "name_pattern": [NAME_PATTERN_PYTHON_NOT_PYCACHE, NAME_PATTERN_NO_LEADING_DOT],
81
+ })
82
+ ]
83
+ }
84
+ ]
85
+ })
86
+
87
+ return config
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-filestate-python
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Helpers for Python.
5
5
  Home-page: https://github.com/wexample/python-filestate-python
6
6
  Author: weeger
@@ -5,4 +5,8 @@ wexample_filestate_python.egg-info/PKG-INFO
5
5
  wexample_filestate_python.egg-info/SOURCES.txt
6
6
  wexample_filestate_python.egg-info/dependency_links.txt
7
7
  wexample_filestate_python.egg-info/requires.txt
8
- wexample_filestate_python.egg-info/top_level.txt
8
+ wexample_filestate_python.egg-info/top_level.txt
9
+ wexample_filestate_python/const/__init__.py
10
+ wexample_filestate_python/const/name_pattern.py
11
+ wexample_filestate_python/workdir/__init__.py
12
+ wexample_filestate_python/workdir/python_workdir.py
@@ -1,3 +1,4 @@
1
1
  pydantic
2
2
  python-dotenv
3
+ wexample-app
3
4
  wexample-filestate