Is it possible to use an alternative IDE instead of Spyder?

Is it possible to use an alternative IDE instead of Spyder?

markusbarnes
Advocate Advocate
4,606 Views
16 Replies
Message 1 of 17

Is it possible to use an alternative IDE instead of Spyder?

markusbarnes
Advocate
Advocate

I was wondering if it is possible to use Visual Studio or PyCharm as an IDE for working with Python code in Fusion360. Spyder lacks  features that I am acustomed to. Normally, I can just setup PTVS and set the environment to point to the python installation and I'm good to go. I could do this, but the cryptic directories stored in the User Profiles doesn't look reliable across software updates. Also, there appears to be two different copies of python installed: one under webdeploy/production/blahblah/ and another under webdeploy/shared/python/blahblah

 

Any suggestions?

4,607 Views
16 Replies
Replies (16)
Message 2 of 17

marshaltu
Autodesk
Autodesk

Hello,

 

Unfortunately we don't provide an way to let users customize Python IDE. You have to go with our default IDE "Spyder" if you want to debug Python codes which written by Fusion API. We did some customization for Spyder to let it work with Fusion 360 to debug. 

 

You saw two copies of Python wasn't true. Our owned Python in Fusion 360 will be installed under "webdeploy/shared" folder, but we will create file links for them under Fusoin 360 install folder("webdeploy/production/.../").

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes
Message 3 of 17

markusbarnes
Advocate
Advocate

Thanks. I still don't understand why there are so many directories with cryptic folder names. When you say links, are they file links in windows?

0 Likes
Message 4 of 17

marshaltu
Autodesk
Autodesk

Yes, they are file links in Windows. 

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes
Message 5 of 17

markusbarnes
Advocate
Advocate

I understand that I may not be able to debug or run my python code from VS 2013 using PyTools, but can I at least edit the files and get some intellisense out of it? Is there some recommended setup. The Spyder IDE is a real pain to use.

0 Likes
Message 6 of 17

KrisKaplan
Autodesk
Autodesk

You are always free to edit scripts with any editor of your choosing by opening the scripts directly in your IDE.  You can always have any IDE specific files (such as project or solution files, etc...) in the script directory to make this easier (Fusion will ignore anything not directly referenced by the script and the manifest).

 

But this may not be as convenient as launching your editor of choice through the Edit button in the script manager dialog.  There is a way to get this behavior as well.  In your .manifest file, you can add a 'source' value that is a filename.  If the 'source' setting exists and points to a file that exists, we will open the file with the current OS file association rules.  So you could set 'source' to point to your main script file, or an IDE specific project or solution file (.py, .sln, .pyproj, etc...), and when you hit the Edit command, that file will be launched in the associated application (the IDE).  The 'source' value can be a relative path from the script's folder (the folder containing the manifest) or an absolute path.  You can optionally use a 'sourcewindows' or 'sourcemac' setting to provide platform specific source file associations.  As mentioned previously, the IDEs launched could not properly run or debug the script in Fusion the way the customized Spyder IDE is able to.

 

The second issue you mentioned is with code hints.  This is generally going to be IDE specific, and many seem to do it differently.  The integration into Spyder was done with a tern definition file that we include into Spyders code hints system.

 

I do not have a lot of experience with PTVS, but in my older version (2.1) it's introspection seems to have a problem with the binary pyd interop module and the SWIG wrappers.  Possible current versions do better.  They appear to do a combination of reading docstrings (not available in pyd files) and some runtime loading to read attributions and docstrings, but this would not be possible with the embedded Fusion dependencies to load our pyd files (which is probably why it fails).  But I was able to get it to give intellisense if I added an environment (Add Environment through the Python Environments tab) by specifying a Path Environment Variable that points to my ?/Api/Python/packages folder in the Fusion executable location.  Of course, this path will change with every new update to Fusion, so you either need to keep this path up to date, or you can copy this folder to a more stable location, or script something more automated to keep link or a copy continuiously up to date.

 

My version of PTVS will get code hints, but can't determine the return types of static menthods (such as 'adsk.core.Application.get()') and considers the return type of all properties as simply 'property'.  You can sort of get around this problem by forcing PTVS to recognize the types with an assert statement.  For example:

 

    app = adsk.core.Application.get()

    assert isinstance(app, adsk.core.Application)

    app. ...

 

But this would be annoying in general since it would need to be asserted for every property return type to get hints.  If the introspection of a current PTVS doesn't do better, we would need to spend more time researching if there was something we could do in our .py wrapper to help with this introspection.  With a quick look I didn't see any easy way to inject customizations into their Completion DB.

 

Kris



Kris Kaplan
Message 7 of 17

markusbarnes
Advocate
Advocate

Has there been any changes? I would love to use a decent editor IDE.

0 Likes
Message 8 of 17

ekinsb
Alumni
Alumni

Nothing has changed here.  The "official" Python IDE for Fusion is still Spyder.  As far as getting code hints in other IDE's there hasn't been any additional investigation into that and we're currently not planning anything in this area either.  Although if you're aware of a particular IDE and the specifics of what needs to be done to support code hints in it we're open to considering doing some work to support it.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 9 of 17

