From fcc5800132e89eb27db5bad1209f5001e3b09a56 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Jul 2023 10:52:34 -0700 Subject: [PATCH 1/6] Remove accidental tkinter import in load_save_test.py --- python/tests/load_save_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/tests/load_save_test.py b/python/tests/load_save_test.py index a2a9abe..36dae38 100644 --- a/python/tests/load_save_test.py +++ b/python/tests/load_save_test.py @@ -1,5 +1,4 @@ import os.path -from tkinter import E import saleae.automation From 8c5e7970ce65edff024fa116a7865d4a646887b3 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Jul 2023 10:52:59 -0700 Subject: [PATCH 2/6] Fix instructions for building source package --- python/BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/BUILD.md b/python/BUILD.md index d61aadb..66de0f5 100644 --- a/python/BUILD.md +++ b/python/BUILD.md @@ -14,7 +14,7 @@ Run the following commands to generate a distributable source package: ``` python -m pip install --upgrade build -python -m build --dist +python -m build --sdist ``` ### Why not .whl? From 779e888b7c7bfd1e38dc0c7ebe1b55c37a985171 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Jul 2023 10:54:21 -0700 Subject: [PATCH 3/6] Add support for specifying a gRPC port with Manager.launch --- python/saleae/automation/manager.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/saleae/automation/manager.py b/python/saleae/automation/manager.py index 1389a8d..9b02a64 100644 --- a/python/saleae/automation/manager.py +++ b/python/saleae/automation/manager.py @@ -314,9 +314,10 @@ def cleanup(): @classmethod def launch(cls, - application_path: Optional[Union[Path, str]] = None, + application_path: Optional[Union[Path, str]] = None, connect_timeout_seconds: Optional[float] = None, - grpc_channel_arguments: Optional[List[Tuple[str, Any]]] = None) -> 'Manager': + grpc_channel_arguments: Optional[List[Tuple[str, Any]]] = None, + port: Optional[int] = None) -> 'Manager': """ Launch the Logic2 application and shut it down when the returned Manager is closed. @@ -324,6 +325,7 @@ def launch(cls, a locally installed copy of Logic2 will be searched for. :param connect_timeout_seconds: See __init__ :param grpc_channel_arguments: See __init__ + :param port: Port to use for the gRPC server. If not specified, 10430 will be used. """ @@ -357,7 +359,10 @@ def fail(reason: str): if not os.path.exists(logic2_bin): fail(f'application path "{application_path}" does not exist') - process = subprocess.Popen([logic2_bin, '--automation', '--automationPort', str(_DEFAULT_GRPC_PORT)], + if port is None: + port = _DEFAULT_GRPC_PORT + + process = subprocess.Popen([logic2_bin, '--automation', '--automationPort', str(port)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) @@ -383,7 +388,7 @@ def fail(reason: str): return cls( address=_DEFAULT_GRPC_ADDRESS, - port=_DEFAULT_GRPC_PORT, + port=port, logic2_process=process, connect_timeout_seconds=connect_timeout_seconds, grpc_channel_arguments=grpc_channel_arguments) From a6185d92366cf582010c3eb3e837ed0d8e1da49b Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 14 Jul 2023 10:55:35 -0700 Subject: [PATCH 4/6] Add support for gRPC port in pytest tests --- python/tests/conftest.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/tests/conftest.py b/python/tests/conftest.py index be1fc48..5cfd351 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -7,6 +7,7 @@ def pytest_addoption(parser): parser.addoption('--use-existing', action='store_true') parser.addoption('--app-path', action='store') + parser.addoption('--port', action='store', type=int) @pytest.fixture def asset_path() -> str: @@ -16,13 +17,15 @@ def asset_path() -> str: @pytest.fixture(scope='session') def manager(request): app_path = request.config.getoption('--app-path') + + port = request.config.getoption('--port') if app_path is not None: - with saleae.automation.Manager.launch(app_path) as mgr: + with saleae.automation.Manager.launch(app_path, port=port) as mgr: yield mgr pass elif request.config.getoption('--use-existing'): - with saleae.automation.Manager.connect(port=10430) as mgr: + with saleae.automation.Manager.connect(port=port) as mgr: yield mgr else: - with saleae.automation.Manager.launch() as mgr: + with saleae.automation.Manager.launch(port=port) as mgr: yield mgr From 480d87c29771dbea8b0119e6a7652bd45176d248 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 12 Dec 2023 09:43:27 -0800 Subject: [PATCH 5/6] Fix builds not working with hatchling 1.19.0 --- python/README.md | 4 ++++ python/pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/README.md b/python/README.md index 810ed9c..d65d48c 100644 --- a/python/README.md +++ b/python/README.md @@ -7,6 +7,10 @@ Documentation can be found at https://saleae.github.io/logic2-automation/ ## Changelog +### 1.0.7 + +- Fix builds not building with hatchling 1.19.0. + ### 1.0.6 - Moved `grpcio-tools` to build dependencies. diff --git a/python/pyproject.toml b/python/pyproject.toml index f3f01b3..ceda191 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "logic2-automation" -version = "1.0.6" +version = "1.0.7" authors = [ { name="Saleae, Inc.", email="support@saleae.com" }, ] @@ -40,7 +40,7 @@ include = [ "/saleae/grpc", ] -[tool.hatch.build.force-include] +[tool.hatch.build.targets.sdist.force-include] "../proto/saleae/grpc/saleae.proto" = "proto/saleae/grpc/saleae.proto" # The gRPC/protobuf files are only generated when building a wheel From 9cd07d6e638e5795255b3e58768616d93722e075 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 12 Dec 2023 09:54:59 -0800 Subject: [PATCH 6/6] Update README.md --- python/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/python/README.md b/python/README.md index d65d48c..8adc439 100644 --- a/python/README.md +++ b/python/README.md @@ -10,6 +10,7 @@ Documentation can be found at https://saleae.github.io/logic2-automation/ ### 1.0.7 - Fix builds not building with hatchling 1.19.0. +- Add option for setting gRPC port. ### 1.0.6