How to setup NetBeans IDE for Python Development - python

I was using PyDev plugin in eclipse for developing python. But now I switched to NetBeans IDE 12.6 and I searched google for finding python plugins for NetBeans. I found a plugin called nbpython.
But it is for NetBeans 8.1 and I am using NetBeans 12.6. So is there any plugin for NetBeans IDE 12.6 for developing Python Projects. Or does nbpython work in my version?

There is no official plugin for 12.x yet. If you read on the mailing list you can see that a re-implementation of the Python support was discussed but nothing has been implemented yet.

Update: I just installed Netbeans IDE v 13. I had since long time ago the Python/Jython/PERL modules for Netbeans 8.xx Which worked for a long time. For IDE v 13 I added them via the usual method, "Tools -> Plugins -> Downloaded -> Add Plugins", and it looks like they work fine! Therefore their compatibility with Apache Netbeans is very high. The problem is with the links of nbpython, they look broken & discontinued. If one has the old modules posted somewhere, then I guess you can pick those up and feel lucky. If not, you need to find them somehow, or wait for the python project to be re-implemented. The modules I have are described below. Hope this helps:
org-netbeans-modules-python-hints.nbm
org-netbeans-modules-python-kit.nbm
org-netbeans-modules-python-options.nbm
org-netbeans-modules-python-platform.nbm
org-netbeans-modules-python-project.nbm
org-netbeans-modules-python-project2.nbm
org-netbeans-modules-python-samples.nbm
org-netbeans-modules-python-source.nbm
org-netbeans-modules-python-testrunner.nbm org-jython.nbm
org-jython-distro.nbm org-netbeans-modules-python-console.nbm
org-netbeans-modules-python-core.nbm
org-netbeans-modules-python-debugger.nbm
org-netbeans-modules-python-editor.nbm
org-netbeans-modules-python-help.nbm

Related

Pycharm is generating language errors for Python version 3.6 although interpreter is 3.9

The language interpreter is set to a Python 3.9 version:
But a Python scratch file is being parsed by some kind of 3.6 interpreter:
Note that I created in two different scratch files and the same error occurs. Why would this happen and is there a workaround [short of creating an entirely new project from scratch]?
I am on Pycharm Professional 2021.3.1
Update based on answer by #TurePaisson he though maybe the Code is compatible with specific Python were set. That was a shrewd guess - but turns out I have not set that:
Update The following snippet can be used to test python3.6 vs 3.8+
x = (y := 3) + 7
In the preferences dialog, search for "versions" and you will find, under Editor/Inspections, an inspection "Code is compatible with specific Python versions" with checkboxes for which versions to check against.
I ended up creating a new python interpeter with version 3.9 and selecting it for the project interpreter. There's clearly some bug within Pycharm that it does not always cleanly switch among interpeters/versions - so starting from scratch is sometimes apparently needed.
I'll start by saying that I tried googling the exact error message and there aren't any significant hits (that's reason alone to post this leaving it as a roadsign):
"Python version 3.6 does not support assignment expressions"
I tried this with PyCharm versions 2021.2.2, 2021.2.4 and 2022.1 Pro (switching between Python 3.6 and Python 3.9) but I wasn't able to reproduce the exact problem that's shown in the question (I was unable to update to the exact 2021.3.1) and there might be some Project setting that's not obvious.
So I have 2 hunches:
It's possible there's something stuck with the inspection profiles since the OP seems to be working from a repository.
From experience my next guess would be to try and change the interpreter version of the "run configuration" because it's not stated explicitly in the documentation if it supersedes the project-wide interpreter chosen in Settings > Project > Python Interpreter for linter inspections. From my tests it currently doesn't but apparently it worked for the OP... Maybe by rebuilding the index and refreshing the background linter process.
Following up on #bad_coder 's attempt to fix that will be paraphrased as:
check the Run Configuration for pointing to a different python interpreter than the project level one
That fix worked for me:
Bring up the Run [Context menu] | Edit Configurations
Change the Python interpreter to the appropriate one: Shown below is a case where the interpreter is said to the earlier language level. Go to the dropdown and select a correct [python 3.8+] interpeter.

Using Python in NetBeans 8.1

I'm trying to add Python functionality to NetBeans 8.1. I downloaded Python from the Python website here. (I'm using Windows 10, by the way.) I also downloaded the NetBeans plugins "Python" and "Jython Distribution" (required by the former). Now I have two questions:
1.
When I create a new Python project, I have these options:
Based on the description for the "Setuptools" choice, I'm guessing that I shouldn't use that one since it's not for Windows. So am I correct in choosing "Python Project - Ant"?
2.
The Python platform that is selected by default is "Jython 2.7.0," as shown below.
I'm assuming that what I got from the Python website was a Python platform too, so I'd like to use that if possible. But in trying to add another platform, I don't know what file to choose in my Python folder. All of the ones I've tried result in the error:
I guess I could use the Jython platform, but I would think that the stuff I downloaded straight from Python would be the best. Do I need to add and make default the stuff I downloaded? Or should I ignore that and just use the Jython platform?
If yes to "should I add a platform", what file do I select?
Thanks in advance for any help.
EDIT:
I was able to create and run successfully a Python project using the "Python Project - Ant" option as mentioned in question 1, using the Jython platform. So question 1 is taken care of. I still would like to be able to use the Python platform I downloaded from their website, though, so question 2 still needs an answer.
For those who are trying to run other python distributions from netbeans, here is what i found:
From python wiki - https://wiki.python.org/moin/IntegratedDevelopmentEnvironments
Python/Jython support in NetBeans -- Open source, allows Python and Jython Editing, code-completion, debugger, refactoring, templates, syntax analysis, etc.;
UPDATE: Netbeans 7.0 released without Python support. Check
http://wiki.netbeans.org/Python70Roadmap for upcoming Python support.
So it looks like, python (Cbased) will no longer be suported in NetBeans, only Java-based Jython - also look on this question:
What is the difference between Python vs Jython vs IronPython vs wxPython?

