pkl-python 0.1.12__tar.gz → 0.1.13__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.
- {pkl-python-0.1.12 → pkl-python-0.1.13}/PKG-INFO +16 -11
- {pkl-python-0.1.12 → pkl-python-0.1.13}/README.md +12 -7
- {pkl-python-0.1.12 → pkl-python-0.1.13}/pyproject.toml +14 -6
- pkl-python-0.1.13/src/pkl/VERSION +1 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/__init__.py +16 -11
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl_python.egg-info/PKG-INFO +16 -11
- pkl-python-0.1.13/src/pkl_python.egg-info/SOURCES.txt +26 -0
- pkl-python-0.1.13/src/pkl_python.egg-info/entry_points.txt +2 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13}/tests/test_evaluator_manager.py +1 -1
- pkl-python-0.1.13/tests/test_fixtures.py +128 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13}/tests/test_load.py +3 -3
- {pkl-python-0.1.12 → pkl-python-0.1.13}/tests/test_parser.py +1 -1
- {pkl-python-0.1.12 → pkl-python-0.1.13}/tests/test_readers.py +3 -3
- pkl-python-0.1.13/tests/test_trace.py +9 -0
- pkl-python-0.1.12/pkl/VERSION +0 -1
- pkl-python-0.1.12/pkl_python.egg-info/SOURCES.txt +0 -25
- pkl-python-0.1.12/scripts/download_binary.py +0 -42
- pkl-python-0.1.12/scripts/eval.py +0 -32
- {pkl-python-0.1.12 → pkl-python-0.1.13}/LICENSE +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13}/setup.cfg +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13}/setup.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/evaluator_manager.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/evaluator_options.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/msgapi.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/parser.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/reader.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/server.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl/utils.py +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl_python.egg-info/dependency_links.txt +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl_python.egg-info/requires.txt +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13/src}/pkl_python.egg-info/top_level.txt +0 -0
- {pkl-python-0.1.12 → pkl-python-0.1.13}/tests/test_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pkl-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.13
|
|
4
4
|
Summary: Python library for Apple's PKL.
|
|
5
5
|
Author-email: Jungwoo Yang <jwyang0213@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -25,9 +25,9 @@ License: MIT License
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
27
|
|
|
28
|
-
Project-URL: Homepage, https://github.com/jw-y/pkl
|
|
29
|
-
Project-URL: Bug Reports, https://github.com/jw-y/pkl/issues
|
|
30
|
-
Project-URL: Source, https://github.com/jw-y/pkl
|
|
28
|
+
Project-URL: Homepage, https://github.com/jw-y/pkl-python
|
|
29
|
+
Project-URL: Bug Reports, https://github.com/jw-y/pkl-python/issues
|
|
30
|
+
Project-URL: Source, https://github.com/jw-y/pkl-python
|
|
31
31
|
Classifier: Programming Language :: Python :: 3
|
|
32
32
|
Classifier: License :: OSI Approved :: MIT License
|
|
33
33
|
Classifier: Operating System :: OS Independent
|
|
@@ -68,21 +68,26 @@ Here's how you can start using `pkl-python` to load a PKL module:
|
|
|
68
68
|
import pkl
|
|
69
69
|
|
|
70
70
|
config = pkl.load("path/to/pkl/example_module.pkl")
|
|
71
|
-
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Code Generation
|
|
74
|
+
As Python is a dynamic language, codegen is not strictly necessary.
|
|
75
|
+
However, codegen lets you expect contents of pkl files within Python modules.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
pkl-gen-python path/to/pkl/example_module.pkl
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
### Status
|
|
75
|
-
* Evaluator API:
|
|
76
|
-
* Code Generation:
|
|
82
|
+
* Evaluator API: functional
|
|
83
|
+
* Code Generation: functional, but needs refining
|
|
77
84
|
|
|
78
85
|
### TODO
|
|
79
|
-
* [
|
|
80
|
-
* [ ] (codgen)
|
|
86
|
+
* [x] (codgen) pip binary installation
|
|
87
|
+
* [ ] (codgen) gatherer depth-first ordering
|
|
81
88
|
* [ ] (codgen) clean up code
|
|
82
89
|
|
|
83
90
|
|
|
84
|
-
## Usage
|
|
85
|
-
|
|
86
91
|
## Advanced Features
|
|
87
92
|
For details on the parameters, refer [Message Passing API](https://pkl-lang.org/main/current/bindings-specification/message-passing-api.html).
|
|
88
93
|
|
|
@@ -21,21 +21,26 @@ Here's how you can start using `pkl-python` to load a PKL module:
|
|
|
21
21
|
import pkl
|
|
22
22
|
|
|
23
23
|
config = pkl.load("path/to/pkl/example_module.pkl")
|
|
24
|
-
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Code Generation
|
|
27
|
+
As Python is a dynamic language, codegen is not strictly necessary.
|
|
28
|
+
However, codegen lets you expect contents of pkl files within Python modules.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pkl-gen-python path/to/pkl/example_module.pkl
|
|
25
32
|
```
|
|
26
33
|
|
|
27
34
|
### Status
|
|
28
|
-
* Evaluator API:
|
|
29
|
-
* Code Generation:
|
|
35
|
+
* Evaluator API: functional
|
|
36
|
+
* Code Generation: functional, but needs refining
|
|
30
37
|
|
|
31
38
|
### TODO
|
|
32
|
-
* [
|
|
33
|
-
* [ ] (codgen)
|
|
39
|
+
* [x] (codgen) pip binary installation
|
|
40
|
+
* [ ] (codgen) gatherer depth-first ordering
|
|
34
41
|
* [ ] (codgen) clean up code
|
|
35
42
|
|
|
36
43
|
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
44
|
## Advanced Features
|
|
40
45
|
For details on the parameters, refer [Message Passing API](https://pkl-lang.org/main/current/bindings-specification/message-passing-api.html).
|
|
41
46
|
|
|
@@ -18,14 +18,14 @@ classifiers = [
|
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
19
|
]
|
|
20
20
|
dependencies = [
|
|
21
|
-
"msgpack >= 1.0.8"
|
|
21
|
+
"msgpack >= 1.0.8",
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
[tool.setuptools.packages.find]
|
|
25
|
-
|
|
25
|
+
where = ["src"]
|
|
26
26
|
|
|
27
27
|
[tool.setuptools.dynamic]
|
|
28
|
-
version = {file = "pkl/VERSION"}
|
|
28
|
+
version = {file = "src/pkl/VERSION"}
|
|
29
29
|
|
|
30
30
|
[project.optional-dependencies]
|
|
31
31
|
dev = [
|
|
@@ -40,9 +40,12 @@ dev = [
|
|
|
40
40
|
]
|
|
41
41
|
|
|
42
42
|
[project.urls]
|
|
43
|
-
"Homepage" = "https://github.com/jw-y/pkl"
|
|
44
|
-
"Bug Reports" = "https://github.com/jw-y/pkl/issues"
|
|
45
|
-
"Source" = "https://github.com/jw-y/pkl"
|
|
43
|
+
"Homepage" = "https://github.com/jw-y/pkl-python"
|
|
44
|
+
"Bug Reports" = "https://github.com/jw-y/pkl-python/issues"
|
|
45
|
+
"Source" = "https://github.com/jw-y/pkl-python"
|
|
46
|
+
|
|
47
|
+
[project.scripts]
|
|
48
|
+
pkl-gen-python = "pkl_gen_python:main"
|
|
46
49
|
|
|
47
50
|
[tool.twine]
|
|
48
51
|
repository = "pypi"
|
|
@@ -50,9 +53,14 @@ repository = "pypi"
|
|
|
50
53
|
[tool.black]
|
|
51
54
|
line-length = 88
|
|
52
55
|
target-version = ['py310']
|
|
56
|
+
force-exclude = 'codegen/snippet-tests/output/'
|
|
53
57
|
|
|
54
58
|
[tool.isort]
|
|
55
59
|
profile = "black"
|
|
60
|
+
skip = ["codegen/snippet-tests/output/*"]
|
|
61
|
+
|
|
62
|
+
[tool.autoflake]
|
|
63
|
+
exclude = ["codegen/snippet-tests/output/*"]
|
|
56
64
|
|
|
57
65
|
[tool.pytest.ini_options]
|
|
58
66
|
addopts = "-ra -q"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.13
|
|
@@ -34,6 +34,21 @@ def _search_project_dir(module_path: str) -> str:
|
|
|
34
34
|
return str(cur_path.absolute())
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
def _parse_module_uri(module_uri, module_text):
|
|
38
|
+
parsed = urlparse(str(module_uri))
|
|
39
|
+
|
|
40
|
+
def is_uri(_uri: ParseResult):
|
|
41
|
+
return bool(_uri.scheme) and (bool(_uri.netloc) or bool(_uri.path))
|
|
42
|
+
|
|
43
|
+
if module_text:
|
|
44
|
+
source = ModuleSource.from_text(module_text)
|
|
45
|
+
elif is_uri(parsed):
|
|
46
|
+
source = ModuleSource.from_uri(module_uri)
|
|
47
|
+
else:
|
|
48
|
+
source = ModuleSource.from_path(module_uri)
|
|
49
|
+
return source
|
|
50
|
+
|
|
51
|
+
|
|
37
52
|
def load(
|
|
38
53
|
module_uri: Union[str, Path],
|
|
39
54
|
*,
|
|
@@ -71,17 +86,7 @@ def load(
|
|
|
71
86
|
environmental configurations, and support for complex project dependencies.
|
|
72
87
|
"""
|
|
73
88
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def is_uri(_uri: ParseResult):
|
|
77
|
-
return bool(_uri.scheme) and (bool(_uri.netloc) or bool(_uri.path))
|
|
78
|
-
|
|
79
|
-
if module_text:
|
|
80
|
-
source = ModuleSource.from_text(module_text)
|
|
81
|
-
elif is_uri(parsed):
|
|
82
|
-
source = ModuleSource.from_uri(module_uri)
|
|
83
|
-
else:
|
|
84
|
-
source = ModuleSource.from_path(module_uri)
|
|
89
|
+
source = _parse_module_uri(module_uri, module_text)
|
|
85
90
|
|
|
86
91
|
if project_dir is PKL_DEFAULT:
|
|
87
92
|
project_dir = _search_project_dir(str(module_uri))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pkl-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.13
|
|
4
4
|
Summary: Python library for Apple's PKL.
|
|
5
5
|
Author-email: Jungwoo Yang <jwyang0213@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -25,9 +25,9 @@ License: MIT License
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
SOFTWARE.
|
|
27
27
|
|
|
28
|
-
Project-URL: Homepage, https://github.com/jw-y/pkl
|
|
29
|
-
Project-URL: Bug Reports, https://github.com/jw-y/pkl/issues
|
|
30
|
-
Project-URL: Source, https://github.com/jw-y/pkl
|
|
28
|
+
Project-URL: Homepage, https://github.com/jw-y/pkl-python
|
|
29
|
+
Project-URL: Bug Reports, https://github.com/jw-y/pkl-python/issues
|
|
30
|
+
Project-URL: Source, https://github.com/jw-y/pkl-python
|
|
31
31
|
Classifier: Programming Language :: Python :: 3
|
|
32
32
|
Classifier: License :: OSI Approved :: MIT License
|
|
33
33
|
Classifier: Operating System :: OS Independent
|
|
@@ -68,21 +68,26 @@ Here's how you can start using `pkl-python` to load a PKL module:
|
|
|
68
68
|
import pkl
|
|
69
69
|
|
|
70
70
|
config = pkl.load("path/to/pkl/example_module.pkl")
|
|
71
|
-
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Code Generation
|
|
74
|
+
As Python is a dynamic language, codegen is not strictly necessary.
|
|
75
|
+
However, codegen lets you expect contents of pkl files within Python modules.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
pkl-gen-python path/to/pkl/example_module.pkl
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
### Status
|
|
75
|
-
* Evaluator API:
|
|
76
|
-
* Code Generation:
|
|
82
|
+
* Evaluator API: functional
|
|
83
|
+
* Code Generation: functional, but needs refining
|
|
77
84
|
|
|
78
85
|
### TODO
|
|
79
|
-
* [
|
|
80
|
-
* [ ] (codgen)
|
|
86
|
+
* [x] (codgen) pip binary installation
|
|
87
|
+
* [ ] (codgen) gatherer depth-first ordering
|
|
81
88
|
* [ ] (codgen) clean up code
|
|
82
89
|
|
|
83
90
|
|
|
84
|
-
## Usage
|
|
85
|
-
|
|
86
91
|
## Advanced Features
|
|
87
92
|
For details on the parameters, refer [Message Passing API](https://pkl-lang.org/main/current/bindings-specification/message-passing-api.html).
|
|
88
93
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
src/pkl/VERSION
|
|
6
|
+
src/pkl/__init__.py
|
|
7
|
+
src/pkl/evaluator_manager.py
|
|
8
|
+
src/pkl/evaluator_options.py
|
|
9
|
+
src/pkl/msgapi.py
|
|
10
|
+
src/pkl/parser.py
|
|
11
|
+
src/pkl/reader.py
|
|
12
|
+
src/pkl/server.py
|
|
13
|
+
src/pkl/utils.py
|
|
14
|
+
src/pkl_python.egg-info/PKG-INFO
|
|
15
|
+
src/pkl_python.egg-info/SOURCES.txt
|
|
16
|
+
src/pkl_python.egg-info/dependency_links.txt
|
|
17
|
+
src/pkl_python.egg-info/entry_points.txt
|
|
18
|
+
src/pkl_python.egg-info/requires.txt
|
|
19
|
+
src/pkl_python.egg-info/top_level.txt
|
|
20
|
+
tests/test_evaluator_manager.py
|
|
21
|
+
tests/test_fixtures.py
|
|
22
|
+
tests/test_load.py
|
|
23
|
+
tests/test_parser.py
|
|
24
|
+
tests/test_readers.py
|
|
25
|
+
tests/test_server.py
|
|
26
|
+
tests/test_trace.py
|
|
@@ -10,5 +10,5 @@ def test_multiple():
|
|
|
10
10
|
with EvaluatorManager(debug=True) as manager:
|
|
11
11
|
opts = PreconfiguredOptions()
|
|
12
12
|
evaluator = manager.new_evaluator(opts)
|
|
13
|
-
source = ModuleSource.from_path("./tests/with_log.pkl")
|
|
13
|
+
source = ModuleSource.from_path("./tests/pkls/with_log.pkl")
|
|
14
14
|
evaluator.evaluate_module(source)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pkl
|
|
4
|
+
from tests.Fixtures.Generated.AnyType_pkl import AnyType, Bird
|
|
5
|
+
from tests.Fixtures.Generated.ApiTypes_pkl import ApiTypes
|
|
6
|
+
from tests.Fixtures.Generated.Classes_pkl import Animal, Classes
|
|
7
|
+
from tests.Fixtures.Generated.Collections_pkl import Collections
|
|
8
|
+
from tests.Fixtures.Generated.ExtendedModule_pkl import ExtendedModule
|
|
9
|
+
|
|
10
|
+
base_path = Path("./tests/Fixtures")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_evaluate_classes():
|
|
14
|
+
result = Classes.load_pkl(base_path / "Classes.pkl")
|
|
15
|
+
expected = Classes(
|
|
16
|
+
animals=[
|
|
17
|
+
Animal(name="Uni"),
|
|
18
|
+
Animal(name="Wally"),
|
|
19
|
+
Animal(name="Mouse"),
|
|
20
|
+
]
|
|
21
|
+
)
|
|
22
|
+
assert result == expected
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_evaluate_collections():
|
|
26
|
+
result = Collections.load_pkl(base_path / "Collections.pkl")
|
|
27
|
+
expected = Collections(
|
|
28
|
+
res1=[1, 2, 3],
|
|
29
|
+
res2=[2, 3, 4],
|
|
30
|
+
res3=[[1], [2], [3]],
|
|
31
|
+
res4=[[1], [2], [3]],
|
|
32
|
+
res5={1: True, 2: False},
|
|
33
|
+
res6={1: {1: True}, 2: {2: True}, 3: {3: True}},
|
|
34
|
+
res7={1: True, 2: False},
|
|
35
|
+
res8={1: {1: True}, 2: {2: False}},
|
|
36
|
+
res9={"one", "two", "three"},
|
|
37
|
+
res10={1, 2, 3},
|
|
38
|
+
)
|
|
39
|
+
assert result == expected
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_evaluate_api_types():
|
|
43
|
+
result = ApiTypes.load_pkl(base_path / "ApiTypes.pkl")
|
|
44
|
+
# Define expected result based on your ApiTypes.Module structure
|
|
45
|
+
expected = ApiTypes(
|
|
46
|
+
res1=pkl.Pair(42, "Hello"),
|
|
47
|
+
res2=pkl.Duration(10, "h"),
|
|
48
|
+
res3=pkl.DataSize(1.2345, "gib"),
|
|
49
|
+
)
|
|
50
|
+
assert result == expected
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_polymorphic_types():
|
|
54
|
+
from tests.Fixtures.Generated.pkl_python_example_Poly_pkl import (
|
|
55
|
+
Animal,
|
|
56
|
+
Bird,
|
|
57
|
+
Dog,
|
|
58
|
+
Poly,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
result = Poly.load_pkl(base_path / "Poly.pkl")
|
|
62
|
+
expected = Poly(
|
|
63
|
+
beings=[
|
|
64
|
+
Animal(name="Lion", exists=True),
|
|
65
|
+
Dog(barks=True, hates=None, name="Ruuf", exists=True),
|
|
66
|
+
Bird(name="Duck", flies=False, exists=False),
|
|
67
|
+
],
|
|
68
|
+
rex=Dog(barks=False, hates=None, name="Rex", exists=True),
|
|
69
|
+
moreBeings={
|
|
70
|
+
"duck": Bird(name="Ducky", flies=True, exists=True),
|
|
71
|
+
"dog": Dog(
|
|
72
|
+
barks=False,
|
|
73
|
+
hates=Dog(barks=False, hates=None, name="Rex", exists=True),
|
|
74
|
+
name="TRex",
|
|
75
|
+
exists=True,
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
)
|
|
79
|
+
assert result == expected
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_polymorphic_modules():
|
|
83
|
+
result = ExtendedModule.load_pkl(base_path / "ExtendedModule.pkl")
|
|
84
|
+
expected = ExtendedModule(foo="foo", bar=10)
|
|
85
|
+
assert result == expected
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_any_type():
|
|
89
|
+
result = AnyType.load_pkl(base_path / "AnyType.pkl")
|
|
90
|
+
expected = AnyType(
|
|
91
|
+
bird=Bird(species="Owl"),
|
|
92
|
+
primitive="foo",
|
|
93
|
+
primitive2=12,
|
|
94
|
+
array=[1, 2],
|
|
95
|
+
set={5, 6},
|
|
96
|
+
mapping={"1": 12, 12: "1"},
|
|
97
|
+
nullable=None,
|
|
98
|
+
duration=pkl.Duration(5.0, unit="min"),
|
|
99
|
+
dataSize=pkl.DataSize(10.0, unit="mb"),
|
|
100
|
+
)
|
|
101
|
+
assert result == expected
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_union_types():
|
|
105
|
+
from tests.Fixtures.Generated.UnionTypes_pkl import (
|
|
106
|
+
Apple,
|
|
107
|
+
Banana,
|
|
108
|
+
Donkey,
|
|
109
|
+
Grape,
|
|
110
|
+
UnionTypes,
|
|
111
|
+
Zebra,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
result = UnionTypes.load_pkl(base_path / "UnionTypes.pkl")
|
|
115
|
+
expected = UnionTypes(
|
|
116
|
+
fruit1=Banana(isRipe=True),
|
|
117
|
+
fruit2=Grape(isUsedForWine=True),
|
|
118
|
+
fruit3=Apple(isRed=False),
|
|
119
|
+
city1="San Francisco",
|
|
120
|
+
city2="Tokyo",
|
|
121
|
+
city3="Zurich",
|
|
122
|
+
city4="London",
|
|
123
|
+
animal1=Zebra(name="Zebra"),
|
|
124
|
+
animal2=Donkey(name="Donkey"),
|
|
125
|
+
animalOrString1=Zebra(name="Zebra"),
|
|
126
|
+
animalOrString2="Zebra",
|
|
127
|
+
)
|
|
128
|
+
assert result == expected
|
|
@@ -2,11 +2,11 @@ import pkl
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def test_load():
|
|
5
|
-
_ = pkl.load("./tests/types.pkl")
|
|
5
|
+
_ = pkl.load("./tests/pkls/types.pkl")
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def test_load_expr():
|
|
9
|
-
config = pkl.load("./tests/types.pkl", expr="datasize")
|
|
9
|
+
config = pkl.load("./tests/pkls/types.pkl", expr="datasize")
|
|
10
10
|
assert config.__class__.__name__ == "DataSize"
|
|
11
11
|
|
|
12
12
|
|
|
@@ -16,4 +16,4 @@ def test_load_text():
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def test_load_debug():
|
|
19
|
-
_ = pkl.load("./tests/types.pkl", debug=True)
|
|
19
|
+
_ = pkl.load("./tests/pkls/types.pkl", debug=True)
|
|
@@ -24,7 +24,7 @@ def test_read_modules():
|
|
|
24
24
|
moduleReaders=[TestModuleReader("customfs", True, True, True)]
|
|
25
25
|
)
|
|
26
26
|
opts.allowedModules.append("customfs:")
|
|
27
|
-
_ = pkl.load("./tests/myModule.pkl", evaluator_options=opts)
|
|
27
|
+
_ = pkl.load("./tests/pkls/myModule.pkl", evaluator_options=opts)
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def test_read_modules_error():
|
|
@@ -40,7 +40,7 @@ def test_read_modules_error():
|
|
|
40
40
|
)
|
|
41
41
|
opts.allowedModules.append("customfs:")
|
|
42
42
|
with pytest.raises(PklError):
|
|
43
|
-
_ = pkl.load("./tests/myModule.pkl", evaluator_options=opts)
|
|
43
|
+
_ = pkl.load("./tests/pkls/myModule.pkl", evaluator_options=opts)
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def test_read_resources():
|
|
@@ -60,4 +60,4 @@ def test_read_resources():
|
|
|
60
60
|
)
|
|
61
61
|
opts.allowedResources.append("customfs:")
|
|
62
62
|
|
|
63
|
-
_ = pkl.load("./tests/with_read.pkl", evaluator_options=opts)
|
|
63
|
+
_ = pkl.load("./tests/pkls/with_read.pkl", evaluator_options=opts)
|
pkl-python-0.1.12/pkl/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.12
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
setup.py
|
|
5
|
-
pkl/VERSION
|
|
6
|
-
pkl/__init__.py
|
|
7
|
-
pkl/evaluator_manager.py
|
|
8
|
-
pkl/evaluator_options.py
|
|
9
|
-
pkl/msgapi.py
|
|
10
|
-
pkl/parser.py
|
|
11
|
-
pkl/reader.py
|
|
12
|
-
pkl/server.py
|
|
13
|
-
pkl/utils.py
|
|
14
|
-
pkl_python.egg-info/PKG-INFO
|
|
15
|
-
pkl_python.egg-info/SOURCES.txt
|
|
16
|
-
pkl_python.egg-info/dependency_links.txt
|
|
17
|
-
pkl_python.egg-info/requires.txt
|
|
18
|
-
pkl_python.egg-info/top_level.txt
|
|
19
|
-
scripts/download_binary.py
|
|
20
|
-
scripts/eval.py
|
|
21
|
-
tests/test_evaluator_manager.py
|
|
22
|
-
tests/test_load.py
|
|
23
|
-
tests/test_parser.py
|
|
24
|
-
tests/test_readers.py
|
|
25
|
-
tests/test_server.py
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import requests
|
|
5
|
-
|
|
6
|
-
VERSION = "0.25.2"
|
|
7
|
-
|
|
8
|
-
BASE_PATH = "https://github.com/apple/pkl/releases/download/"
|
|
9
|
-
filenames = [
|
|
10
|
-
"pkl-macos-aarch64",
|
|
11
|
-
"pkl-macos-amd64",
|
|
12
|
-
"pkl-linux-aarch64",
|
|
13
|
-
"pkl-linux-amd64",
|
|
14
|
-
"pkl-alpine-linux-amd64",
|
|
15
|
-
]
|
|
16
|
-
JAVA_FILE = f"https://repo1.maven.org/maven2/org/pkl-lang/pkl-cli-java/{VERSION}/pkl-cli-java-{VERSION}.jar"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def main(save_path):
|
|
20
|
-
urls = [BASE_PATH + VERSION + "/" + file for file in filenames]
|
|
21
|
-
urls.append(JAVA_FILE)
|
|
22
|
-
|
|
23
|
-
for url in urls:
|
|
24
|
-
file = url.split("/")[-1]
|
|
25
|
-
fp = save_path / file
|
|
26
|
-
|
|
27
|
-
response = requests.get(url)
|
|
28
|
-
with open(fp, "wb") as f:
|
|
29
|
-
f.write(response.content)
|
|
30
|
-
|
|
31
|
-
print("written to", fp)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if __name__ == "__main__":
|
|
35
|
-
parser = argparse.ArgumentParser()
|
|
36
|
-
parser.add_argument(
|
|
37
|
-
"output_path", help="Directory where binaries will be downloaded"
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
args = parser.parse_args()
|
|
41
|
-
|
|
42
|
-
main(Path(args.output_path))
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from pprint import pprint
|
|
4
|
-
|
|
5
|
-
import pkll
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main(target, force=False, debug=False, is_print=False):
|
|
9
|
-
target = Path(target)
|
|
10
|
-
|
|
11
|
-
if target.is_file():
|
|
12
|
-
files = [target]
|
|
13
|
-
elif target.is_dir():
|
|
14
|
-
files = list(target.glob("*.pkl"))
|
|
15
|
-
else:
|
|
16
|
-
raise ValueError(target)
|
|
17
|
-
|
|
18
|
-
for f in files:
|
|
19
|
-
if f.is_file():
|
|
20
|
-
config = pkll.load(f.absolute().as_uri(), force_render=force, debug=debug)
|
|
21
|
-
if is_print:
|
|
22
|
-
pprint(config)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if __name__ == "__main__":
|
|
26
|
-
parser = argparse.ArgumentParser()
|
|
27
|
-
parser.add_argument("target")
|
|
28
|
-
parser.add_argument("--force", "-f", action="store_true")
|
|
29
|
-
parser.add_argument("--debug", "-d", action="store_true")
|
|
30
|
-
parser.add_argument("--print", "-p", action="store_true")
|
|
31
|
-
args = parser.parse_args()
|
|
32
|
-
main(args.target, force=args.force, debug=args.debug, is_print=args.print)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|