{ "info": { "author": "Kendrick Tan", "author_email": "kendrick@wearepopgun.com", "bugtrack_url": null, "classifiers": [], "description": "# pylint-tta\nPylint plugin to check for *PyTorch* tensor type annotations\n\nTested on Python 3.6+\n\n---\n\n| Branch | Status |\n| --- | --- |\n| Master | ![](https://travis-ci.org/Popgun-Labs/pylint_tta.svg?branch=master) |\n\n---\n\n\n# Quickstart\n```bash\npip install pylint pylint_tta\n\n# Use pylint defaults with the plugin\npylint --load-plugins=pylint_tta \n\n# Only use the plugin\npylint --load-plugins=pylint_tta --disable=all --enable=C9001,C9002,C9003,C9004,C9005,C9006 \n```\n\n# What it checks for\n\nGiven file `example1.py`,\n```python\nimport astroid\nimport torch\n\n\ndef fail_func():\n a = torch.randn(5, 5, 5)\n\n a.unsqueeze_(1)\n b_fail = a.view(5, 25, -1)\n c_fail = a[:, : 1]\n c_fail: str = a[:, : 1]\n d_fail: str = a.unsqueeze(1)\n e_fail = a.unsqueeze_(1)\n\n return None\n\n\ndef pass_func():\n a = torch.randn(5, 5, 5)\n\n c_pass: ('w', 'h', 'b') = a[:, :, 1]\n d_pass: ('width', 'batch', 'height') = a.unsqueeze(1)\n\n return None\n```\n\npylint-tta will yield:\n\n```\n************* Module example1\nexample1.py:8:4: C9005: In-place operation detected (disallow-inplace-tensor-operations)\nexample1.py:9:4: C9001: Missing type annotations on tensor operation (missing-tensor-annotations)\nexample1.py:10:4: C9003: Missing type annotations on slicing (missing-slicing-annotations)\nexample1.py:11:4: C9004: Invalid type annotations on slicing (invalid-slicing-annotations)\nexample1.py:12:4: C9002: Non tuple type annotations on tensor operation (invalid-tensor-annotations)\nexample1.py:13:4: C9006: Assignment on in-place operation detected (assignment-on-inplace-operations)\n```\n\n# Codes\n| Code | Name |\n| ----- |:-------------|\n| C9001 | missing-tensor-annotations |\n| C9002 | invalid-tensor-annotations |\n| C9003 | missing-slicing-annotations |\n| C9004 | invalid-slicing-annotations |\n| C9005 | disallow-inplace-tensor-operations |\n| C9006 | assignment-on-inplace-operations |\n\n\n# Dev\n## Run Example\n```\nexport PYTHONPATH=`pwd`; pylint --load-plugins=pylint_tta --disable=all --enable=C9001,C9002,C9003,C9004 example1.py\n```\n\n## Testing\n```\npytest -s\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Popgun-Labs/pylint-tta", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pylint-tta", "package_url": "https://pypi.org/project/pylint-tta/", "platform": "", "project_url": "https://pypi.org/project/pylint-tta/", "project_urls": { "Homepage": "https://github.com/Popgun-Labs/pylint-tta" }, "release_url": "https://pypi.org/project/pylint-tta/0.0.4a0/", "requires_dist": null, "requires_python": "", "summary": "Linter for PyTorch Tensor operations", "version": "0.0.4a0" }, "last_serial": 5260434, "releases": { "0.0.2a0": [ { "comment_text": "", "digests": { "md5": "11985c22eb7fbe8c2aab2914ba2612ea", "sha256": "0a733c55166af4c67a50ff8e7491b896d0f5c4021c1ada455375a2492ff7d5b4" }, "downloads": -1, "filename": "pylint_tta-0.0.2a0.tar.gz", "has_sig": false, "md5_digest": "11985c22eb7fbe8c2aab2914ba2612ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3089, "upload_time": "2019-05-10T03:06:46", "url": "https://files.pythonhosted.org/packages/2c/08/bd942e7f693cba9a26c49b61d1da15068aaa507c15d26b2923534837dabc/pylint_tta-0.0.2a0.tar.gz" } ], "0.0.3a0": [ { "comment_text": "", "digests": { "md5": "6123b17e13b04e994191b29e2d8fabfb", "sha256": "0e310738d3eaf48302a8004c8e6f2f9134f4212c22ed60cafa7e058b3d84c99a" }, "downloads": -1, "filename": "pylint_tta-0.0.3a0.tar.gz", "has_sig": false, "md5_digest": "6123b17e13b04e994191b29e2d8fabfb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3301, "upload_time": "2019-05-10T03:17:10", "url": "https://files.pythonhosted.org/packages/4a/b8/28e3c95a70fcdc1d1afaa441889dc12e50930cc51d8dcd657bea27f13b3c/pylint_tta-0.0.3a0.tar.gz" } ], "0.0.4a0": [ { "comment_text": "", "digests": { "md5": "b3f9d5195b4a87757846f67f6f1535f0", "sha256": "2768ba16beb88779e95a8d591e564a846bb677409bfeec6cd0ccf41c8897d7e6" }, "downloads": -1, "filename": "pylint_tta-0.0.4a0.tar.gz", "has_sig": false, "md5_digest": "b3f9d5195b4a87757846f67f6f1535f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3264, "upload_time": "2019-05-13T02:41:03", "url": "https://files.pythonhosted.org/packages/ad/59/2004ef5b8b106b968a58e3bbf4a2868b09081d5c32c72ae828e1c6f77a21/pylint_tta-0.0.4a0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b3f9d5195b4a87757846f67f6f1535f0", "sha256": "2768ba16beb88779e95a8d591e564a846bb677409bfeec6cd0ccf41c8897d7e6" }, "downloads": -1, "filename": "pylint_tta-0.0.4a0.tar.gz", "has_sig": false, "md5_digest": "b3f9d5195b4a87757846f67f6f1535f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3264, "upload_time": "2019-05-13T02:41:03", "url": "https://files.pythonhosted.org/packages/ad/59/2004ef5b8b106b968a58e3bbf4a2868b09081d5c32c72ae828e1c6f77a21/pylint_tta-0.0.4a0.tar.gz" } ] }