{ "info": { "author": "Emmanuel Leblond", "author_email": "emmanuel.leblond@{nospam}gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": ".. image:: https://travis-ci.org/touilleMan/samarche.svg?branch=master\r\n :target: https://travis-ci.org/touilleMan/samarche\r\n :alt: Travis-CI\r\n\r\nSamarche\r\n========\r\n\r\nAPI checker inspired by `this\r\npost `__\r\n\r\nQuickstart\r\n----------\r\n\r\nSay you're developping a module with a public API, for people working\r\nwith it, this API is supposed to stay the same until the next major\r\nrelease. What would happen if a commit makes a change it shouldn't have\r\n?\r\n\r\nThe solution is testing :\r\n\r\n.. code:: python\r\n\r\n # A class which is part of your API\r\n class Foo:\r\n bar = True\r\n def __init__(self, stuff=False):\r\n self.stuff\r\n \r\n def thing(self):\r\n return \"doh\"\r\n \r\n # Your tests to make sure the class stays consistent\r\n self.assertTrue(hasattr(Foo, 'bar'))\r\n self.assertTrue(hasattr(Foo, 'thing'))\r\n self.assertTrue(hasattr(Foo(), 'stuff'))\r\n\r\nUnfortunatly those tests are basically writting all your API a second\r\ntime, there must be a better (and less boring) way !\r\n\r\nSamarche allow you to take a snapshop of your API (called a\r\n``signature``) and then be able to test your evolving codebase against\r\nit.\r\n\r\nSamarche register only public members (i.e. everything starting by ``_``\r\nis skipped) You can create signatures from a ``module``,\r\n``module.package`` and even ``module.package:package_attribute``\r\n\r\nExample\r\n-------\r\n\r\nFirst build and save the signature of your API:\r\n\r\n.. code:: python\r\n\r\n # Do this at each major release\r\n import samarche\r\n\r\n signature = samarche.build_signature(\"my_api\")\r\n with open('my_api.signature', 'wb') as fd:\r\n samarche.dump(signature, f)\r\n\r\nThen put somewhere in your tests\r\n\r\n.. code:: python\r\n\r\n with open('my_api.signature', 'rb') as fd:\r\n original_signature = samarche.load(fd)\r\n try:\r\n samarche.check_signature('my_api', original_signature)\r\n except samarche.ValidationError as e:\r\n print(\"API has changed : {}\".format(e))", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/touilleMan/samarche/tarball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/touilleMan/samarche", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "samarche", "package_url": "https://pypi.org/project/samarche/", "platform": "any", "project_url": "https://pypi.org/project/samarche/", "project_urls": { "Download": "https://github.com/touilleMan/samarche/tarball/master", "Homepage": "https://github.com/touilleMan/samarche" }, "release_url": "https://pypi.org/project/samarche/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Samarche for testing your public api against regression !", "version": "0.0.1" }, "last_serial": 1608246, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "55fd8901715a10d90e78838db10d0e3b", "sha256": "030b9c323b66635bece1411667a6a76e672a6167f38ad25747c503190a93e1d5" }, "downloads": -1, "filename": "samarche-0.0.1-py3.4.egg", "has_sig": false, "md5_digest": "55fd8901715a10d90e78838db10d0e3b", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 1111, "upload_time": "2015-05-01T20:10:54", "url": "https://files.pythonhosted.org/packages/56/7f/1bd3a6a0149b595d0a7425b73a0320b3ae2bfe7cb8ab5dec71bbcf2b8237/samarche-0.0.1-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "590520bf540c5d0bc476918b46f57a8b", "sha256": "0e8c46c6ded169b2d33f295ac4f4e5a99a7d8edb6a42babfcebd684eaf46b3bd" }, "downloads": -1, "filename": "samarche-0.0.1.tar.gz", "has_sig": false, "md5_digest": "590520bf540c5d0bc476918b46f57a8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3844, "upload_time": "2015-05-01T20:10:57", "url": "https://files.pythonhosted.org/packages/15/42/a3166ff99a90f0fac2bcccc231080e7bd07932530e6088710c91ad473f72/samarche-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "55fd8901715a10d90e78838db10d0e3b", "sha256": "030b9c323b66635bece1411667a6a76e672a6167f38ad25747c503190a93e1d5" }, "downloads": -1, "filename": "samarche-0.0.1-py3.4.egg", "has_sig": false, "md5_digest": "55fd8901715a10d90e78838db10d0e3b", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 1111, "upload_time": "2015-05-01T20:10:54", "url": "https://files.pythonhosted.org/packages/56/7f/1bd3a6a0149b595d0a7425b73a0320b3ae2bfe7cb8ab5dec71bbcf2b8237/samarche-0.0.1-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "590520bf540c5d0bc476918b46f57a8b", "sha256": "0e8c46c6ded169b2d33f295ac4f4e5a99a7d8edb6a42babfcebd684eaf46b3bd" }, "downloads": -1, "filename": "samarche-0.0.1.tar.gz", "has_sig": false, "md5_digest": "590520bf540c5d0bc476918b46f57a8b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3844, "upload_time": "2015-05-01T20:10:57", "url": "https://files.pythonhosted.org/packages/15/42/a3166ff99a90f0fac2bcccc231080e7bd07932530e6088710c91ad473f72/samarche-0.0.1.tar.gz" } ] }