netbeans 7.1 and python

I used to use my Netbeans 6.9 for Python development. As well as Java and PHP. I had a cool debugger in PHP with xDebug, good Python support. Have no complaints whatsoever. I moved to another computer downloaded the latest netbeans(7.1) and now I have no more python plugin. I tried the solution here but this caused NetBeans not to start at all after the loading splash screen is finished NetBeans crashes.
Is there any way I can still code in Python with netbeans?
Thank you in advance
Ok, I fixed this. Say you've screwed up your netbeans installation by installing the pythonplugin then this might just work for you, provided you're using a non-windows OS. This is because Windows uses precompiled binaries to start the Netbeans IDE.
The problem that I solved is that, by default, a set of classes is not added to the Java classpath, which results in a crash. You can find whether this is also your problem by inspecting .netbeans//var/log/messages. If it displays some ClassNotFoundExceptions then we might have the same problem. If not, then at least you've got some pointers on what's going wrong and perhaps you might come up with some solution yourself. ;)
The java classpath is constructed in the file:
/<path>/<to>/<your>/<netbeans>/<installation>/platform/lib/nbexec
On OSX, this could be:
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/platform/lib
In the main loop the function construct_classpath is called, which in turn calls the function build_classpath for two directories. I changed the function to this:
build_cp() {
base="$1"
append_jars_to_cp "${base}/lib/patches" "patches"
append_jars_to_cp "${base}/lib" "lib"
append_jars_to_cp "${base}/lib/locale" "locale"
# Added by me:
append_jars_to_cp "${base}/modules/ext" "ext"
}
After that modification, start your IDE and everything should work fine. Good luck!
The Solution for this problem could be found here
http://sahanlm.blogspot.com/2012/12/netbeans-7-2-crash-on-start.html
I am currently using the developer plugins on Netbeans 7.0.1 with no problem. Maybe they simply aren't compatible with the new version yet. I'd suggest just getting a 7.0 and using that.
Add org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar at
C:\Program Files\NetBeans 7.1.1\platform\lib\locale. Start NetBeans, remove the plugin or the reference with problem, later on, delete org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar
Please see the following link. It works for me:
http://wiki.netbeans.org/PythonInstall
Currently your NetBeans/Python choices are:
Try the latest development build updates against your current NetBeans version and mess with breakage at times as noted on the PythonInstall NetBeans wiki page or the link you gave.
Install the latest development version, but realize it's not a stable public release.
Wait for someone in the community to step up with continued development to keep the existing plugin in step with the latest public NetBeans release.
Install the NetBeans 6.9 (or older) version you were using with no complaints just for Python work.
I have had success with older versions and the development build. I am dabbling with other Python aware IDEs while I wait for main stream support, but I've stopped holding my breath.
If you can't change nbexec, like suggested by Bas Jacobs (e.g. on Windows), or don't want to do that, you can use the --cp:p startup parameter to append the necessary JARs to the classpath.
I only had to add the org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar file, so the complete command line under windows now looks like this:
"C:\Program Files\NetBeans 7.1\bin\netbeans.exe" --cp:a C:\\Users\\_YOUR_USERNAME_\\.netbeans\7.1\modules\ext\org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar

