pystrict


Namepystrict JSON
Version 1.3 PyPI version JSON
download
home_pagehttps://github.com/earonesty/pystrict
Summary## strict
upload_time2022-07-11 17:34:55
maintainerNone
docs_urlNone
authorErik Aronesty
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.com/earonesty/pystrict.svg?branch=master)](https://travis-ci.com/earonesty/pystrict)

## strict

Python strict tag

    pip install pystrict


Using @strict on classes can prevent serious errors by raising an exception when an instance has a variable created outside of init.
Unfortunately, linters don't (cannot) always catch this.  I can't express how much time this has saved me recently.

Using @strict on functions only checks type specifiers.

Example:

    from pystrict import strict

    # not allowed, missing type specifier
    @strict
    def foo(x: int, y):
        ...


    # not allowed, missing type specifier in __init__
    @strict
    class Foo():
        def __init__(self, x: int, y):
            ...

    # not allowed, object modified outside of init
    @strict
    class Foo():
        def __init__(self, x: int):
            self.x = 1

    # mypy and pytest won't check this
    def evil():
        return list({'a':Foo(1)}.values())

    z = evil()
    z[0].y = 4

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/earonesty/pystrict",
    "name": "pystrict",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Erik Aronesty",
    "author_email": "erik@q32.com",
    "download_url": "https://files.pythonhosted.org/packages/14/30/405f438e8438192bd25660d1869b08af22faa260a8aeadab37be6c1e7d45/pystrict-1.3.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://travis-ci.com/earonesty/pystrict.svg?branch=master)](https://travis-ci.com/earonesty/pystrict)\n\n## strict\n\nPython strict tag\n\n    pip install pystrict\n\n\nUsing @strict on classes can prevent serious errors by raising an exception when an instance has a variable created outside of init.\nUnfortunately, linters don't (cannot) always catch this.  I can't express how much time this has saved me recently.\n\nUsing @strict on functions only checks type specifiers.\n\nExample:\n\n    from pystrict import strict\n\n    # not allowed, missing type specifier\n    @strict\n    def foo(x: int, y):\n        ...\n\n\n    # not allowed, missing type specifier in __init__\n    @strict\n    class Foo():\n        def __init__(self, x: int, y):\n            ...\n\n    # not allowed, object modified outside of init\n    @strict\n    class Foo():\n        def __init__(self, x: int):\n            self.x = 1\n\n    # mypy and pytest won't check this\n    def evil():\n        return list({'a':Foo(1)}.values())\n\n    z = evil()\n    z[0].y = 4\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "## strict",
    "version": "1.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "md5": "98acdb657f819875def0eadbdf8cba2e",
                "sha256": "548c6fb417753f15933f628633fc808f01795ca8048623aae064f5c7eaa0ac42"
            },
            "downloads": -1,
            "filename": "pystrict-1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "98acdb657f819875def0eadbdf8cba2e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3095,
            "upload_time": "2022-07-11T17:34:45",
            "upload_time_iso_8601": "2022-07-11T17:34:45.280917Z",
            "url": "https://files.pythonhosted.org/packages/9f/c6/09a4294888d43cbe76e115cd0992fe9f84298c76b146e7864e0ff002b20c/pystrict-1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "md5": "856914a3a84b01ce57691242fc40931f",
                "sha256": "09d1c236850667510684e259416445309ae68bbf7ac99570efa80fcef750481a"
            },
            "downloads": -1,
            "filename": "pystrict-1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "856914a3a84b01ce57691242fc40931f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9532,
            "upload_time": "2022-07-11T17:34:55",
            "upload_time_iso_8601": "2022-07-11T17:34:55.256729Z",
            "url": "https://files.pythonhosted.org/packages/14/30/405f438e8438192bd25660d1869b08af22faa260a8aeadab37be6c1e7d45/pystrict-1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-11 17:34:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "earonesty",
    "github_project": "pystrict",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pystrict"
}
        
Elapsed time: 0.03203s