{ "info": { "author": "Azat Ibrakov", "author_email": "azatibrakov@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "reprit\n======\n\n[![](https://travis-ci.com/lycantropos/reprit.svg?branch=master)](https://travis-ci.com/lycantropos/reprit \"Travis CI\")\n[![](https://dev.azure.com/lycantropos/reprit/_apis/build/status/lycantropos.reprit?branchName=master)](https://dev.azure.com/lycantropos/reprit/_build/latest?branchName=master \"Azure Pipelines\")\n[![](https://codecov.io/gh/lycantropos/reprit/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/reprit \"Codecov\")\n[![](https://img.shields.io/github/license/lycantropos/reprit.svg)](https://github.com/lycantropos/reprit/blob/master/LICENSE \"License\")\n[![](https://badge.fury.io/py/reprit.svg)](https://badge.fury.io/py/reprit \"PyPI\")\n\nIn what follows\n- `python` is an alias for `python3.5` or any later\nversion (`python3.6` and so on),\n- `pypy` is an alias for `pypy3.5` or any later\nversion (`pypy3.6` and so on).\n\nInstallation\n------------\n\nInstall the latest `pip` & `setuptools` packages versions:\n- with `CPython`\n ```bash\n python -m pip install --upgrade pip setuptools\n ```\n- with `PyPy`\n ```bash\n pypy -m pip install --upgrade pip setuptools\n ```\n\n### User\n\nDownload and install the latest stable version from `PyPI` repository:\n- with `CPython`\n ```bash\n python -m pip install --upgrade reprit\n ```\n- with `PyPy`\n ```bash\n pypy -m pip install --upgrade reprit\n ```\n\n### Developer\n\nDownload the latest version from `GitHub` repository\n```bash\ngit clone https://github.com/lycantropos/reprit.git\ncd reprit\n```\n\nInstall:\n- with `CPython`\n ```bash\n python setup.py install\n ```\n- with `PyPy`\n ```bash\n pypy setup.py install\n ```\n\nUsage\n-----\n\nLet's suppose we are defining a class and we want to have `__repr__`, that:\n\n1. Includes parameters involved in instance creation. \nFor simple cases it should be possible \nto copy string & paste in some place (e.g. REPL session) \nand have similar object definition with as less work as possible. \nThis helps a lot during debugging, logging, \nin failed test cases with randomly generated data, etc.\n2. In case of signature change \nmethod should handle this automatically for simple cases \nlike renaming/removing/changing order of parameters.\n\nThis can be done like\n```python\n>>> from reprit.base import generate_repr\n>>> class DummyContainer:\n... def __init__(self, positional, *variadic_positional, keyword_only, **variadic_keyword):\n... self.positional = positional\n... self.variadic_positional = variadic_positional\n... self.keyword_only = keyword_only\n... self.variadic_keyword = variadic_keyword\n... __repr__ = generate_repr(__init__)\n\n```\nafter that\n```python\n>>> DummyContainer(range(10), 2, 3, keyword_only='some', a={'sample': 42})\nDummyContainer(range(0, 10), 2, 3, keyword_only='some', a={'sample': 42})\n\n```\nor for a class with avoidance of built-in names clash\n& private'ish attributes\n& both\n```python\n>>> from reprit import seekers\n>>> from reprit.base import generate_repr\n>>> class State:\n... def __init__(self, id_, name, zip_):\n... self.id = id_\n... self._name = name\n... self._zip = zip_\n... __repr__ = generate_repr(__init__,\n... field_seeker=seekers.complex_)\n\n```\nafter that\n```python\n>>> State(1, 'Alabama', 36016)\nState(1, 'Alabama', 36016)\n\n```\n\n*Note*: this method doesn't automatically handle changes during runtime \n(e.g. if someone deletes instance field \nor replaces `__init__`/`__new__` method implementation), \nin this case user should update `__repr__` method as well.\n\nDevelopment\n-----------\n\n### Bumping version\n\n#### Preparation\n\nInstall\n[bump2version](https://github.com/c4urself/bump2version#installation).\n\n#### Pre-release\n\nChoose which version number category to bump following [semver\nspecification](http://semver.org/).\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose $CATEGORY\n```\n\nwhere `$CATEGORY` is the target version number category name, possible\nvalues are `patch`/`minor`/`major`.\n\nBump version\n```bash\nbump2version --verbose $CATEGORY\n```\n\nThis will set version to `major.minor.patch-alpha`. \n\n#### Release\n\nTest bumping version\n```bash\nbump2version --dry-run --verbose --tag release\n```\n\nBump version\n```bash\nbump2version --verbose --tag release\n```\n\nThis will set version to `major.minor.patch` and add `Git` tag.\n\n#### Notes\n\nTo avoid inconsistency between branches and pull requests,\nbumping version should be merged into `master` branch as separate pull\nrequest.\n\n### Running tests\n\nPlain:\n- with `CPython`\n ```bash\n python setup.py test\n ```\n- with `PyPy`\n ```bash\n pypy setup.py test\n ```\n\nInside `Docker` container:\n- with `CPython`\n ```bash\n docker-compose --file docker-compose.cpython.yml up\n ```\n- with `PyPy`\n ```bash\n docker-compose --file docker-compose.pypy.yml up\n ```\n\n`Bash` script (e.g. can be used in `Git` hooks):\n- with `CPython`\n ```bash\n ./run-tests.sh\n ```\n or\n ```bash\n ./run-tests.sh cpython\n ```\n\n- with `PyPy`\n ```bash\n ./run-tests.sh pypy\n ```\n\n`PowerShell` script (e.g. can be used in `Git` hooks):\n- with `CPython`\n ```powershell\n .\\run-tests.ps1\n ```\n or\n ```powershell\n .\\run-tests.ps1 cpython\n ```\n- with `PyPy`\n ```powershell\n .\\run-tests.ps1 pypy\n ```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/lycantropos/reprit/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lycantropos/reprit/", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "reprit", "package_url": "https://pypi.org/project/reprit/", "platform": "", "project_url": "https://pypi.org/project/reprit/", "project_urls": { "Download": "https://github.com/lycantropos/reprit/archive/master.zip", "Homepage": "https://github.com/lycantropos/reprit/" }, "release_url": "https://pypi.org/project/reprit/0.1.0/", "requires_dist": null, "requires_python": ">=3.5.3", "summary": "Auto __repr__ method generation.", "version": "0.1.0" }, "last_serial": 5970914, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "317ed23808c56ef5088e200b6cbc0acd", "sha256": "607e5055380599cababea06994a481c2f03e6c84c3e9ee110a93f384c5f3c422" }, "downloads": -1, "filename": "reprit-0.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "317ed23808c56ef5088e200b6cbc0acd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5026, "upload_time": "2019-02-22T12:16:17", "url": "https://files.pythonhosted.org/packages/e8/46/cc8afbad3acc65c9f6866af488341bcc74c8c404fe68fc83563bedf06b35/reprit-0.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec73782ae662ba17fbae6e1df2f9d212", "sha256": "4da2d3a7a9ff7e0c4c7abf58b1fd20b97525662edc494d49a52706cfef3c6b55" }, "downloads": -1, "filename": "reprit-0.0.0.tar.gz", "has_sig": false, "md5_digest": "ec73782ae662ba17fbae6e1df2f9d212", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 4278, "upload_time": "2019-02-22T12:16:19", "url": "https://files.pythonhosted.org/packages/b6/26/ec453c47294bdce1fe737fef8cb0d3cf0366b5ed23cb912af82c508c24a5/reprit-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "1504192f50571db4921965e7840bfeec", "sha256": "aebf2aaea802e9d10c282514c7c78fb21b45e13516b353fe6a4e87351b67c7ff" }, "downloads": -1, "filename": "reprit-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1504192f50571db4921965e7840bfeec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6333, "upload_time": "2019-03-01T11:06:14", "url": "https://files.pythonhosted.org/packages/4a/25/4bcfc7a1bf8b82085544705748e37e91560d158cdea290b1fef3ff76c616/reprit-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f542ec6e53c9459fc23b8668d4a92d0a", "sha256": "9a3c4dfeddb7588c434f9fa57a9819348f9e0b12151db7e386b33a5f43481e59" }, "downloads": -1, "filename": "reprit-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f542ec6e53c9459fc23b8668d4a92d0a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 5173, "upload_time": "2019-03-01T11:06:15", "url": "https://files.pythonhosted.org/packages/e8/f9/738d2822333f3c099e7e3349ffe55bcceb6188238b03bfa9563a012d2f2e/reprit-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "ef822f4ad0487b46cb25d9aa665e2b73", "sha256": "be0622ec39778eb1339016a52ad849053af4182f372b38464d4205f6e75831b1" }, "downloads": -1, "filename": "reprit-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ef822f4ad0487b46cb25d9aa665e2b73", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.3", "size": 6893, "upload_time": "2019-10-14T10:59:24", "url": "https://files.pythonhosted.org/packages/7a/b1/91544aea338e07f32e5d0163c3d75769486d421e08cbd8bf61cc7420ec3d/reprit-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "298eb1f0b514ed65b2d5f2e64d2164cf", "sha256": "3871954cdd8aeb197db99a5fc2cb9b03bb7b19a1d7fc84dd12f29cbcbc0d38cf" }, "downloads": -1, "filename": "reprit-0.1.0.tar.gz", "has_sig": false, "md5_digest": "298eb1f0b514ed65b2d5f2e64d2164cf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.3", "size": 5796, "upload_time": "2019-10-14T10:59:25", "url": "https://files.pythonhosted.org/packages/5f/ce/8114acea97f5a5663500fbaa1159341322ab7aa97b0f9a75b0faf406e36d/reprit-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ef822f4ad0487b46cb25d9aa665e2b73", "sha256": "be0622ec39778eb1339016a52ad849053af4182f372b38464d4205f6e75831b1" }, "downloads": -1, "filename": "reprit-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ef822f4ad0487b46cb25d9aa665e2b73", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.3", "size": 6893, "upload_time": "2019-10-14T10:59:24", "url": "https://files.pythonhosted.org/packages/7a/b1/91544aea338e07f32e5d0163c3d75769486d421e08cbd8bf61cc7420ec3d/reprit-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "298eb1f0b514ed65b2d5f2e64d2164cf", "sha256": "3871954cdd8aeb197db99a5fc2cb9b03bb7b19a1d7fc84dd12f29cbcbc0d38cf" }, "downloads": -1, "filename": "reprit-0.1.0.tar.gz", "has_sig": false, "md5_digest": "298eb1f0b514ed65b2d5f2e64d2164cf", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.3", "size": 5796, "upload_time": "2019-10-14T10:59:25", "url": "https://files.pythonhosted.org/packages/5f/ce/8114acea97f5a5663500fbaa1159341322ab7aa97b0f9a75b0faf406e36d/reprit-0.1.0.tar.gz" } ] }