Eclipse Python Integration

I found this python plugin list but thought I'd ask if anyone has any experience with anything listed there?
I'm totally new to both python and dynamic programming languages if that makes any difference.
PyDev is the most widely used IDE I think. I'm using it not very often, but if I do, it suits me quite well.
PyDev is the best I've used. I use it every day. When they had a pay version I paid for it. I use it on my Mac and Linux box and love it.
I'm using PyDev. It's come a long way since I started using it. That might be it's greatest strength, it's very actively developed. It's got good support for Django and a whole list of other worthwhile features. If you're an Eclipse user you should definitely try it out.
If you're used to Eclipse, it's probably best to go with the DLTK. As a bonus, you get support for a number of other languages (Tcl, Ruby, Javascript) too.
Pydev supports python including vs 3.1, jython and ironpython. It is said that ironpython support in pydev is one of the best availables.
So pydev is probably the best plugin for eclipse. Some few months ago pydev and pydev extensions, the non-free part of pydev, were merged and released free. This is not related with abandonware, contrarily pydev is being actively developped.
Last release added support for Django (and there was also support for google application engine).

Has anyone tried NetBeans 6.5 Python IDE?

Has anyone tried the NetBeans 6.5 Python IDE?
What are your opinions? Is it better/worse than PyDev? Do you like it? How does it integrate with source control tools (especially Mercurial)?
I will share some of the feelings from using it for quite a while now. Things that are roughly the same quality as in Eclipse+Pydev+mercurial:
editor, code-completion
debugger features
Things that are better:
autoimport
color schemes (Norway today rocks)
Mercurial support (though it is getting better and better in Eclipse)
Things that are worse:
zipped egg packages are not recognized for either code completion or the autoimport
libdyn packages (e.g. datetime) are not recognized
debugger is having trouble with multiprocessing package
you cannot choose file from outside of the project (/usr/bin/paster) to be the main file (this is what I use to debug Pylons applications)
Does anyone have something to add to the list?
BraveSirFoobar, it would be nice to know more about what problems you found -- the very, very slow part, as well as the crash. The first time you run the IDE it will index information about your Python platform and project and libraries - such that it can do quick code completion, go to declaration etc. later - but once that's done it's not supposed to be slow - but there might be bugs.
Mercurial should definitely be supported well, since the NetBeans project itself (and Solaris and Java) are all hosted in Mercurial repositories.
We plan to have really deep support for Python, much in the style of our Ruby support. One of the things which really helped in our Ruby work was the feedback from our early adopters, so if you try Python and have issues with it, please let us know so we can fix it. (Feedback links here: http://wiki.netbeans.org/Python )
-- Tor
Compared to pydev, I found it very, very slow, and it crashed (once) when I created a project from existing sources. It's still beta, though.
Integration with SCMs will be as good as netbeans is already (I only tried subversion, which worked fine).
Feature-wise it was about the same : refactor, debugging, code assist... I'll stick with pydev for the moment, which is IMHO a great tool.
Sun use Mercurial internally now, so expect that their IDE support for it will be top notch.
Having worked with PyDev and PyDev extension for Eclipse for the past few months, the move to NetBeans has been a very pleasurable one.
Without having to hunt all the different plug-ins for PyDev and Eclipse, NetBeans had everything I needed out of the box:
auto completion, super fast index search, style control import control, you name it.
And it seemed LESS bug prone than Eclipse (which is pretty stable).
Also, the built-in Vim like auto code snippets it uses are just fantastic.
IMO, it beats Eclipse hands down.
I'm hooked.
I started using it a little while back and I like it. I usually develop in a simple editor (SciTE), NetBeans is nice to organize larger projects.
wrote about it briefly here
How does it compare with PyDev Extensions? I've recently installed it and, to be honest, couldn't imagine myself going back to PyDev.
NetBeans seems interesting though, if only I wasn't already hooked onto a couple of other Eclipse plug-ins as well.
After looking at this, I decided to go ahead with PyDev than NetBeans.
However best wishes to NetBeans team for a faster and better Python support. Cant wait for that :)

Categories