wexample-wex-addon-dev-php 0.0.1__tar.gz → 0.0.4__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-wex-addon-dev-php
3
- Version: 0.0.1
3
+ Version: 0.0.4
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -9,8 +9,9 @@ Classifier: License :: OSI Approved :: MIT License
9
9
  Classifier: Operating System :: OS Independent
10
10
  Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
11
11
  Requires-Python: >=3.10
12
- Requires-Dist: pydantic<3,>=2
13
- Requires-Dist: wexample-wex-core==6.0.44
12
+ Requires-Dist: attrs>=23.1.0
13
+ Requires-Dist: cattrs>=23.1.0
14
+ Requires-Dist: wexample-wex-core==6.0.47
14
15
  Provides-Extra: dev
15
16
  Requires-Dist: pytest; extra == "dev"
16
17
  Requires-Dist: wexample-filestate-php==0.0.1; extra == "dev"
@@ -20,7 +21,7 @@ Description-Content-Type: text/markdown
20
21
 
21
22
  Python dev addon for wex
22
23
 
23
- Version: 0.0.1
24
+ Version: 0.0.3
24
25
 
25
26
  ## Requirements
26
27
 
@@ -28,8 +29,9 @@ Version: 0.0.1
28
29
 
29
30
  ## Dependencies
30
31
 
31
- - pydantic>=2,<3
32
- - wexample-wex-core==6.0.44
32
+ - attrs>=23.1.0
33
+ - cattrs>=23.1.0
34
+ - wexample-wex-core==6.0.46
33
35
 
34
36
  ## Installation
35
37
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Python dev addon for wex
4
4
 
5
- Version: 0.0.1
5
+ Version: 0.0.3
6
6
 
7
7
  ## Requirements
8
8
 
@@ -10,8 +10,9 @@ Version: 0.0.1
10
10
 
11
11
  ## Dependencies
12
12
 
13
- - pydantic>=2,<3
14
- - wexample-wex-core==6.0.44
13
+ - attrs>=23.1.0
14
+ - cattrs>=23.1.0
15
+ - wexample-wex-core==6.0.46
15
16
 
16
17
  ## Installation
17
18
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-wex-addon-dev-php"
9
- version = "0.0.1"
9
+ version = "0.0.4"
10
10
  description = "Python dev addon for wex"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -18,8 +18,9 @@ classifiers = [
18
18
  "Operating System :: OS Independent",
19
19
  ]
20
20
  dependencies = [
21
- "pydantic>=2,<3",
22
- "wexample-wex-core==6.0.44",
21
+ "attrs>=23.1.0",
22
+ "cattrs>=23.1.0",
23
+ "wexample-wex-core==6.0.47",
23
24
  ]
24
25
 
25
26
  [project.readme]
@@ -42,9 +43,6 @@ dev = [
42
43
  distribution = true
43
44
 
44
45
  [tool.pdm.build]
45
- includes = [
46
- "src/wexample_wex_addon_dev_php/py.typed",
47
- ]
48
46
  package-dir = "src"
49
47
  packages = [
50
48
  { include = "wexample_wex_addon_dev_php", from = "src" },
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_core.common.abstract_addon_manager import AbstractAddonManager
4
+
5
+
6
+ class PhpAddonManager(AbstractAddonManager):
7
+ pass
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
6
+
7
+ if TYPE_CHECKING:
8
+ from wexample_config.const.types import DictConfig
9
+
10
+
11
+ class PhpLaravelWorkdir(PhpWorkdir):
12
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
13
+ from wexample_filestate.const.disk import DiskItemType
14
+
15
+ raw_value = super().prepare_value(raw_value)
16
+
17
+ children = raw_value["children"]
18
+
19
+ children.extend(
20
+ [
21
+ {
22
+ "name": "tests",
23
+ "type": DiskItemType.DIRECTORY,
24
+ "should_exist": True,
25
+ "children": [
26
+ self._create_python_file_children_filter(),
27
+ ],
28
+ },
29
+ ]
30
+ )
31
+
32
+ return raw_value
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
4
+
5
+
6
+ class PhpPackageWorkdir(PhpWorkdir):
7
+ pass
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.workdir.framework_packages_suite_workdir import (
6
+ FrameworkPackageSuiteWorkdir,
7
+ )
8
+
9
+ if TYPE_CHECKING:
10
+ from pathlib import Path
11
+
12
+ from wexample_wex_core.workdir.code_base_workdir import CodeBaseWorkdir
13
+
14
+
15
+ class PhpPackagesSuiteWorkdir(FrameworkPackageSuiteWorkdir):
16
+ def _child_is_package_directory(self, entry: Path) -> bool:
17
+ return entry.is_dir() and (entry / "composer.json").is_file()
18
+
19
+ def _get_children_package_directory_name(self) -> str:
20
+ return "composer"
21
+
22
+ def _get_children_package_workdir_class(self) -> type[CodeBaseWorkdir]:
23
+ from wexample_wex_addon_dev_php.workdir.php_package_workdir import (
24
+ PhpPackageWorkdir,
25
+ )
26
+
27
+ return PhpPackageWorkdir
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_dev_php.workdir.php_workdir import PhpWorkdir
4
+
5
+
6
+ class PhpSymfonyWorkdir(PhpWorkdir):
7
+ pass
@@ -0,0 +1,64 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.workdir.code_base_workdir import CodeBaseWorkdir
6
+
7
+ if TYPE_CHECKING:
8
+ from wexample_config.const.types import DictConfig
9
+ from wexample_filestate.option.children_file_factory_option import (
10
+ ChildrenFileFactoryOption,
11
+ )
12
+
13
+
14
+ class PhpWorkdir(CodeBaseWorkdir):
15
+ def get_dependencies(self) -> list[str]:
16
+ # TODO search in composer.json
17
+ return []
18
+
19
+ def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
20
+ from wexample_filestate.const.disk import DiskItemType
21
+ from wexample_helpers.helpers.array import array_dict_get_by
22
+
23
+ raw_value = super().prepare_value(raw_value=raw_value)
24
+
25
+ # Ensure a composer.json file exists for any PHP package project
26
+ children = raw_value["children"]
27
+
28
+ children.append(
29
+ {
30
+ "name": "composer.json",
31
+ "type": DiskItemType.FILE,
32
+ "should_exist": True,
33
+ }
34
+ )
35
+
36
+ # Add rules to .gitignore
37
+ array_dict_get_by("name", ".gitignore", children).setdefault(
38
+ "should_contain_lines", []
39
+ ).extend(
40
+ [
41
+ ".php-cs-fixer.cache",
42
+ ".scannerwork",
43
+ "/vendor",
44
+ ]
45
+ )
46
+
47
+ return raw_value
48
+
49
+ def _create_php_file_children_filter(self) -> ChildrenFileFactoryOption:
50
+ from wexample_filestate.option.children_filter_option import (
51
+ ChildrenFilterOption,
52
+ )
53
+ from wexample_filestate.const.disk import DiskItemType
54
+ from wexample_filestate_php.file.php_file import PhpFile
55
+
56
+ return ChildrenFilterOption(
57
+ pattern={
58
+ "class": PhpFile,
59
+ "name_pattern": r"^.*\.php$",
60
+ "type": DiskItemType.FILE,
61
+ "python": [],
62
+ },
63
+ recursive=True,
64
+ )