diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 563e069..5851cbe 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -36,6 +36,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: go-version: [1.18] test-path: @@ -70,6 +71,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: [3.9] test-path: @@ -119,6 +121,7 @@ jobs: build-test-js-versions: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: node: [20] test-path: @@ -152,6 +155,7 @@ jobs: build-test-rs-versions: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: test-path: - ./tutorials/websocket_tutorial/draw_cube_rust @@ -181,6 +185,7 @@ jobs: needs: [build-test-python-versions] runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: [3.9] steps: diff --git a/.github/workflows/python-format.yml b/.github/workflows/python-format.yml index 0cc8d0f..a5b3d7c 100644 --- a/.github/workflows/python-format.yml +++ b/.github/workflows/python-format.yml @@ -27,7 +27,7 @@ jobs: run: | pip install isort ruff black isort . */*/*.py - black . */*/*.py + ruff format ruff check --fix . */*/*.py - name: Check for modified files @@ -41,5 +41,5 @@ jobs: git config --local user.name "github-actions[bot]" git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git git fetch origin - git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!" - git push origin ${{github.event.pull_request.head.ref }} + git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!" || true + git push origin ${{github.event.pull_request.head.ref }} || true diff --git a/requirements.txt b/requirements.txt index edfb546..5de8fe5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -kittycad==0.6.21 +kittycad==0.7.0 diff --git a/samples/convert_file/convert_file.py b/samples/convert_file/convert_file.py index 6c5c212..e514b6d 100755 --- a/samples/convert_file/convert_file.py +++ b/samples/convert_file/convert_file.py @@ -54,5 +54,5 @@ output_file_path = "./output.stl" print(f"Saving output to {output_file_path}") output_file = open(output_file_path, "wb") - output_file.write(output.get_decoded()) + output_file.write(output) output_file.close() diff --git a/tutorials/beginner_tutorial/convert.py b/tutorials/beginner_tutorial/convert.py index 01ceeed..fd792f0 100644 --- a/tutorials/beginner_tutorial/convert.py +++ b/tutorials/beginner_tutorial/convert.py @@ -43,7 +43,7 @@ def convertOBJtoSTL(): output_file_path = "./dodecahedron.stl" print(f"Saving output to {output_file_path}") output_file = open(output_file_path, "wb") - output_file.write(output.get_decoded()) + output_file.write(output) output_file.close() return body diff --git a/tutorials/conversion_obj_step/conversion_obj_step.py b/tutorials/conversion_obj_step/conversion_obj_step.py index fe16621..99afdd3 100755 --- a/tutorials/conversion_obj_step/conversion_obj_step.py +++ b/tutorials/conversion_obj_step/conversion_obj_step.py @@ -53,5 +53,5 @@ output_file_path = "./output.step" print(f"Saving output to {output_file_path}") output_file = open(output_file_path, "wb") - output_file.write(output.get_decoded()) + output_file.write(output) output_file.close() diff --git a/tutorials/conversion_obj_step/output.step b/tutorials/conversion_obj_step/output.step index 292ca4e..50df27a 100644 --- a/tutorials/conversion_obj_step/output.step +++ b/tutorials/conversion_obj_step/output.step @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9985128010fd234154fd7f0580ef86690c60201691a7047d004761537c4b9fd2 +oid sha256:2bc33baf070b1bd4ddf5021181e834def6fe8c61f5ec724fd72611f270e270bb size 505853 diff --git a/tutorials/conversion_obj_stl/conversion_obj_stl.py b/tutorials/conversion_obj_stl/conversion_obj_stl.py index 87cd167..812243a 100755 --- a/tutorials/conversion_obj_stl/conversion_obj_stl.py +++ b/tutorials/conversion_obj_stl/conversion_obj_stl.py @@ -54,5 +54,5 @@ output_file_path = "./output.stl" print(f"Saving output to {output_file_path}") output_file = open(output_file_path, "wb") - output_file.write(output.get_decoded()) + output_file.write(output) output_file.close() diff --git a/tutorials/getting_started/getting_started.py b/tutorials/getting_started/getting_started.py index d3a2fcc..5c786c9 100755 --- a/tutorials/getting_started/getting_started.py +++ b/tutorials/getting_started/getting_started.py @@ -55,5 +55,5 @@ output_file_path = "./output.stl" print(f"Saving output to {output_file_path}") output_file = open(output_file_path, "wb") - output_file.write(output.get_decoded()) + output_file.write(output) output_file.close() diff --git a/tutorials/import_file/import_model.py b/tutorials/import_file/import_model.py index 84d0025..b428c74 100644 --- a/tutorials/import_file/import_model.py +++ b/tutorials/import_file/import_model.py @@ -16,13 +16,13 @@ UnitLength, WebSocketRequest, ) -from kittycad.models.input_format import obj +from kittycad.models.input_format import OptionObj from kittycad.models.modeling_cmd import ( - default_camera_focus_on, - import_files, - take_snapshot, + OptionDefaultCameraFocusOn, + OptionImportFiles, + OptionTakeSnapshot, ) -from kittycad.models.web_socket_request import modeling_cmd_req +from kittycad.models.web_socket_request import OptionModelingCmdReq def test_ws_import(): @@ -49,12 +49,12 @@ def test_ws_import(): ImportFile(data=content, path=file_name) # form the request req = WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - import_files( + OptionImportFiles( files=[ImportFile(data=content, path=file_name)], format=InputFormat( - obj( + OptionObj( units=UnitLength.M, coords=System( forward=AxisDirectionPair( @@ -103,8 +103,8 @@ def test_ws_import(): cmd_id = uuid.uuid4() # form the request req = WebSocketRequest( - modeling_cmd_req( - cmd=ModelingCmd(default_camera_focus_on(uuid=object_id)), + OptionModelingCmdReq( + cmd=ModelingCmd(OptionDefaultCameraFocusOn(uuid=object_id)), cmd_id=ModelingCmdId(cmd_id), ) ) @@ -127,8 +127,8 @@ def test_ws_import(): cmd_id = uuid.uuid4() # form the request req = WebSocketRequest( - modeling_cmd_req( - cmd=ModelingCmd(take_snapshot(format=ImageFormat.PNG)), + OptionModelingCmdReq( + cmd=ModelingCmd(OptionTakeSnapshot(format=ImageFormat.PNG)), cmd_id=ModelingCmdId(cmd_id), ) ) @@ -154,7 +154,7 @@ def test_ws_import(): # Break since now we know it was a success. png_contents = message_dict["resp"]["data"]["modeling_response"][ "data" - ]["contents"].get_decoded() + ]["contents"] break # Save the contents to a file. diff --git a/tutorials/text-to-cad/text-to-cad.py b/tutorials/text-to-cad/text-to-cad.py index de83024..fef3392 100644 --- a/tutorials/text-to-cad/text-to-cad.py +++ b/tutorials/text-to-cad/text-to-cad.py @@ -42,5 +42,5 @@ # Save the STEP data as text-to-cad-output.step final_result = response.outputs["source.step"] with open("text-to-cad-output.step", "w", encoding="utf-8") as output_file: - output_file.write(final_result.get_decoded().decode("utf-8")) + output_file.write(final_result.decode("utf-8")) print(f"Saved output to {output_file.name}") diff --git a/tutorials/websocket_tutorial/10_sample.py.part b/tutorials/websocket_tutorial/10_sample.py.part index 1a4c8d6..8e4578e 100644 --- a/tutorials/websocket_tutorial/10_sample.py.part +++ b/tutorials/websocket_tutorial/10_sample.py.part @@ -9,7 +9,7 @@ ): png_contents = message_dict["resp"]["data"]["modeling_response"][ "data" - ]["contents"].get_decoded() + ]["contents"] break # Save the contents to a file. diff --git a/tutorials/websocket_tutorial/draw_cube_rust/src/main.rs b/tutorials/websocket_tutorial/draw_cube_rust/src/main.rs index 5bebef5..8d05489 100644 --- a/tutorials/websocket_tutorial/draw_cube_rust/src/main.rs +++ b/tutorials/websocket_tutorial/draw_cube_rust/src/main.rs @@ -142,7 +142,6 @@ async fn draw_cube( write_to_ws .send(to_msg( ModelingCmd::Extrude { - cap: true, distance: width * 2.0, target: path_id, }, diff --git a/tutorials/websocket_tutorial/websocketexample.py b/tutorials/websocket_tutorial/websocketexample.py index 50392b3..845f427 100644 --- a/tutorials/websocket_tutorial/websocketexample.py +++ b/tutorials/websocket_tutorial/websocketexample.py @@ -6,16 +6,16 @@ from kittycad.client import ClientFromEnv from kittycad.models import ImageFormat, ModelingCmd, ModelingCmdId, WebSocketRequest from kittycad.models.modeling_cmd import ( - close_path, - default_camera_look_at, - extend_path, - extrude, - move_path_pen, - start_path, - take_snapshot, + OptionClosePath, + OptionDefaultCameraLookAt, + OptionExtendPath, + OptionExtrude, + OptionMovePathPen, + OptionStartPath, + OptionTakeSnapshot, ) -from kittycad.models.path_segment import line -from kittycad.models.web_socket_request import modeling_cmd_req +from kittycad.models.path_segment import OptionLine +from kittycad.models.web_socket_request import OptionModelingCmdReq def make_cube(): @@ -41,17 +41,18 @@ def make_cube(): # Start the Path websocket.send( WebSocketRequest( - modeling_cmd_req( - cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(sketch_path_id) + OptionModelingCmdReq( + cmd=ModelingCmd(OptionStartPath()), + cmd_id=ModelingCmdId(sketch_path_id), ), ) ) websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - move_path_pen( + OptionMovePathPen( path=str(sketch_path_id), to={ "x": -5, @@ -67,11 +68,11 @@ def make_cube(): websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - extend_path( + OptionExtendPath( path=str(sketch_path_id), - segment=line( + segment=OptionLine( end={ "x": 10, "y": 0, @@ -88,11 +89,11 @@ def make_cube(): websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - extend_path( + OptionExtendPath( path=str(sketch_path_id), - segment=line( + segment=OptionLine( end={ "x": 0, "y": 10, @@ -109,11 +110,11 @@ def make_cube(): websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - extend_path( + OptionExtendPath( path=str(sketch_path_id), - segment=line( + segment=OptionLine( end={ "x": -10, "y": 0, @@ -131,19 +132,21 @@ def make_cube(): # Close the sketch websocket.send( WebSocketRequest( - modeling_cmd_req( - cmd=ModelingCmd(close_path(path_id=ModelingCmdId(sketch_path_id))), + OptionModelingCmdReq( + cmd=ModelingCmd( + OptionClosePath(path_id=ModelingCmdId(sketch_path_id)) + ), cmd_id=ModelingCmdId(uuid.uuid4()), ) ) ) - # Extrude the square into a cube + # OptionExtrude the square into a cube websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - extrude( + OptionExtrude( cap=True, distance=10, target=ModelingCmdId(sketch_path_id), @@ -163,9 +166,9 @@ def make_cube(): # Orient the camera. websocket.send( WebSocketRequest( - modeling_cmd_req( + OptionModelingCmdReq( cmd=ModelingCmd( - default_camera_look_at( + OptionDefaultCameraLookAt( center={"x": 0, "y": 0, "z": 0}, up={"x": 0, "y": 0, "z": 1}, vantage={"x": 20, "y": 20, "z": 20}, @@ -179,8 +182,8 @@ def make_cube(): # Take a snapshot. websocket.send( WebSocketRequest( - modeling_cmd_req( - cmd=ModelingCmd(take_snapshot(format=ImageFormat.PNG)), + OptionModelingCmdReq( + cmd=ModelingCmd(OptionTakeSnapshot(format=ImageFormat.PNG)), cmd_id=ModelingCmdId(uuid.uuid4()), ) ) @@ -196,7 +199,7 @@ def make_cube(): ): png_contents = message_dict["resp"]["data"]["modeling_response"][ "data" - ]["contents"].get_decoded() + ]["contents"] break # Save the contents to a file.