| ReadMe for pinfer |
| ================= |
| |
| Introduction |
| ------------ |
| |
| Pinfer is tool for runtime type inference of variable types and |
| function signatures in Python programs. The inferred types are mostly |
| compatible with mypy types. It is intended for coming up with draft |
| types when migrating Python code to static typing, but it can also be |
| used as a code understanding or analysis tool. |
| |
| Pinfer is very experimental! |
| |
| Requirements |
| ------------ |
| |
| * Python 3.2 or later |
| |
| Basic usage |
| ----------- |
| |
| To infer types of all functions and methods in a module: |
| |
| import foo # target module |
| import pinfer |
| |
| # set up type inference and dumping |
| pinfer.infer_module(foo) |
| pinfer.dump_at_exit() |
| |
| # now do something with the module, e.g. run tests |
| |
| For inferring a Python module, add the above lines to the test suite. |
| |
| Handy wrapper |
| ------------- |
| |
| The p.py script provides a handy wrapper for the above. |
| |
| |
| Copyright |
| ------------- |
| |
| This project includes files from the open source CPython project. Those files are Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, |
| 2011, 2012, 2013, 2014 Python Software Foundation; All Rights Reserved. The license can be found at https://github.com/python/cpython/blob/master/LICENSE. |
| |