I have searched for a basic tutorial regarding workspaces and projects in the Spyder IDE. What I want to understand is the basic concepts of how to use the workspace and projects to organize my code. It seems that this is perhaps basic programming skills and that is the reason why I have issues finding any kind of overview. This page seems to be related, but is actually about Eclipse and rather sparse. The Pythonxy tutorial and the documentation for Spyder does not go into any detail. Neither does the Anaconda documentation.
The questions I have are:
When should I set up a new workspace (if ever)?
When do I create a new project?
How does the PYTHONPATH depend on my workspace and project settings? Is it the same in all cases or can I customize it per workspace/project?
Are there other settings apart from the PYTHONPATH that I should configure?
How specific are the answers above to Spyder? Would it be the same for other IDEs, like Eclipse?
I am running Spyder on 64-bit Windows 7, as part of the Anaconda package.
Update Oct 2016: Spyder 3 now has project facilities similar to that of other IDEs (especially Rstudio).
Now you if you have a folder with scripts, you can go to
Projects > New Projects > Existing Directory
to import it. The selected directory will be set as the base directory for the project.
I use spyder for data analysis and I have just started using the project workspace. I believe that it allows you to write better code due to the organization. As a previous post stated that "This can be helpful in web development", which is true because web development requires good software engineering due to the complexity of the files and how they interact with each other. This organization/structure can be used in data analysis as well.
Often, data analysts that use Anaconda have an engineering or science background, not necessarily software engineering or computer science. This means that good software engineering principles may be missing (myself included). Setting up a workspace does one critical thing that I believe is missing from the discussion. It adds the workspace to the system path. Set up a project and then try
import sys
print sys.path
You will see your project's directory added to the PYTHONPATH . This means I can break up my project and import functions from different files within my project. This is highly beneficial when analysis becomes complex or you want to create some type of larger model that will be used on a regular basis. I can create all of my functions in one file, maybe functions for plots in another and then import them in a separate script file.
in myScript.py
from myFunctions import func1
from myFunctions import func2
from myPlots import histPlot
This is a much cleaner approach to data analysis and allows you to focus on one specific task at a time.
In python 3 there is the %autoreload capability so you can work on your functions and then go back to your script file and it will reload them each time if you find errors. I haven't tried this yet bc the majority of my work is in 2.7, but this would seem to add even greater flexibility when developing.
So when should you do this? I think it is always a good idea, I just started using this setup and I will never go back!
In my experience, setting up a workspace in Spyder is not always necessary.
A workspace is a space on your computer where you create and save all the files you work in. Workspaces usually help in managing your project files.
Once you create a workspace in Spyder, a pane called "Project Explorer" opens up inside Spyder. There you see in real-time the files of your project. For instance, if you generate a file with Python, it will show in that pane.
The pane let's you keep the files organized, filter them etc. This can be useful for web development for example because helps you keep your content organized.
I use Python to handle files (e.g. csv) and work with data (data analysis), and I find no use in the workspace feature.
Moreover, if you delete a file in the Project Explorer pane, the file cannot be found in the Windows recycle bin.
One critical piece of information that appears to be missing from the Spyder documentation is how to create a new workspace in the first place. When no workspace exists after installing Spyder, creating your first project automatically initiates the creation of a workspace (at least in the Anaconda 3 distribution). However, it is not as obvious how to create a new workspace when a workspace already exists.
This is the only method I have found for creating a new workspace:
(1) Select the Project explorer window in Spyder. If this window or tab doesn't appear anywhere in the Spyder application, use View > Panes > Project explorer to enable the window.
(2) Click on the folder icon in the upper-right corner of the Project explorer window. This icon brings up a dialog that can create a new workspace. The dialog allows selection of a directory for the .spyderworkspace file.
I am turning to Python from .NET world. And Visual Studio was something a great tool i used.
In python world we do have basic IDLE and another one is VIM. I have seen that a lot of developers have configured VIM to a great IDE. Using basic VIM in Windows 7 seems of less use.
So i want to moderate my VIM to a level which has file explorer, syntax highlighting, search, error highlighting etc. So that it gives feel of Visual Studio and more productive.
But all hacks/tips available are for Linux/Ubuntu users mostly, which i may use later but as of now i need to make my VIM in Windows more productive, visual.
Please Suggest some Tips/Hacks/Resources to look around for VIM configuration?
Thanks
This question addresses your low level issue: coding Python with an IDE that is not VS.
There are a few popular blog posts addressing your high level issue: setting up Vim for Python development. They are a quick google away…
I feel the need to point out that Vim is not an IDE. You can customize it a lot and end up with something that looks like an IDE but you won't get an IDE. Only an over-customized text editor.
Anyway, here are a few tips for starting out with Vim:
Do $ vimtutor as many times as needed to feel comfortable with the basics.
Get familiar with Vim's buit-in documentation: the answers to most of your questions are somewhere inside. :help gets you to the front page, :help 'option' shows the documentation for option, :help :command shows the documentation for command… Hit <C-]> on a colored word to jump to its definition.
Don't use Janus or SPF13 or whatever pre-packaged set of plugins. You'll only grow bad habits. Similarly, don't copy other people's vimrc wholesale.
Ctags is an external code indexer that is used by Vim to "jump to definition" with <C-]>. cscope is another option, it's more powerful but also a little more complex. See :help tags.
Related to ctags, TagList and TagBar are two popular plugins used to display more or less the equivalent of the Object Browser in VS.
NERDTree is another popular plugin that mimicks the file tree found in many IDEs/editors. But Vim comes with netrw (:Ex) by default, try it before installing NERDTree.
Read :help motion.txt as soon as possible.
Watch Drew Neil's laser-guided vimcasts.
Don't rush it.
you can use vim plugins on windows, http://www.vim.org/scripts/index.php, typing "vim {your feature here}" into google will come up with lots of results.
popular file explorer is nerdtree,
syntax highlighting can be turned on with
syntax on in your vimrc
searching open file is easy to do using reg exes . Initialize search with /.
Searching directory is easy to do using grep.
I don't develop on windows but i have read that Cygwin might be worth installing for some linux tools if not already installed.
I am in no way an evangelist of any Editor/IDE.
But, if you are a newbie to Python I would suggest trying out Sublime Text 2 http://www.sublimetext.com/ . It is a very light weight yet powerful editor with a great following and it has a free evaluation version with no deadline.
But, if you intend to work using frameworks such as Django/ GAE then I would suggest using PyCharm from JetBrains
http://www.jetbrains.com/pycharm/
Finally, these tools are all just personal choices until you get comfortable with one or two of them.
Thanks,
-Hari
One possible compromise is to use your favorite IDE with a vim emulator plugin. For example, in Eclipse you can use Vrapper, PyCharm has IdeaVim and so forth. Lighttable also has vim key-bindings. The plug-ins (or key-binding options) give you some of the benefits of editing in Vim while still having the powerful debugging / navigation features, etc. of a full-blown IDE. BTW, Vrapper works with PyDev.
Using an emulator in an IDE allows you to gain the "muscle-memory" necessary for effective vim editing, without getting bogged down in "configuration hell" associated with turning an editor into an IDE (which auto-complete plugin do I use?..etc.?). Once you have mastered the vim keystrokes for normal and visual mode, used along with insert mode, you may decide to continue on into pure Vim and face those issues.
I wouldn't recommend to learn VIM in 2012 (despite it being a great editor). If you must, this blog post will get you started.
But VIM isn't an IDE, it's a text editor.
If you really want a powerful IDE, try IntelliJ IDEA or Eclipse. Both have great plugins to turn them into Python IDEs (along with code completion and all the other nice time savers). For Eclipse, try PyDev. For IntelliJ, search for Python in the plugin preferences pages.
I find PyDev's search function incredibly useful and use it regularly to navigate around my projects. I've got my interpreters set up correctly so PyDev knows about the external libraries that my code uses, and even lets me follow references into the library modules. This is great, obviously, but I also want to be able to search the external libraries like I can search my own code.
There's a similar question pertaining to Java development here: How do I search Libraries in eclipse?
Is there anything out there for PyDev?
I use two different approaches to allow searching in my library code:
When I am using virtualenv, I keep all my code under myproject/src and add it and myproject/lib/python2.7/site-packages/ as pydev source folders. (Be sure to setup your python interpreter to myproject/bin/python as well)
In other cases, I use two different pydev projects. The first (myproject) includes my code. The second one is called myproject-lib and includes the libraries as it's source paths (.../site_packages). The first project references the second projects (and usually I keep both of them in one workspace). This works great with virtualenv, but I believe that you can actually create a pydev project in your system-wide python. Make sure you use the same python interpreter in both projects.
Now you can quickly and easily use Open Resource (CTRL+T) and the Globals Browser (CTRL+Shift+T) to lookup your libs.
I'm afraid PyDev doesn't support this yet. I created feature request for this at https://jira.appcelerator.org/browse/APSTUD-7405 Meanwhile you could link folders of external libraries to your project.
After using C# for long time I finally decided to switch to Python.
The question I am facing for the moment has to do about auto-complete.
I guess I am spoiled by C# and especially from resharper and I was expecting something similar to exist for Python.
My editor of choice is emacs and after doing some research I found autocomplete.pl, yasnippet and rope although it is not clear to me if and how they can be installed in a cygwin based system which is what I use since all the related documentation appears to be linux specific...
The version of emacs I currently use is 23.2.1 which bundles the python mode that although useful is far behind from whatever research has to offer.
My question to python users has to do about how common is autocomplete vs manual typing (using M-/ where possible) ?
I am thinking about just memorizing python build-in functions like len, append, extend etc. and revert close to a pre-autocomplete editing mode. How different such an approach is from what other pythonistas are doing?
I found this post
My Emacs Python environment
to be the most useful and comprehensive list of instructions and references on how to setup a decent Python development environment in Emacs regardless of OS platform. It is still a bit of work to setup but at least it covers the popular packages and components generally recommended for Python in Emacs that provide auto-completion functionality.
I loosely used this post as a guide to do the setup on my Windows machine with Emacs 23.2.1 and Python 2.6.5. Although, I also have Cygwin installed in some cases instead of running the *nix shell commands mentioned in the post, I just download the packages via a web browser, unzip them with 7zip, and copy them to my Emacs' plugin directory.
Also, to install Pymacs, Rope, and Ropemacs, I used Python's EasyInstall package manager. To use it, I downloaded and installed the setuptools package using the Windows install version. Once installed, at the command line, cd to their respective download locations and run the command
easy_install .
instead of the shell commands shown in the post.
Generally, I saved any *.el files in my ~\.emacs.d\plugins (e.g. in %USERPROFILE%\Application Data\.emacs.d\) and then updated my .emacs file to reference them as documented in the post.
Despite all this, on occasion, I've used DreamPie since it does have overall better auto-completion out of the box than my Emacs setup.
I'm spoiled by Intellisense too. The PyDev extensions for Eclipse offer a pretty good auto-complete substitute.
I find that PyDev + Eclipse can meet most of my needs. There is also PyCharm from the Intellij team. PyCharm has the added advantage of smooth integration with git.
I've been using PyScripter, an IDE for Windows, for a while now, and have found it very good. It has autocompletion among many other features. It's written in Delphi -- not that there's anything wrong with that -- it just bothers me a bit, though...
Take a look at Spyderlib, support most of the features including code completion
IMO, by far the easiest way to take advantage of the python tools available for emacs is to take advantage of the defaults that are all set up at:
https://github.com/gabrielelanaro/emacs-for-python
I actually took the time to get pymacs and ropemacs and python-mode all working independently before finding that little gem, and now I rely on it entirely for all my python based customizations. If you are new, I would definitely start there.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have done a little Django development, but it has all been in a text editor. I was curious what more advanced development tools others are using in their Django development.
I am used to using Visual Studio for development and really like the IntelliSense, code completion, and file organization it provides and would like to find something (or a combination of tools) that would provide some of this in the Django/Python environment.
There is PyCharm from JetBrains which supports Django and Google Apps. It looks promising.
Note: You need to buy a license for the Professional version if you want Django support. The Community version desn't support Django.
I use Eclipse and a plain vanilla PyDev. There isn't any specific Django functionality. The best I came up with was setting up a run profile to run the development web server.
If you add the web tools project (WTP), you'll get syntax highlighting in your templates, but nothing that relates to the specific template language. PyDev is a decent plugin, and if you are already familiar with Eclipse and use it for other projects it is a good way to go.
I recall NetBeans starting to get Python support, but I have no idea where that is right now. Lots of people rave about NetBeans 6, but in the Java world Eclipse still reigns as the king of the OSS IDEs.
Update: LiClipse is also fantastic for Django.
Install it, use this method to get the icon into Ubuntu's menu. Start LiClipse and in File > New > Project ..., select PyDev and PyDev Django project. You may have to set up your Python interpreter etc, but that you'll be able to figure out on your own. Once the Django project is created, you can right click on the project and the menu will have a "Django" option, which allows various things like creating a Django app or running migrations etc. LiClipse is good because it consumes far lesser memory than PyCharm and supports refactoring and autocomplete reasonably well.
I use Vim:
http://github.com/skyl/vim-config-python-ide
[UPDATE]
Sublime Text 2 is pretty awesome. It supports a lot of Vim commands if you want them: Vintage Mode
It has a nice package manager: http://wbond.net/sublime_packages/package_control
I use these packages so far:
Djaneiro
SetDjangoSyntax
CoffeeScript
SublimeLinter
Theme - Soda
SideBarEnhancements
I still love Vim but ... did I mention that Sublime Text plugins are written in Python?
I use Komodo Edit. Check out the Open Komodo Edit.
Sublime
I am beginning to enjoy working with Aptana Studios + PyDev (and other) plugins for all sorts of web application development. As you can tell, it is built on top of the powerful Eclipse, but is tailor-designed to focus on web application development.
I use Kate (KDE Advanced Text Editor) for most of my development, including Django. It has both a Python and Django Templates syntax higlighting. I switch to Quanta+ when a significant part of the project involves HTML.
Since it uses Kate's KPart, it's just as good for editing the Python parts, and for the HTML templates i have the whole Quanta+ tools, while still highligting Django-specific tags.
Update 2013: Unfortunately, Quanta+ has been dead for years now, and there's no hope that it will ever be resurrected. Also, there's no other usable HTML editor out there, so it's Kate all the time now.
NetBeans for Python is my current favorite (lighter and so much easier to install than Eclipse I found). Supports simple refactoring, autocompletion, errors/warnings...
Eclipse Aptana PyDev probably one of the most complete free IDE nowadays (haven't tested a lot)
Wingware Python IDE a commercial IDE, which has some Django-specific project setup features the ability to debug Django template files.
IntelliJ IDEA Ultimate Edition another commercial IDE which has also a plugin for Python that is under heavy development. I saw some demo which look very promising on the auto-completion (for templates and Python).
Vim which I still use a small touch-fix application. See also: Extra tweaks for Django.
PyCharm. It is best the IDE for Python,Django, and web development I've tried so far. It is totally worth the money.
You guys should checkout PyCharm! It is the first decent Django IDE.
Eclipse has the PyDev plugin for python development. Unfortunately, I'm not sure how well it integrates with Django.
As far as I know there is not "an IDE" for Django, but there are some IDEs that support Django right out of the box, specifically the Django syntax for templates.
The name is Komodo, and it has a lot of features, but it's not cheap. If you are not worried about source control or debugging then there is a free version called Komodo Edit.
There is an actual Python extension for Visual Studio: http://pytools.codeplex.com/. It's absolutely fantastic. It feels the same as if I were coding in any native Visual Studio language. The extension is even compatabile with Django. And best of all: it's totally free. Even for Visual Studio, it only requires the Visual Studio Shell to work, which is completely free.
Now you can also use Visual Studio 2010. Here's how:
Download and install Python Tools for Visual Studio.
Create a new project from existing code (menu File → New → Project From Existing Code...)
Specify your Django project folder and use the defaults.
Right-click on manage.py and choose Set as Startup File.
In your project properties Debug tab, add "runserver" in Script Arguments.
You can set break points, and attach to the Python process for debugging. If you want to debug without having to "attach to process," use "runserver --noreload" in your script arguments. However, the "--noreload" means you'll have to stop and restart the Django development web server manually (to recognize your code changes).
This is a nice setup if you already use Visual Studio.
Python Tools has been updated. It has built in support for Django now.
PyCharm, definitely. I tried them all (almost), but PyCharm is the one I found most useful for any heavy development.
For simple, one time, scripts I use whatever comes to mind (TextMate, Vim, Emacs, TextWrangler, etc., you name it).
I have used Eclipse with PyDev and PyCharm. PyCharm is definitely the best IDE for Django/Python I have tried. It does proper template highlighting and auto-completion for all objects. It also does cross-file referencing.
It's quite expensive, but definitely the best Django IDE I have tried. You can try a 30 day evaluation at http://www.jetbrains.com/pycharm/download/.
I've also had good results with Eclipse and Pydev. Although I still require a shell opened to the project directory to run manage.py commands. I've also been using it with the Bazaar plugin for revision control and syncing code with the server.
I really like E Text Editor as it's pretty much a "port" of TextMate to Windows. Obviously Django being based on Python, the support for auto-completion is limited (there's nothing like intellisense that would require a dedicated IDE with knowledge of the intricacies of each library), but the use of snippets and "word-completion" helps a lot. Also, it has support for both Django Python files and the template files, and CSS, HTML, etc.
I've been using E Text Editor for a long time now, and I can tell you that it beats both PyDev and Komodo Edit hands down when it comes to working with Django. For other kinds of projects, PyDev and Komodo might be more adequate though.
I use Kate as well. Kate's simplicity is its biggest feature. It doesn't get in your way. (This is of course highly subjective opinion.)
Kate includes a Python code browser plugin. But it isn't useful IMO. No automatic updates when you change the code/view. Also when you update, the whole tree is collapsed, and you have to expand it again yourself. Too many clicks.
Instead, I use the Source Browser plugin that comes with Pâté. It does cause Kate to freeze temporarily sometimes, but no crashes or anything of that sort so far.
Shameless blog plug: more on using Django with Kate (Pâté)
Well, I've been using my own one. Recently they released an alpha version. Here it is at pfaide.com/.
If you like Vim as an editor, here are some suggestions on how to tune it (up to the point of a full fledged IDE) for Django development: http://code.djangoproject.com/wiki/UsingVimWithDjango.
Editra supports Django Template Language syntax highlighting. You can configure it either as a better Notepad or a basic IDE.
I made a blog post about NetBeans' new and upcoming support for Django. When paired with its already fantastic Python, JavaScript, HTML and CSS support, it's a strong candidate in my mind!
TextMate with the Django and django-html bundles installed gives you syntax highlighting and great extensibility. It is lightweight and fun to use.
Here is a link to a code completion project for TextMate with Python (which I haven't used myself). As for "intellisense" (which I understand to be inline-doc reference), TextMate has that too.
The Wingware editor from http://www.wingware.com is Python-specific with very good auto-completion for Python/Django/Zope, etc.
It has a built in Python shell to run snippets (or select and run) and support for Mercurial/Git, etc. and a built-in unittest/nose/doctest test runner. It's commercial though, but as it is written in Python, it's cross platform.
I bought it a while ago, and thought it looked dorky, but I've tried them all and keep coming back. Caveat that I am a Windows guy with no Emacs or Vim skills, so leveraging that was not an option. And the Mac version requires X Window and seems to be more glitchy.
Geany
It is GTK2 based, fast, lightweight, available for Linux and Windows.
Ninja-IDE.
Check this: Ninja-IDE Django Plugin
Ulipad is a good one.
http://code.google.com/p/ulipad/
I have consistently used Vim or Kate, but I would prefer a full-blown IDE. Given it is not as heavy as Visual Studio.
I like Eclipse + PyDev and/or eric, myself. The new version of PyDev has some pretty awesome code completion support.
Since I only use Eclipse for PyDev, I use a slim install of just the Platform Runtime Binary + PyDev + Subclipse.