Skip to main content

A set of patches for the excellent attrs library

Project description

Python application template

+

A set of patches for the excellent attrs library

For See
Documentation https://psa-exe.gitlab.io/python-attrs-patch
Issue tracker https://gitlab.com/psa-exe/python-attrs-patch/issues
Repository contents MANIFEST
History of changes CHANGELOG
Contribution/development guide CONTRIBUTING
Copy of MIT License LICENSE

Installation

pip install pedroasad-attrs-patch

This library contains optional support for Numpy arrays in attrs frozen classes. It may be installed by passing the [numpy] option when installing.

Usage

It acts as a drop-in replacement to attrs. The example below shows how to use it, including all currently existing improvements.

from attrs_patch import attr


@attr.autodoc
@attr.s(frozen=True)
class SomeClass:
    a = attr.ib(metadata={"help": "An immutable numpy array."}, 
                converter=attr.frozen_numpy_array,
                hash=False)
    b = attr.ib(metadata={"help": "A positive integer."},
                converter=int,
                validator=attr.validators.positive)
    c = attr.ib(metadata={"help": "A non-zero integer."}, 
                converter=int,
                validator=attr.validators.nonzero)

— Powered by GitLab CI
— Created by Pedro Asad <pasad@lcg.ufrj.br> using cookiecutter and @pedroasad.com/templates/python/python-app-1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pedroasad-attrs-patch-0.2.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

pedroasad_attrs_patch-0.2.1-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page