Skip to main content
=======
Autosig
=======


.. image:: https://img.shields.io/pypi/v/autosig.svg
:target: https://pypi.python.org/pypi/autosig

.. image:: https://img.shields.io/travis/piccolbo/autosig.svg
:target: https://travis-ci.org/piccolbo/autosig

.. image:: https://readthedocs.org/projects/autosig/badge/?version=latest
:target: https://autosig.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status


.. image:: https://pyup.io/repos/github/piccolbo/autosig/shield.svg
:target: https://pyup.io/repos/github/piccolbo/autosig/
:alt: Updates

**Experimental**

Autosig allows to create classes that describe signatures of functions and common processing of arguments. This allows to:

* Model functions that share the same signature
* Model the commonalities between different signatures, e.g. sharing the first few arguments
* Model common processing normally associated with signatures, such as default values, type checking, validation and conversion, this both at the level of individual arguments and globally for a signature (e.g, check the the first argument is a DataFrame vs. check the that first two arguments are both of the same type)

Since a signature is modeled with class, inheritance can be used to capture commonalities and differences between signatures::

from autosig import *
# define a class with @signature decorator inheriting from a subclass of
# Signature (I know, a little redundant in this case)
# x and y are parameters with no special properties
@signature
class BinaryOp(Signature):
x = param()
y = param()

# define a parameter with an int annotation, converting to int if necessary)
int_param = param(converter=int, type=int)

# define another signature with two integer parameters, same annotation and
# conversion behavior
@signature
class BinaryIntOp(BinaryOp):
x = int_param
y = int_param


# define a binary operator
@autosig(sig=BinaryOp)
def add(x, y):
return x + y

# define a binary operator with int parameters
@autosig(sig=BinaryIntOp)
def int_add(x, y):
return x + y

add(2, 3) # 5
add(2, "3") # fails
int_add(2, "3") # 5


=======
History
=======


0.3.1 (2018-08-30)
-----------------

* Improved docstring generation

0.3.0 (2018-08-30)
-----------------

* Compose docstring from param docstrings

0.2.3 (2018-08-28)

* Better and passing tests.

0.2.2 (2018-08-27)
------------------

* More stringent enforcement of signatures including defaults. Fixed build.

0.1.0 (2018-04-25)
------------------

* First release on PyPI.


Metadata

Release files for autosig 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autosig 0.3.1
File Size Uploaded
autosig-0.3.1.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autosig 0.3.1
File Interpreter ABI Platform
autosig-0.3.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.9 kB

Release files / autosig-0.3.1.tar.gz

Download URL autosig-0.3.1.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
94f3f798485342eaca54a466524ee4d4d32ad3c67a63095425dac1beacab75eb
BLAKE2b-256 checksum
How to use checksums
92dbfe14a539539f386577ea1c5b54845ab0e3752e671304ef044286eb3a6088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

Release files / autosig-0.3.1-py2.py3-none-any.whl

Download URL autosig-0.3.1-py2.py3-none-any.whl
Size 3.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7d72b322092b286d8df180c3b8bf52b720f2d47ee55ccdfdb23537d9cd3dc2bb
BLAKE2b-256 checksum
How to use checksums
18cb58273424dd23a6cf61bfcf3b7bf2e646a0c99c9e584b8523755185ccba41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

Release history Release notifications | RSS feed

0.9.2

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page