Inkscape.org
Creating New Extensions Development environment on Windows 11 - How I'm doing it, and a question
  1. #1
    beepbeepmorales beepbeepmorales @beepbeepmorales

    I wanted to share the setup I am using for extension development because:

    1. It took me several days to figure out.
    2. Some of it is not obvious.
    3. I am probably doing it wrong, and would love suggestions on how to improve.
    4. I have a question about a minor annoyance that I can't seem to figure out on my own.

    I am brand new to computer programming and Inkscape extension development, so take the following with a grain of salt.

    First, I am using the latest version of Windows 11.
    I am using Visual Studio Code for an editor:
    https://code.visualstudio.com/

    I installed the recommended Python extensions, and also install a formatter called "Black".

    I am -- trying -- to use Git and GitHub for version control. I installed Git for Windows, and accepted all the defaults:

    https://gitforwindows.org/

    I created a GitHub account, and was able to figure out how to clone / branch / make commits locally, then push my changes back to GitHub. The first time I tried to push changes the 'Git Credential Manager' -- installed with Git for Windows -- prompted me to authenticate my GitHub account, and I believe those credentials are now stored on my local machine so I won't have to do that again.

    My code lives a sub-folder folder named 'Code' which is a sub-folder of my user folder:

    C:\Users\BeepBeep\Code\fretty_scalarino

    But, to test the code it needs to be in the Inkscape extensions folder:

    C:\Program Files\Inkscape\share\inkscape\extensions

    I got tired of copying my files from the 'code' folder to the 'extensions' folder every time I wanted to test my extension. So, I downloaded and installed an extension to the Windows Shell named 'Link Shell Extension':

    https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html

    Using this, I made a 'Symbolic Link' between my code folder and a folder in the Inkscape extensions folder. This works surprisingly well, and even automatically reflects changes made when I checkout different Git branches. I have found that Inkscape sometimes needs to be restarted to see those changes.

    OK, now for a question.

    In my extensions .py file, there is a problem being reported that I would like to understand. My editor has flagged the line of code where I 'import Inkex'. It seems that it can't be found, or so the error claims, but then again my code works, which must which must mean that the import is working? I am confused, and would appreciate any help understanding this. I've attached a picture of the error.

    Screenshot 2023 11 24 122646
  2. #2
    beepbeepmorales beepbeepmorales @beepbeepmorales
    *

    I was able to answer my own question.

    After digging through the documentation for Visual Studio Code, I was able to edit the setting named "python.autoComplete.extraPaths" in the "settings.json" file.

    I added the Inkscape extension directory to that setting, and the 'settings.json' file now looks like this:

    {
        "security.workspace.trust.untrustedFiles": "open",
        "python.autoComplete.extraPaths": [
            "C:/Program Files/Inkscape/share/inkscape/extensions",
        ],
        "python.analysis.extraPaths": [
            "C:/Program Files/Inkscape/share/inkscape/extensions"
        ]
    }:

    That seems to have done the trick, as the error has disappeared.

     

     

     

     

     

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Development environment on Windows 11 - How I'm doing it, and a question