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 8 years ago.
Improve this question
I have a relatively large test code base which I will migrate from nose to py.test. I would also like to take advantage of py.tests 'bare assert' functionality so that I'd need to make a lot of the following changes (for example):
self.assertEquals(a, b)
->
assert a == b
The code base is in practice too large for me to consider doing this by hand. With some git and sed magic I can get rid of about half of the self.asserts, but that still leaves me with an awful lot to do and the script is already getting somewhat complex.
It occurred to me that I'm probably not the first person to have done this. So: have any nice scripts to do this kind of thing? Or know of any nice tool that can programmatically refactor python (note: I'm aware of python-rope but to be honest at a glance that didn't seem particularly convenient)
You could use py.convert_unittest from the pycmd package for transforming the self.assert* alternatively. It doesn't deal with rewriting the inheritance, though.
Not sure it makes sense but you might also checkout the related pycmd hg repository and tweak the script, possibly submitting pull requests. If you like, i'd help factoring out the script into a new repo (also on github, if you prefer) and then advertise it so people with the same problem can start sharing efforts. As i am not using unittest myself for a longer time (surprise!) i don't have interest to drive this effort but i am willing to help along.
Related
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 there a recommended reference manual for python that's better than the official docs? I'm an experienced programmer (PHP, C#, javascript, and some C most recently), and I find the python manual pretty lacking compared the PHP manual and MSDN. In particular, the official docs never seem to tell me what errors can happen if I pass in something invalid, and there's apparently not a way to navigate within a module.
Take the os module for example. There's no list of constants or methods I can call on that page, so I have to Ctrl+f for "stat(" until I find it. Then, once I do find it, it doesn't tell me what to expect if I call stat with a directory that doesn't exist, so I just have to try it in a terminal and see what happens.
This seems wildly inefficient… how do python programmers deal with this?
In practice, you either make a quick test program to check the behavior, or read the source code. Much of the Python standard library code is fairly clearly written and in fact rather self-documenting, so it's standard practice to refer to it when you need to know the nitty-gritty details of how something works.
One exception: with low-level system functions such as many of those in the os module, the functions map directly on to their C namesakes for the underlying platform. So if you need to know about the behavior of Python's stat, you look up the reference documentation for your platform's native C stat call. In these cases the Python library docs often only explain the basic purpose of the function and how it differs from its C equivalent, if at all.
I don't think I ever had the same feeling towards the python docs as you do but I did some times need to go out of my way some times for a better understand of how a part of python works. Though that is how most language are. Python is a quick and easy language to learn which requires less time on docs and more time programming. Also python's user base isn't as large as PHP. PHP has people constantly giving examples and details on certain functions daily.
Another great thing about python is its interactive shell to test things out. Just my idea of programming you learn more by doing then seeing. So if you're ever interested in testing something you don't need to drag through compiling, just write a quick script in the interpreter. the interpreter also has reference tools. Example dir(<identifier>) and help(<identifier>) for module, clasa or function needs.
Any way enough defending my favorite language, pyDoc is a little useful tool to help you get what you need from python.
pydoc is a tool that comes with Python that can be used for viewing
and generating Python documentation.
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 3 years ago.
Improve this question
With 145 forks, 125 open issues, and the last release almost 2years ago, django-piston appears to be approaching abandonware and since the project I'm working on is likely to be a big one, I'd like to standardise on something that's going to be around for a while. Is there something resembling a consensus in the Python/Django community regarding a preference for REST API services? Even if it's one of those 145 forks? Ideally, I'd like to find something that plays nice with #jacobian's REST Worst Practises
check http://djangopackages.com/grids/g/api/ (django-tastypie looks very promising)
I also don't like Piston very much. Don't misunderstand me. It is (or was) a good app, though it has its issues. The main problem I had working with it that it hides Debugging information coming from django.
If you are absolutely unsure about what to use roll your own. With django 1.3 and class based views you got already a good way to add an API like this. If you need OAuth or other authentication methods you can simply check existing ways in piston or other apps and use them.
Two other REST packages that may be of interest :
http://django-rest-framework.org/
http://benoitc.github.com/dj-webmachine/index.html
It is worth mentioning about
django-tastypie
This is getting faster acceptance than the others.
Django Piston project seems to be abandonned.
Django rest framework has taken a large advantage with its second version.
Note that this is valid for now (2014), time may decide different.
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 8 years ago.
Improve this question
I'm looking hard but I cannot find any XMPP server in python with the following features:
using epoll, just like http://www.gevent.org/
supporting BOSH
modular design
use little RAM/CPU for up to 1000 users
more important than the previous requirement: the CPU/RAM usage must be predictable
Prosody looks quite good feature-wise, but I don't know how many users it can support simultaneously and how it is performance-wise.
Could someone give me an idea?
For a rough idea of how Prosody is performance-wise, see this post on their ML. https://groups.google.com/d/topic/prosody-users/SlXpfwJfgY4/discussion
xmpp.org uses Prosody, any other questions? :P
btw, if you want to toy with it a little, you can always run prosody using luajit (didn't test that myself, but I'm fairly sure it would work). Expect at least 2-4x faster execution.
Look # ejabberd too.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other 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 8 years ago.
Improve this question
I'm currently supporting a Python web app with increasingly complicated user/role/permission management requirements. Currently, we are rolling our own user, groups, permissions, etc. code and supporting database.
I'd like to find something like ASP.NET membership that can help manage user authentication and authorization, rather than risk security issues in continuing to create an increasingly complicated custom solution. Are there any similar projects out there worth taking a look at?
If you are looking for off site user authentication you might want to consider openid. People have added openid support to cherrypy.
If you are looking for more user management type code. I guess it depends on exactally what you are doing but others have done user management before, why not leverage off them. Skeletonz is a CMS written on top of cherrypy. If you are not wed to cherrypy you might also want to consider Pinax. It's built on Django with the idea of reusing work others have done so you don't have to do it again.
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
What's my best bet for parsing HTML if I can't use BeautifulSoup or lxml? I've got some code that uses SGMLlib but it's a bit low-level and it's now deprecated.
I would prefer if it could stomache a bit of malformed HTML although I'm pretty sure most of the input will be pretty clean.
Python has a native HTML parser, however the Tidy wrapper Nick suggested would probably be a solid choice as well. Tidy is a very common library, (written in C is it?)
Perhaps µTidylib will meet your needs?
You can install lxml and many other python modules easily and seamlessly on the Mac (OS X) using Pallet, which is the MacPorts official GUI
The module name is py27-lxml. Easy as 1,2,3.
http://www.xmlhack.com/read.php?item=1392
http://sourceforge.net/projects/pirxx/
http://pyxml.sourceforge.net/topics/
I don't have much experience with python, but I have used Xerces (from the Apache foundation) in the past and found it to be very useful. The learning curve isn't bad either, though I'm not coming from a python perspective. I suggest you consider it though. (The first two links I've included discuss python interfaces to Xerces and the last one is the first google hit on "python xml").
htql is good at handling malformed html:
http://htql.net/
html5lib is good:
http://code.google.com/p/html5lib/
Update: The link above is broken. A third-party mirror of above, can be accessed from https://github.com/html5lib/gcode-import