chialiyun / DiagramsPreviewerVSCExt

Visual Studio Code Extension to preview Diagrams (Diagram as a Code)
MIT License
6 stars 0 forks source link

Require a param for the interpreter in my python virtual environemt. #5

Closed alanthssss closed 11 months ago

alanthssss commented 2 years ago

Hey, Nice to implement the preview via your kind extension!

I installed diagrams dependcies on my virtual environment instead of pure python3 environment, and I generated diagrams successfully. Then when I used this cool extension to preview my diagrams, it said my python3 env does not have diagrams.

I guess here I need a blank to fill the location of the virtual envitonment's interpreter instead of only 3 choices: default, python, python3, or read the interpreter which is being used by Microsoft VS Code Python Extension.

Feel free to tell me whether my descriptions are clear enough.

Cheers!

msouff commented 1 year ago

+1 to env support.

chialiyun commented 1 year ago

Hi @alanthssss and @msouff, thank you so much for trying out the extension. Appreciate the feedback on the use case on using the interpreter that is set from vscode python extension.

We would like to share with you a good news - we are in the mist of adding this capability. We will keep you posted once it’s ready. πŸ˜ƒ

chialiyun commented 1 year ago

Hi @alanthssss and @msouff

We have released a new version (1.0.6) to cater for this functionality. 🀟

You may try out the new option in the settings - "VS Code Python Interpreter"

image

Feel free to reach out again for any other issues. 😸 Cheers πŸ₯‚

don-harden commented 1 year ago

Hi, thanks for writing this extension. I am working on a Mac with Python 3.10 and GraphViz installed via brew. I am trying to run your demo code in a virtual environment. From the command line (.venv) it works as expected. The png is created and the image viewer opens when show=True. However in VS Code I get this error no matter what diagramspreviewer.pythonCommand is set to:

image

VS Code Python interpreter is set to the virtual environment: image

And Diagramspreviewer: Python Command is set to "VS Code Python Interpreter" image

Any ideas what I am doing wrong or should try next?

Thanks, Don

chialiyun commented 1 year ago

Hi @don-harden Thank you for sharing this. πŸ˜„

Would you mind helping me with the following?

  1. double check that your are using the latest extension version (v1.0.6)?
  2. what's the command that you are run locally?
  3. is your virtual environment in the same directory like in the screenshot below? or would you mind sharing what set up did you had for your virtual environment so that I could try to replicate the same on my side to test it out. image
don-harden commented 1 year ago

Hi Chialiyun,
I installed Diagrams Previewer yesterday and it is version 1.0.6

image

The local command I am running is python demo.py in my Python 3.10 virtual environment. In the screenshot below you can see that both python and python3 are pointing the virtual environment, and the00 my_diagram.png is created when running python demo.py image

My virtual environment is in the same directory as your demo code. image

Also, since I have show=True the image viewer pops up:

image
chialiyun commented 1 year ago

hi @don-harden Thank for so much for sharing those information.

It's an issue with how we are reading the script. We will try to fix it ASAP.

In the meantime, if you make line 7-9 into 1 liner, it should work.

with Diagram('Web Service', show=False, filename="my_diagram"):

Our apologies on this, please bear with us on this formatting issue. Please let us know again if it still does not work for you.

don-harden commented 1 year ago

Yep, it works! Thanks so much Chialiyun.

image

alanthssss commented 11 months ago

Nice code, and I need to close this issue. Thx for all your works @msouff @chialiyun @don-harden .

chialiyun commented 9 months ago

hi @don-harden πŸ‘‹ , we are supporting multi-liner with Diagram implementation (i.e. if you revert to your original code on line 7-9, the extension should work as well) on v1.0.7. Feel free to check it out and reach out again if you encounter any issues. πŸ˜„

alanthssss commented 6 months ago

@chialiyun Thanks for your great work. I am using this extension for the diagram of my new project again. Glad to create diagrams as code via this kind VS Code extension! It's really better for me than a traditional UML Diagram.

chialiyun commented 6 months ago

@alanthssss happy new year and thank you for your nice words. Glad to hear that it came in useful for you.

alanthssss commented 6 months ago

@alanthssss happy new year and thank you for your nice words. Glad to hear that it came in useful for you.

@chialiyun Happy new year and Thank you, too, haha.