deproc-python 0.1.1__tar.gz → 0.2.0__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.
Files changed (41) hide show
  1. {deproc_python-0.1.1 → deproc_python-0.2.0}/PKG-INFO +5 -6
  2. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/linker/__init__.py +1 -1
  3. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/linker/main.py +28 -23
  4. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/linker/models.py +6 -1
  5. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/__init__.py +1 -1
  6. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/main.py +413 -143
  7. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/models.py +15 -3
  8. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/utils/extraction.py +76 -43
  9. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/utils/misc.py +0 -1
  10. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/parser/utils/tree_sitter_python.py +14 -10
  11. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/resolver/__init__.py +1 -1
  12. deproc_python-0.2.0/deproc/plugins/python/resolver/main.py +426 -0
  13. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/resolver/models.py +3 -1
  14. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/symbol_cache/__init__.py +1 -1
  15. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/symbol_cache/main.py +39 -21
  16. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/symbol_cache/models.py +3 -1
  17. deproc_python-0.2.0/deproc/plugins/python/utils/exports.py +142 -0
  18. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/utils/mro.py +3 -2
  19. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/utils/serialization.py +128 -33
  20. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc_python.egg-info/PKG-INFO +5 -6
  21. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc_python.egg-info/SOURCES.txt +1 -0
  22. deproc_python-0.2.0/deproc_python.egg-info/requires.txt +4 -0
  23. {deproc_python-0.1.1 → deproc_python-0.2.0}/pyproject.toml +6 -7
  24. deproc_python-0.2.0/tests/test_exports.py +116 -0
  25. deproc_python-0.2.0/tests/test_imports.py +50 -0
  26. {deproc_python-0.1.1 → deproc_python-0.2.0}/tests/test_linker.py +13 -6
  27. {deproc_python-0.1.1 → deproc_python-0.2.0}/tests/test_mro.py +2 -0
  28. {deproc_python-0.1.1 → deproc_python-0.2.0}/tests/test_parser.py +132 -30
  29. deproc_python-0.2.0/tests/test_python_serialization.py +97 -0
  30. {deproc_python-0.1.1 → deproc_python-0.2.0}/tests/test_resolver.py +339 -55
  31. {deproc_python-0.1.1 → deproc_python-0.2.0}/tests/test_symbol_cache.py +20 -4
  32. deproc_python-0.1.1/deproc/plugins/python/resolver/main.py +0 -227
  33. deproc_python-0.1.1/deproc/plugins/python/utils/exports.py +0 -16
  34. deproc_python-0.1.1/deproc_python.egg-info/requires.txt +0 -4
  35. deproc_python-0.1.1/tests/test_exports.py +0 -35
  36. deproc_python-0.1.1/tests/test_imports.py +0 -29
  37. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/__init__.py +0 -0
  38. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc/plugins/python/utils/imports.py +0 -0
  39. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc_python.egg-info/dependency_links.txt +0 -0
  40. {deproc_python-0.1.1 → deproc_python-0.2.0}/deproc_python.egg-info/top_level.txt +0 -0
  41. {deproc_python-0.1.1 → deproc_python-0.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deproc-python
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Python language plugin for deproc.
5
5
  Author-email: Gurveer Singh Virk <gurveervirk.15517@gmail.com>
6
6
  License: Apache-2.0
@@ -12,12 +12,11 @@ Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
18
17
  Classifier: Topic :: Software Development :: Libraries
19
- Requires-Python: >=3.10
20
- Requires-Dist: deproc-core>=0.1.0
21
- Requires-Dist: deproc-utils-tree-sitter>=0.1.1
18
+ Requires-Python: >=3.12
19
+ Requires-Dist: deproc-core>=0.2.0
20
+ Requires-Dist: deproc-utils-tree-sitter>=0.1.2
22
21
  Requires-Dist: tree-sitter>=0.25.2
23
22
  Requires-Dist: tree-sitter-python>=0.25.0
@@ -1,3 +1,3 @@
1
1
  from .main import PythonLinker
2
2
 
3
- __all__ = ["PythonLinker"]
3
+ __all__ = ["PythonLinker"]
@@ -1,16 +1,15 @@
1
1
  import fnmatch
2
- from deproc.core.interfaces import Linker
3
- from deproc.core.context import Context
4
2
  from pathlib import Path
3
+
4
+ from deproc.core.context import Context
5
+ from deproc.core.interfaces import Linker
6
+
5
7
  from ..parser.models import PythonModule
6
- from .models import (
7
- Node,
8
- PythonNamespacePackage,
9
- PythonPackage,
10
- )
11
-
12
- class PythonLinker(Linker[list[PythonModule], list[Node]]):
13
- def _check_skip_patterns(self, path: str, skip_patterns: list[str]) -> bool:
8
+ from .models import Node, PythonNamespacePackage, PythonPackage
9
+
10
+
11
+ class PythonLinker(Linker[PythonModule, Node]):
12
+ def _check_skip_patterns(self, path: str, skip_patterns: set[str]) -> bool:
14
13
  return any(fnmatch.fnmatch(path, pattern) for pattern in skip_patterns)
15
14
 
16
15
  def link_files(self, nodes: list[PythonModule], context: Context) -> list[Node]:
@@ -38,7 +37,9 @@ class PythonLinker(Linker[list[PythonModule], list[Node]]):
38
37
  continue
39
38
  if not self.validate_path(str(sub_path)):
40
39
  continue
41
- sub_node = self.traverse_path(base_path, sub_path, path_to_module, has_init, context)
40
+ sub_node = self.traverse_path(
41
+ base_path, sub_path, path_to_module, has_init, context
42
+ )
42
43
  if sub_node:
43
44
  sub_node.parent_id = None
44
45
  top_level.append(sub_node)
@@ -46,19 +47,24 @@ class PythonLinker(Linker[list[PythonModule], list[Node]]):
46
47
  return top_level
47
48
 
48
49
  def validate_path(self, path: str) -> bool:
49
- return path.endswith(".py") or path.endswith(".pyi") or path.endswith("__init__.py") or Path(path).is_dir()
50
+ return (
51
+ path.endswith(".py")
52
+ or path.endswith(".pyi")
53
+ or path.endswith("__init__.py")
54
+ or Path(path).is_dir()
55
+ )
50
56
 
51
57
  def traverse_path(
52
- self,
53
- base_path: Path,
54
- current_path: Path,
55
- path_to_module: dict[str, PythonModule],
58
+ self,
59
+ base_path: Path,
60
+ current_path: Path,
61
+ path_to_module: dict[str, PythonModule],
56
62
  has_init: dict[str, PythonModule],
57
- context: Context
63
+ context: Context,
58
64
  ) -> Node | None:
59
65
  if not self.validate_path(str(current_path)):
60
66
  return None
61
-
67
+
62
68
  relative_path = str(current_path.relative_to(base_path)).replace("\\", "/")
63
69
 
64
70
  if relative_path.endswith(".py") or relative_path.endswith(".pyi"):
@@ -68,10 +74,7 @@ class PythonLinker(Linker[list[PythonModule], list[Node]]):
68
74
  fqn = relative_path.replace("/", ".")
69
75
 
70
76
  if relative_path in has_init:
71
- package = PythonPackage(
72
- submodule_ids=[],
73
- **vars(has_init[relative_path])
74
- )
77
+ package = PythonPackage(submodule_ids=[], **vars(has_init[relative_path]))
75
78
  else:
76
79
  package = PythonNamespacePackage(
77
80
  path=relative_path,
@@ -84,7 +87,9 @@ class PythonLinker(Linker[list[PythonModule], list[Node]]):
84
87
  continue
85
88
  if self._check_skip_patterns(sub_path.name, context.skip_paths):
86
89
  continue
87
- sub_node = self.traverse_path(base_path, sub_path, path_to_module, has_init, context)
90
+ sub_node = self.traverse_path(
91
+ base_path, sub_path, path_to_module, has_init, context
92
+ )
88
93
  if sub_node:
89
94
  sub_node.parent_id = package.id
90
95
  package.submodule_ids.append(sub_node.id)
@@ -1,19 +1,24 @@
1
- from deproc.core.interfaces.parser.models import Node
2
1
  from dataclasses import dataclass, field
2
+
3
+ from deproc.core.interfaces.parser.models import Node
4
+
3
5
  from ..parser.models import (
4
6
  PythonModule,
5
7
  SymbolID,
6
8
  )
7
9
 
10
+
8
11
  @dataclass
9
12
  class PythonNamespacePackage(Node):
10
13
  fqn: str
11
14
  submodule_ids: list[SymbolID] = field(default_factory=list)
12
15
 
16
+
13
17
  @dataclass(kw_only=True)
14
18
  class PythonPackage(PythonModule):
15
19
  submodule_ids: list[SymbolID] = field(default_factory=list)
16
20
 
21
+
17
22
  __all__ = [
18
23
  "Node",
19
24
  "PythonNamespacePackage",
@@ -1,3 +1,3 @@
1
1
  from .main import PythonSourceParser
2
2
 
3
- __all__ = ["PythonSourceParser"]
3
+ __all__ = ["PythonSourceParser"]