saccade
Contributor
Contributor

I noticed the version of Spyder Fusion360 installs is pretty old (2.3.2, "(c) 2012").  The latest version seems to be 3.1.4, from a month ago.

 

Is it possible to get Fusion360 to use the newer version?  The current one is pretty buggy...

 

(I'm running Win 8.1/64.  Does it install a newer version on Win10/64?)

 

 

 

0 Likes
Message 10 of 17

marshaltu
Autodesk
Autodesk

Hello,

 

We used customized Spyder 2.3.2 in all OS versions. As you suggested, it is timing to upgrade to the latest one. Unfortunately we cannot simply replace the old one by new Spyder instead we need do some manual work to customize the new one so that it can work well with Fusion 360.

 

I will put the request to task backlog. So far I cannot tell when the request can be done as we need prioritize it along with other tasks together.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
Message 11 of 17

designingberlin
Advocate
Advocate

I'd be happy to use eclipse as an IDE. refactoring variables quiet impoartant to tunr sketchy code into shareable code ..

0 Likes
Message 12 of 17

saccade
Contributor
Contributor

Thanks for the update. I know how that goes, dev tools always take a back seat to user features.

 

But just think of all the cool new add-ins and scripts you'll get for Fusion 360 when the tools are up to date and stable.

 

 

0 Likes
Message 13 of 17

edwinBN4C3
Participant
Participant

I want to add my two-bits chiming in that Spyder is slow and awkward on my Mac (with many long pauses and apparent hangs) and I would be infinitely happier doing debugging in PyCharm

Message 14 of 17

edwinBN4C3
Participant
Participant

That was my first impression at least.  I expect it'll get better as I get used to it, but it can't rival the cleanliness of PyCharm.

 

Also I note that using Spyder, it's friendlier if you treat it more like a command-line debugger than an IDE debugger....

0 Likes
Message 15 of 17

edwinBN4C3
Participant
Participant

Annnnnnd now Spyder won't launch.  So not impressed.

 

I tried a bunch of things, including --reset, but now I nuked my Fusion 360 and am re-installing.  Fingers crossed.

 

2018-03-16 09:39:18.420 python[2965:72469] modalSession has been exited prematurely - check for a reentrant call to endModalSession:

Traceback (most recent call last):

  File "spyderlib/spyder.py", line 2394, in main

    mainwindow = run_spyder(app, options, args)

  File "spyderlib/spyder.py", line 2272, in run_spyder

    main.setup()

  File "spyderlib/spyder.py", line 704, in setup

    name, 'qtdesigner.png')

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/qthelpers.py", line 341, in create_program_action

    path = programs.find_program(name)

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/programs.py", line 55, in find_program

    path = is_program_installed(name)

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/programs.py", line 38, in is_program_installed

    for path in (os.environ["_PYTHON"].split(os.pathsep) + os.environ["_Spyder"].split(os.pathsep)):

  File "/Users/edwin.wise/miniconda3/lib/python3.6/os.py", line 669, in __getitem__

    raise KeyError(key) from None

KeyError: '_PYTHON'

Traceback (most recent call last):

  File "spyderlib/spyder.py", line 2394, in main

    mainwindow = run_spyder(app, options, args)

  File "spyderlib/spyder.py", line 2272, in run_spyder

    main.setup()

  File "spyderlib/spyder.py", line 704, in setup

    name, 'qtdesigner.png')

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/qthelpers.py", line 341, in create_program_action

    path = programs.find_program(name)

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/programs.py", line 55, in find_program

    path = is_program_installed(name)

  File "/Applications/Fusion360.app/Contents/Libraries/Neutron/Spyder/spyderlib/utils/programs.py", line 38, in is_program_installed

    for path in (os.environ["_PYTHON"].split(os.pathsep) + os.environ["_Spyder"].split(os.pathsep)):

  File "/Users/edwin.wise/miniconda3/lib/python3.6/os.py", line 669, in __getitem__

    raise KeyError(key) from None

KeyError: '_PYTHON'

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "spyderlib/spyder.py", line 2429, in <module>

    main()

  File "spyderlib/spyder.py", line 2399, in main

    traceback.print_exc(file=open('spyder_crash.log', 'w'))

PermissionError: [Errno 13] Permission denied: 'spyder_crash.log'

0 Likes
Message 16 of 17

Anonymous
Not applicable

Personally,


I prefer PyCharm IDE. Other IDE's that are quite enjoyable to use: Eclipse, Visual Studio, and Netbeans, which are all compatible with Python. And as others have mentioned, I would also prefer to use the newer version of python. Spyder is non-intuitive to me, especially for setting up virtual environments that would allow for easier importing of modules (i.e. pandas). 

 

Any updates by chance?

Thanks,
Nick

Message 17 of 17

JesusFreke
Advocate
Advocate

I've managed to get debugging working in PyCharm (well, IDEA with the python plugin). See my post here. You still can't run or initiate debugging from IDEA, but I'm looking into that as well.

0 Likes