Aaron Iles | c18d694 | 2013-01-06 13:12:00 +1100 | [diff] [blame] | 1 | funcsigs |
| 2 | ======== |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 3 | |
| 4 | ``funcsigs`` is a backport of the `PEP 362`_ function signature features from |
| 5 | Python 3.3's `inspect`_ module. The backport is compatible with Python 2.6, 2.7 |
| 6 | as well as 3.2 and up. |
| 7 | |
Aaron Iles | dd3a481 | 2013-05-29 22:34:46 +1000 | [diff] [blame] | 8 | |pypi_version| |
| 9 | |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 10 | Documentation |
| 11 | ------------- |
| 12 | |
| 13 | The reference documentation is standard library documentation for the |
| 14 | `inspect`_ module in Python3. This documentation has been included in the |
| 15 | ``funcsigs`` package documentation hosted on `Read The Docs`_. |
| 16 | |
Aaron Iles | 269bcf9 | 2013-01-06 22:13:28 +1100 | [diff] [blame] | 17 | Example |
| 18 | ------- |
| 19 | |
| 20 | To obtain a signature object, pass the target function to the |
| 21 | ``funcsigs.signature`` function. :: |
| 22 | |
| 23 | >>> from funcsigs import signature |
| 24 | >>> def foo(a, b=None, *args, **kwargs): |
| 25 | ... pass |
| 26 | |
| 27 | >>> sig = signature(foo) |
| 28 | |
| 29 | For the details of the signature object, refer to the either the package of |
| 30 | standard library documentation. |
| 31 | |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 32 | Compatability |
| 33 | ------------- |
| 34 | |
| 35 | The ``funcsigs`` backport has been tested against: |
| 36 | |
| 37 | * CPython 2.6 |
| 38 | * CPython 2.7 |
| 39 | * CPython 3.2 |
Aaron Iles | 8ae3ff8 | 2013-01-07 21:58:49 +1100 | [diff] [blame] | 40 | * PyPy 1.9 |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 41 | |
| 42 | Continuous integration testing is provided by `Travis CI`_. |
| 43 | |
Aaron Iles | 8ae3ff8 | 2013-01-07 21:58:49 +1100 | [diff] [blame] | 44 | Under Python 2.x there is a compatability issue when a function is assigned to |
| 45 | the ``__wrapped__`` property of a class after it has been constructed. |
| 46 | Similiarily there under PyPy directly passing the ``__call__`` method of a |
| 47 | builtin is also a compatability issues. Otherwise the functionality is |
| 48 | believed to be uniform between both Python2 and Python3. |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 49 | |
| 50 | Issues |
| 51 | ------ |
| 52 | |
| 53 | Source code for ``funcsigs`` is hosted on `GitHub`_. Any bug reports or feature |
Aaron Iles | 59ab8ac | 2013-05-30 21:16:18 +1000 | [diff] [blame] | 54 | requests can be made using GitHub's `issues system`_. |build_status| |coverage| |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 55 | |
| 56 | Copyright |
| 57 | --------- |
| 58 | |
| 59 | This is a derived work of CPython under the terms of the `PSF License |
Aaron Iles | 082cc6d | 2013-01-06 22:14:06 +1100 | [diff] [blame] | 60 | Agreement`_. The original CPython inspect module, its unit tests and |
| 61 | documentation are the copyright of the Python Software Foundation. The derived |
| 62 | work is distributed under the `Apache License Version 2.0`_. |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 63 | |
| 64 | .. _Apache License Version 2.0: http://opensource.org/licenses/Apache-2.0 |
| 65 | .. _GitHub: https://github.com/aliles/funcsigs |
| 66 | .. _PSF License Agreement: http://docs.python.org/3/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python |
| 67 | .. _Travis CI: http://travis-ci.org/ |
| 68 | .. _Read The Docs: http://funcsigs.readthedocs.org/ |
| 69 | .. _PEP 362: http://www.python.org/dev/peps/pep-0362/ |
| 70 | .. _inspect: http://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object |
| 71 | .. _issues system: https://github.com/alies/funcsigs/issues |
Aaron Iles | dd3a481 | 2013-05-29 22:34:46 +1000 | [diff] [blame] | 72 | |
Aaron Iles | a3eb229 | 2013-01-06 21:23:25 +1100 | [diff] [blame] | 73 | .. |build_status| image:: https://secure.travis-ci.org/aliles/funcsigs.png?branch=master |
| 74 | :target: http://travis-ci.org/#!/aliles/funcsigs |
Aaron Iles | dd3a481 | 2013-05-29 22:34:46 +1000 | [diff] [blame] | 75 | :alt: Current build status |
| 76 | |
Aaron Iles | 59ab8ac | 2013-05-30 21:16:18 +1000 | [diff] [blame] | 77 | .. |coverage| image:: https://coveralls.io/repos/aliles/funcsigs/badge.png?branch=master |
| 78 | :target: https://coveralls.io/r/aliles/funcsigs?branch=master |
| 79 | :alt: Coverage status |
| 80 | |
Aaron Iles | dd3a481 | 2013-05-29 22:34:46 +1000 | [diff] [blame] | 81 | .. |pypi_version| image:: https://pypip.in/v/funcsigs/badge.png |
| 82 | :target: https://crate.io/packages/funcsigs/ |
| 83 | :alt: Latest PyPI version |