pyflakes, pylint, pychecker - and other tools

E

Esmail

What is the consensus of the Python community regarding these
code checkers?

In particular, are the stylistic recommendations that
pylint makes considered sensible/valid?

Are there any other tools you consider essential to Python
development?

Thanks.
Esmail
 
E

Esmail

Great list Ben, I use emacs and will check out the tools
you listed.

What techniques/tools do you recommend for debugging?

Esmail
 
E

Esmail

Great list Ben, I use emacs and will check out the tools
you listed.

What techniques/tools do you recommend for debugging?

Esmail
 
A

Alex VanderWoude

Ben said:
I use the Python interactive shell, and code each module so that the
behaviour is easily introspected and tested from outside the module. If
I'm not able to easily introspect the code at an interactive prompt,
that's a clear sign that the code interface is poorly designed. So I fix
that first.

By all accounts, the ‘pdb’ module makes for a good low-level debugging
tool. I've never needed it though.

I really like using Winpdb (http://winpdb.org/) which provides a GUI for
pdb. It allows you to single-step your code and inspect objects in
memory. What exactly is in that silly nextOne variable? Hey, it's a
list rather but it's supposed to be a number! You get the picture.
 
C

Colin J. Williams

Esmail said:
What is the consensus of the Python community regarding these
code checkers?

In particular, are the stylistic recommendations that
pylint makes considered sensible/valid?

pylint seems a bit heavy handled, a bit
too much PEP 8, which was intended as a
guide, rather than a prescription.

Colin W.
 
C

Colin J. Williams

Esmail said:
Great list Ben, I use emacs and will check out the tools
you listed.

What techniques/tools do you recommend for debugging?

I like PyScripter for Windows, which
provides a tool for PyLint.

Colin W.
 
E

Esmail

Colin said:
pylint seems a bit heavy handled, a bit too much PEP 8,

Just having used this for a short while, I would have to agree,
though for someone coming to Python from other languages (like
myself) it does provide some stylistic guidance, at least initially,
to do it the Pythonic way.
 
E

Esmail

Colin said:
pylint seems a bit heavy handled, a bit too much PEP 8,

Just having used this for a short while, I would have to agree,
though for someone coming to Python from other languages (like
myself) it does provide some stylistic guidance, at least initially,
to do it the Pythonic way.
 
A

Aahz

pylint seems a bit heavy handled, a bit too much PEP 8, which was
intended as a guide, rather than a prescription.

That's half-true on both counts:

First of all, any new library must be PEP 8-compliant for submission to
the standard library, so PEP 8 is indeed somewhat prescriptive.

Second, you can configure pylint to respect your personal style; I think
that pylint's default PEP 8 configuration makes a lot of sense.
 
P

Phillip B Oldham

[snip] and code each module so that the
behaviour is easily introspected and tested from outside the module. If
I'm not able to easily introspect the code at an interactive prompt,
that's a clear sign that the code interface is poorly designed. So I fix
that first.

Could you give a small example of this approach?
 
A

Aahz

How? I haven't seen any decent documentation on doing so.

Actually, I don't know how, I'm just repeating what was claimed at a
presentation on pylint. ;-) I've traditionally used pychecker myself
and haven't seen any reason to switch.
 
E

Esmail

Jeremiah said:
pdb is good if you need to do step-through debugging.

What I normally do in emacs is the following (while working on python
script, and with the python-mode that comes with emacs22):

C-x 3 #splits the screen into two vertical columns
C-c C-c #fires up python and sends the current buffer to it
C-x o #switches to the other column
C-x b Py #switches to the python interactive buffer

This is, I do believe, equivalent to running a script with python -i
script.py . Drops you into an interactive session where you can interact
with what you just wrote. Another very handy tool is etags, see the help
in emacs (You can get to it through C-h i m emacs)

Thanks for the suggestions, I really like using emacs, so I am going to
see how I can integrate it with Python development.
(Unfortunately my Windows version of emacs dosen't seem to be able to
pop into python mode, and I haven't had time to find out why). At this
point I do most of my development under Linux/emacs anyway.

Best,
Esmail
 
E

Esmail

Jeremiah said:
pdb is good if you need to do step-through debugging.

What I normally do in emacs is the following (while working on python
script, and with the python-mode that comes with emacs22):

C-x 3 #splits the screen into two vertical columns
C-c C-c #fires up python and sends the current buffer to it
C-x o #switches to the other column
C-x b Py #switches to the python interactive buffer

This is, I do believe, equivalent to running a script with python -i
script.py . Drops you into an interactive session where you can interact
with what you just wrote. Another very handy tool is etags, see the help
in emacs (You can get to it through C-h i m emacs)

Thanks for the suggestions, I really like using emacs, so I am going to
see how I can integrate it with Python development.
(Unfortunately my Windows version of emacs dosen't seem to be able to
pop into python mode, and I haven't had time to find out why). At this
point I do most of my development under Linux/emacs anyway.

Best,
Esmail
 
E

Esmail

Alex said:
I really like using Winpdb (http://winpdb.org/) which provides a GUI for
pdb. It allows you to single-step your code and inspect objects in
memory. What exactly is in that silly nextOne variable? Hey, it's a
list rather but it's supposed to be a number! You get the picture.

thanks for the suggestion.

The name made me think that this would be only for the Windows
platform, but it turns out it's multi-platform.

I downloaded the Linux version, but haven't had time to explore it
yet, but plan to.

Esmail
 
E

Esmail

Alex said:
I really like using Winpdb (http://winpdb.org/) which provides a GUI for
pdb. It allows you to single-step your code and inspect objects in
memory. What exactly is in that silly nextOne variable? Hey, it's a
list rather but it's supposed to be a number! You get the picture.

thanks for the suggestion.

The name made me think that this would be only for the Windows
platform, but it turns out it's multi-platform.

I downloaded the Linux version, but haven't had time to explore it
yet, but plan to.

Esmail
 
D

David Stanek

Actually, I don't know how, I'm just repeating what was claimed at a
presentation on pylint.  ;-)  I've traditionally used pychecker myself
and haven't seen any reason to switch.


I believe you just:

pylint --generate-rcfile > ~/.pylintrc

and then customize that file.
 
D

David Stanek

For bonus points, I'm actually wanting to know how to configure it per
*project*, and applying that configuration for all programmers of that
project. Having one set of coding conventions per *user* seem like a
recipe for frustration.

I find that the comments in the file it generates are enough. I
haven't needed any more documentation than that.

For project specific configuration I just keep a config file[1] in the
project's source repository. Then make my build script[2] specify that
file when I run 'paver lint'.

[1] http://bitbucket.org/dstanek/snake-guice/src/tip/pylint.cfg
[2] http://bitbucket.org/dstanek/snake-guice/src/tip/pavement.py
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top