Cue/scales. Beautifiers and Pretty Printers. Beautifiers and pretty printers are essential language tools. Unfortunately very few programmers use them. If you do not use please start now... that's a real life saver tool. Programmers spend 50% of their time just lookingat source code. Formatting source code can make them more productive in this task, saving a significant amount of an time and efforts to find bugs. What is a beautifier?
Properly nested indentation makes it much easier to identify matching program blocks. I use beautifiers with each language that I programmed until I get to Perl. BTW later I found that there are two tools to beatify Perl program: one is pertidy and the second is DzSoft Perl Editor . Why do I worry about beautifier? Another benefit of beautification comes from its role as a standard was to format programs. Many conventional formatting tools use ad hoc string processing methods to implement the reformatting.. Dr. Old News ;-) [Oct 10, 2011] Uncrustify 0.59 Written in C++ prettyprinter.de [Jan 19, 2011] pb. Cli — command line tools — pyCLI v1.1.0 documentation. The cli package is a framework for making simple, correct command line applications in Python. With cli, you can quickly add standard command line parsing; logging; unit and functional testing; and profiling to your CLI apps.
To make it easier to do the right thing, cli wraps all of these tools into a single, consistent application interface. Installing cli You can install the latest stable version of cli using pip: Public repositories for the project are hosted at github, so you can use either git to get a copy of the project’s code and history: $ git clone If you notice a problem with cli, please report it using the github issue tracker (or, if you have a fix, send a pull request). A note about versions cli is developed along two branches. Basic usage While the cli modules provide a simple API for designing your own applications, the default implementations are intended to be flexible enough to cover most use cases. If __name__ == "__main__": yourapp.run() PyInstaller. PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX.
Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.4, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility. The main goal of PyInstaller is to be compatible with 3rd-party packages out-of-the-box.
This means that, with PyInstaller, all the required tricks to make external packages work are already integrated within PyInstaller itself so that there is no user intervention required. You'll never be required to look for tricks in wikis and apply custom modification to your files or your setup scripts. As an example, libraries like PyQt, Django or matplotlib are fully supported, without having to handle plugins or external data files manually. Features ¶ Downloads ¶ License ¶ PyMonitor - Python Run Time Monitor Module.
C o r e P y : Synthetic Programming in Python. Burton Systems Software - TLIB Version Control - Overview. CVS - Open Source Version Control. Introduction | News | Documentation | Get the Software | Help and Bug Reports | Development Introduction to CVS CVS is a version control system, an important component of Source Configuration Management (SCM). Using it, you can record the history of sources files, and documents. It fills a similar role to the free software RCS, PRCS, and Aegis packages. CVS is a production quality system in wide use around the world, including many free software projects.
While CVS stores individual file history in the same format as RCS, it offers the following significant advantages over RCS: It can run scripts which you can supply to log CVS operations or enforce site-specific polices. CVS News Recent CVS news, including release announcements, are posted on the NEWS page. CVS Documentation The manual is also available online. Downloading CVS CVS can be downloaded from or one of the mirrors (make sure to check the non-gnu/cvs directory on the mirrors). CVS Help and Bug Reports.
Tracing Python memory leaks. While I was writing a python daemon, I noticed that my application process memory usage is growing over time. The data wasn’t increasing so there must have been some memory leak. It’s not so easy for a Python application to leak memory. Usually there are three scenarios: some low level C library is leakingyour Python code have global lists or dicts that grow over time, and you forgot to remove the objects after usethere are some reference cycles in your app I remembered the post from Marius Gedminas, in which he traced his memory leaks, but I haven’t noticed before that he published his tools. The tools are awesome. . $ pdb . After some time, when my application collected some garbages I pressed Ctrl+C: 2008-11-13 18:41:40,136 server.py INFO Quitting (Pdb) import gc (Pdb) gc.collect() 58 (Pdb) gc.collect() 0 Let’s see some statistics of object types in memory: Message objects definitely shouldn’t be in the memory. This is what I saw: Ok. Here’s the cycle we’re looking for:
Ore.svn. Python Call Graph. Virtualenv. Virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.4/site-packages (or whatever your platform's standard location is), it's easy to end up in a situation where you unintentionally upgrade an application that shouldn't be upgraded.
Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application. Also, what if you can't install packages into the global site-packages directory? In all these cases, virtualenv can help you. The basic usage is: $ python virtualenv.py ENV While this creates an environment, it doesn't put anything into the environment. Bootstrap Example.
Snakefood: Python Dependency Graphs. Generate dependency graphs from Python code. This dependency tracker package has a few distinguishing characteristics: It uses the AST to parse the Python files. This is very reliable, it always runs.No module is loaded. Loading modules to figure out dependencies is almost always problem, because a lot of codebases run initialization code in the global namespace, which often requires additional setup.
Snakefood is guaranteed not to have this problem (it just runs, no matter what).It works on a set of files, i.e. you do not have to specify a single script, you can select a directory (package or else) or a set of files. It finds all the Python files recursively automatically.Automatic/no configuration: your PYTHONPATH is automatically adjusted to include the required package roots. It figures out the paths that are required from the files/directories given as input. I fully intend that this program work on all codebases. See full documentation for more details. XRecord - An introspecting Python ORM.
Patcher - Labix. Introduction Patcher is a tool for quick creation of patches against a project source tree. Patcher functionality resembles a lightweight version control system. It has no repository, and only controls differences between a pristine version and a working copy. Why The idea for developing patcher happened during the development of Conectiva Linux. More specifically, when we had to fix some of the packages to compile with GCC 3.2. Using patcher Here's a very simple succession of commands, with explanations. Unpack the project: $ tar xzf project-1.0.tar.gz $ cd project-1.0 Create patcher structures for the project: $ ptr start Change the project somehow: $ cd src $ vi project.c Check what changes have been made so far: $ ptr status ? Extract a patch for these changes: $ cd ../.. $ ptr diff project-1.0 > project-1.0-changes.patch Remove patcher structures from the project: $ ptr stop project-1.0 Using patcher with large trees $ tar xzf project-1.0.tar.gz $ cd project-1.0 $ ptr start -n Screenshot Download.
Basic class code generator. When starting a new component or application, I find myself typing out the same thing over and over, using Snippets in my Toolbox, etc.. A lot of setup time is spent organising, fixing little mistakes, going back to add something forgotten and the like. The goal of this script was to reduce the amount of typing when starting from well defined requirements. I was also interested in creating uniform looking code, which can be helpful when dealing with hundreds of different db, model, or view controllers. I am also lazy.... So nothing fancy here, its really basic, but banging this out one morning saved me hours of set up and mindless typing.
Also, I've included the @synchronous decorator from Someday I would like to use a sort of markup for class, method, and unit test templates that could be referenced in the yaml to specify different types of output, instead of writing out the text inline. Object Proxying. Generic proxy object with before/after method hooks. « Python re. I needed the ability to "trace" all function calls made to a particular object instance, in order to be able to "replay" them later in the same order and with the same values.
(This was useful for testing, I have tests that are generated with randomness and I wanted to be able to reproduce the random test run exactly when it found a bug.) So I wrote this little recipe, which allows you to create a proxy object to any existing instance, with hooks for particular method calls, or for all method calls. Derive from HookProxy and add the specific hooks you need to do logging the way you want it, and then use an instance of that in-place for your object. There is a simple example in the code. (Note: there is a convenience method in HookProxy that formats the arguments and keywords in a way that they could be re-executed later, you can use that to do logging of the calls made on the proxied-instance.) Python proxy pattern.