Alternative ways to browse the python api [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is it just me, or the python standard library documentation is extremely difficult to browse through?
http://docs.python.org/3.1/library/index.html
http://docs.python.org/3.1/modindex.html
Java has its brilliant Javadocs, Ruby has its helpful Ruby-Docs, only in python I cannot find a good way to navigate through the standard library documentation.
There's the Epydoc project, which looks nice, but does anyone know if it is actually being used on the standard library, so we can all go through it? If not, what are the alternatives people are using to browse python documentation.

I usually use the built-in pydoc, if you are on windows it should be called Module Docs if you are on linux use pydoc -p 8000 and connect through browser.

pydoc from the command line, help() from the interactive interpreter prompt.

pydoc -p 8080
The python community is semi-hostile to automatically generated documentation, especially if it's Object-Orientated. Python isn't just object-orientated (it's a multi-paradigm language), so Python developers generally prefer human-written documentation. Sometimes the functions are important, sometimes the Class structure is important.

you can go to here and download the chm version of Python 3.1. With that, searching through the docs should be easy.

I used to use the python sidebar from Edgewall a long time ago.
These days, I google for the python function (the standard docs almost always show up as the first link).If I want to browse the source of the module (useful sometimes), I use this little shell function I wrote.
epy () {
cmd="import $1 as a ; print a.__file__.endswith('.pyc') and a.__file__[:-1] or a.__file__"
file=$(/usr/bin/env python -c $cmd)
echo $file
emacsclient --no-wait $file
}

I guess I'm going to get downvoted but I find nothing wrong with the Sphinx docs and I find them way way better than the java alternative.

Related

Best practice for Testing with Python in VSC [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I would like to ask for your recommendation about coding in Python, mainly with VSC. I have read several Python standards but I have several doubts about testing. I have found some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension.
I have little experience with testing and I have only used unittest, but reading here I believe Pytest is far more complete, should I change to it?
A "basic" test extension is installed with Python Official Extension from VSC, but I don't know if there are better extensions for this. I suppose it is compatible with unittest, pytest and nose. What I don't is how to do test in several Python version with VSC, I believe is a good practice, but I don't know if I must have installed all the other Python versions to do this.
I have find some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension
Yes this is correct. Most packages needed for basic python programming are included in the official extension. Ofcourse there are some great packages out there that aren't included but still can be quite usefull.
I have little experience with test and I have only use the unittest, but reading here I believe Pytest is far more complete, should I change to it?
Pytest is very easy to use and definatly a recommender, I use it myself and never thaught of changing.
What I don't is how to do test in several Python version with VSC
I recommend tox, their readme even has an example of exactly what you want to do, testing (with pytest) on multiple python versions.
Hope this clears things up.

Scripting Languages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am looking for a good scripting language to link to my program.
I am looking for 2 important attributes:
Scripting language should be hard linked into the executable (not requiring 3rd party
installations). This is important to me to simplify distribution.
Scripting should allow some run-time debugging option (When running a script inside my program I would like to easily run it inside a debugger while it is running in the context of my program)
Can python,lua or some other language supply me with this?
Both Lua and Python can provide the features you mention, so choosing one of them will depend on other criteria.
Lua is a lighter weight solution, it will have a much smaller disk footprint and likely a smaller memory overhead than Python too. For some uses it may be faster. Python has a much richer standard library, more mature third party libraries and a more expressive language.
Both have been embedded into major applications. Python can be found in Blender, OpenOffice and Civilization 4. Lua can be found in World of Warcraft and Adobe Lightroom. I'd recommend looking at a few tutorials for each and the facilities available to embed them in your application and just choose the one that fits your brain best.
Lua is designed for this:
static linking? check!
debugging? check!
Typically, Lua is the better choice for embedding into another project. Python is better as a standalone platform because the library support is so much broader. See Lua Versus Python for more details.
Personally, I use both very frequently depending on the job at hand. I always use Lua for embedding into C/C++ applications or scripting functionality that is imported from C/C++ shared libraries (i.e. a DLL). Python is always my first choice for standalone tasks that do not require low-level C/C++ code.
I'd put my two cents in for python. I don't know a lot of the details, but the computer graphics suite blender does a wonderful job of implementing python scripting.
As far as I can tell in blender 2.5 the interpreter is run from inside the executable,
import sys
sys.executable
shows /blender/blender.exe
and there is good debugging support, it even has a full interactive interpreter inside.
For more info check out: http://www.blender.org/
I really like Lua for embedding, but just as another alternative, JavaScript is easily embeddable in C, C++ (SpiderMonkey and V8) and Java (Rhino) programs.
In addition to Tcl, Lua, and Javascript (all already mentioned), Guile is another language designed explicitly for this.
I'll add Tcl to the mix. It's designed to be easily embedded into other programs.

Looking for a Python IDE with good support for libraries (Twisted) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm looking for a Python IDE that can help me easily locate and manage and use the libraries on my system (Ubuntu). Specifically Twisted.
Code completion is important including the symbols I import.
(I've so far had a look at PyDev as well as OpenKomodo, but while both offer code completion for default Python concepts, I wasn't able to get either to import Twisted into my project and was thus getting reference errors.)
Usual disclaimer: I don't like EMACS or vi, please, nothing regarding those.
Using Wing IDE with Twisted discusses how to debug twisted using their IDE - although unfortunately WingWare is not free.
Are you sure you have given PyDev a fair look? It seems to be the most popular Python IDE, and I have always had good experiences with it in the past.
I've just downloaded the preview of netbeans and it seems to have done quite well so far.
It has detected inherited methods & properties. I haven't had to add a single library reference in my project, so this seems to be the most fluid so far.
eclipse + pydev seems to work well for me.
Just remember to right-click on the project and select Properties and make sure that your libraries are on the path. Sometimes this doesn't happen for easy_installed libraries.
Check out JetBrains PyCharm. It features:
Code completion of any imported library
Good support for unit testing
Refactoring
Debugging
Version control integration
It's built on the same platform as IntelliJ IDEA which is a generally considered one of the best Java IDEs. There's a community edition which is free and open-source.
Like Eclipse is primarily a Java IDE written in Java, you could try Eric which is a Python IDE written in Python. I have had some issues with it in the past but I really enjoy the ability to stop your code at a breakpoint and have access to the python console to manipulate your data or even to inject new functions. PyDev could really use a console like that.
for a small proyects Scribes. Otherwise Eclipse+pydev.

looking for a working linux command line tool to download from rapidshare [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm wondering if anyone knows about a working command line tool for linux to download using premium account on rapidshare. I've seen a python solution, which does not work for me -- returns urllib2 error message
urlopen error unknown url type: https
and my knowledge of python is not yet deep enough to figure out why: might be a recent RS change or something is wrong with my settings.
Any other tools around someone may be using and could share a link?
wget works well. You have to point it to a file containing the cookie corresponding to your Rapidshare account (e.g. the cookies.txt in Firefox's profile directory).
wget --load-cookies /path/to/cookies.txt http://...
curl is a remarkably powerful command-line tool for squeezing things out of web servers. I can't say about RapidShare in particular, but if you see what the manual download is doing, you can get curl to post the same forms, for example.
I like Plowshare.
It let's you (depending on file hosting)
download
upload
list
delete
Here's a tutorial for a command line tool to download from rapidshare:
http://fedoracoreproject.blogspot.com/2009/03/linux-command-line-tool-to-download.html
To get urllib2 to open https URLs you need Python with SSL support. How to get it depends on your distribution.
Nice commandline tool for RapidShare and many other services (MegaUploads, HotFiles etc). It allows simultanous transfer from different services:
http://svn.pld-linux.org/cgi-bin/viewsvn/toys/rsget.pl/
Just create file with list of URLs (# for comment), and start rsget.pl list-of-urls
It monitors file with url list, so you can add/remove links without restarting script (i.e. breaking current transfer).
If you don't mind using Ruby (it's pretty similar to Python anyway), check out the rapidshare gem (which I contribute to, BTW).
Installation: gem install rapidshare
Example of simple use:
require 'rapidshare'
files_to_download = %w{
https://rapidshare.com/files/829628035/HornyRhinos.jpg
https://rapidshare.com/files/3103991314/HappyHippos.jpg
https://rapidshare.com/files/3882189288/ElegantElephants.jpg
}
rs = Rapidshare::API.new(:login => 'my_login', :password => 'my_password')
files_to_download.each do |file|
rs.download(file) || puts "ERROR downloading #{file}"
end
There is a more advanced downloading client available in /examples directory.

UNIX shell written in a reasonable language? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Has anyone ever heard of a UNIX shell written in a reasonable language, like Python?
Eshell is a Bash-like shell in Emacs Lisp.
IPython can be used as a system shell, though the syntax is a bit weird (supporting all of Python plus basic sh constructs).
fish has a core written in C, but much of its functionality is implemented in itself. Unlike many rare shells, it can be used as your login shell.
Hotwire deserves another mention. Its basic design appears to be "PowerShell in Python," but it also does some clever things with UI. The last release was in 2008.
Zoidberg is written in Perl and uses Perl syntax. A nice-looking project, shame it seems to have stalled.
Scsh would be a pain to use as a login shell (an example command from the docs: (run/strings (find "." -name *.c -print))), but it looks like a good "Perl in Scheme."
iPython (Python) and Rush (Ruby) are shells that are designed for more advanced languages. There's also Hotwire, which is sort of a weird integrated shell/terminal emulator.
From all appearances, Python IS a shell. It runs with #! and it can run interactively. Between the os and shutil packages you have all of the features of standard Unix shells.
Since you can do anything in Python with simple, powerful scripts, you don't really need to spend any time messing with the other shells.
Well, there's emacs, which is arguably a shell written in lisp :)
Seriously though, are you looking for a reimplementation of an existing shell design in a different language such as Python? Or are you looking for a new implementation of a shell language that looks similar to your language of choice?
There is xon now:
http://xon.sh/
http://xon.sh/tutorial.html#running-commands
PyCon video - https://www.youtube.com/watch?v=uaje5I22kgE
Tclsh is pretty nice (assuming you like Tcl, of course).
Try rash. It's a shell language written in Racket. It has a nice interactive-friendly syntax. You can embed Rash inside any normal Racket file as well as embedding normal Racket inside Rash. It's extensible and you can define new pipeline operators. It's still alpha quality at the moment, but it's pretty cool. Full disclosure: I wrote it.

Categories

Resources