Skip to content

Conversation

@yt-ms
Copy link
Collaborator

@yt-ms yt-ms commented Nov 1, 2020

Add dump(), dumps() and loads() to Workspace to make it easier to work with import/export outside of Structurizr. Opted not to go for an example as @mrchrisadams is looking to do this in readme.rst, which is probably better.


THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE Apache License v.2.0. YOU MAY OBTAIN A COPY OF THE LICENSE AT https://www.apache.org/licenses/LICENSE-2.0.

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS

@codecov-io
Copy link

codecov-io commented Nov 1, 2020

Codecov Report

Merging #49 into devel will increase coverage by 0.19%.
The diff coverage is 92.30%.

Impacted file tree graph

@@ Coverage Diff @@ ## devel #49 +/- ## ========================================== + Coverage 85.10% 85.29% +0.19%  ========================================== Files 64 64 Lines 1745 1755 +10 Branches 151 151 ========================================== + Hits 1485 1497 +12  + Misses 228 227 -1  + Partials 32 31 -1 
Impacted Files Coverage Δ
src/structurizr/api/structurizr_client.py 77.86% <0.00%> (ø)
src/structurizr/workspace.py 100.00% <100.00%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3732199...1ce6b82. Read the comment docs.

@yt-ms yt-ms force-pushed the issue-42-workspace-save-load branch from c715fe0 to 31e15e8 Compare November 1, 2020 15:36
@yt-ms yt-ms marked this pull request as ready for review November 1, 2020 15:54
Copy link
Owner

@Midnighter Midnighter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some smaller comments and questions, otherwise looks good.

self,
filename: Union[str, Path],
*,
zip: bool = False,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A common pattern is to basically check filename.endswith(".gz") and then automatically gzip. This is a bit more versatile but less convenient. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the convenience of defaulting based on the filename, but still feel like we should give the caller control (especially being able to zip without .gz ending if they want. I've refactored to support both - see what you think.

@yt-ms yt-ms force-pushed the issue-42-workspace-save-load branch from 31e15e8 to 1a8b01c Compare November 4, 2020 07:20
@yt-ms yt-ms force-pushed the issue-42-workspace-save-load branch from 1ce6b82 to 03b26e7 Compare November 4, 2020 08:06
@yt-ms yt-ms force-pushed the issue-42-workspace-save-load branch from 18c8530 to 5d51e1c Compare November 4, 2020 09:04
Copy link
Owner

@Midnighter Midnighter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it 🙂

@Midnighter Midnighter linked an issue Nov 4, 2020 that may be closed by this pull request
1 task
@Midnighter Midnighter merged commit 1732651 into Midnighter:devel Nov 4, 2020
@yt-ms yt-ms deleted the issue-42-workspace-save-load branch November 4, 2020 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants