chiklisp-loader 0.1.2__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.
@@ -0,0 +1,13 @@
1
+ Copyright 2023 by Richard Kiss
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: chiklisp_loader
3
+ Version: 0.1.2
4
+ Summary: Provides `load_puzzle` which dynamic rebuilds if `chiklisp_builder` is available.
5
+ Author-email: Richard Kiss <him@richardkiss.com>
6
+ License: Copyright 2023 by Richard Kiss
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+
23
+ # chiklisp_loader
24
+
25
+ This tiny wheel exports `load_program`, which is used to load [chiklisp](https://chiklisp.com/) programs from resources included with python wheels.
26
+
27
+ Chiklisp `.clsp` files are compiled into `.hex` output. Only `.hex` output files need to be included in binary wheels
28
+
29
+ When `load_program` is called, it tries to import `chiklisp_builder`. If it fails, it assumes this is running at deploy time: any `.clsp` files are ignored, and the corresponding program is loaded from the `.hex` file.
@@ -0,0 +1,7 @@
1
+ # chiklisp_loader
2
+
3
+ This tiny wheel exports `load_program`, which is used to load [chiklisp](https://chiklisp.com/) programs from resources included with python wheels.
4
+
5
+ Chiklisp `.clsp` files are compiled into `.hex` output. Only `.hex` output files need to be included in binary wheels
6
+
7
+ When `load_program` is called, it tries to import `chiklisp_builder`. If it fails, it assumes this is running at deploy time: any `.clsp` files are ignored, and the corresponding program is loaded from the `.hex` file.
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: chiklisp-loader
3
+ Version: 0.1.2
4
+ Summary: Provides `load_puzzle` which dynamic rebuilds if `chiklisp_builder` is available.
5
+ Author-email: Richard Kiss <him@richardkiss.com>
6
+ License: Copyright 2023 by Richard Kiss
7
+
8
+ Licensed under the Apache License, Version 2.0 (the "License");
9
+ you may not use this file except in compliance with the License.
10
+ You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software
15
+ distributed under the License is distributed on an "AS IS" BASIS,
16
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ See the License for the specific language governing permissions and
18
+ limitations under the License.
19
+
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+
23
+ # chiklisp_loader
24
+
25
+ This tiny wheel exports `load_program`, which is used to load [chiklisp](https://chiklisp.com/) programs from resources included with python wheels.
26
+
27
+ Chiklisp `.clsp` files are compiled into `.hex` output. Only `.hex` output files need to be included in binary wheels
28
+
29
+ When `load_program` is called, it tries to import `chiklisp_builder`. If it fails, it assumes this is running at deploy time: any `.clsp` files are ignored, and the corresponding program is loaded from the `.hex` file.
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ chiklisp_loader.py
4
+ pyproject.toml
5
+ setup.py
6
+ chiklisp_loader.egg-info/PKG-INFO
7
+ chiklisp_loader.egg-info/SOURCES.txt
8
+ chiklisp_loader.egg-info/dependency_links.txt
9
+ chiklisp_loader.egg-info/requires.txt
10
+ chiklisp_loader.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ klvm_rs
2
+ importlib_resources
@@ -0,0 +1 @@
1
+ chiklisp_loader
@@ -0,0 +1,36 @@
1
+ from importlib_resources import as_file, files, Package
2
+
3
+ from klvm_rs import Program
4
+
5
+
6
+ try:
7
+ from runtime_builder import build_on_demand
8
+ except ImportError:
9
+ # `runtime_builder` is an optional dependency for development only
10
+ def build_on_demand(*args):
11
+ pass
12
+
13
+
14
+ def load_resource(
15
+ package: Package,
16
+ resource_path: str,
17
+ ) -> bytes:
18
+ build_on_demand(package, resource_path)
19
+ with as_file(files(package).joinpath(resource_path)) as target_path:
20
+ return target_path.read_bytes()
21
+
22
+
23
+ def load_program(
24
+ package: Package,
25
+ resource_path: str,
26
+ ) -> Program:
27
+ """
28
+ package: a package identifier (often `__package__` for "this package"
29
+ or a dotted string "foo.bar")
30
+ resource_path: a `.hex` resource file in that package
31
+
32
+ If the `chiklisp_builder` wheel is installed, it will be used to rebuild
33
+ the `.hex` file on demand prior to it being returned to optimize the
34
+ develop/test cycle.
35
+ """
36
+ return Program.fromhex(load_resource(package, resource_path).decode("utf8"))
@@ -0,0 +1,12 @@
1
+ [project]
2
+ name = "chiklisp_loader"
3
+ description = "Provides `load_puzzle` which dynamic rebuilds if `chiklisp_builder` is available."
4
+ authors = [{name = "Richard Kiss", email = "him@richardkiss.com"}]
5
+ license = {file = "LICENSE"}
6
+ readme = "README.md"
7
+ version = "0.1.2"
8
+ dependencies = ["klvm_rs", "importlib_resources"]
9
+
10
+ [build-system]
11
+ requires = ["setuptools>=42", "wheel"]
12
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ py_modules=["chiklisp_loader"],
5
+ )