{"id":13936563,"url":"https://github.com/grappa-py/grappa","last_synced_at":"2026-01-14T09:36:28.931Z","repository":{"id":56152869,"uuid":"81199115","full_name":"grappa-py/grappa","owner":"grappa-py","description":"Behavior-oriented, expressive, human-friendly Python assertion library for the 21st century","archived":false,"fork":false,"pushed_at":"2021-01-21T09:29:30.000Z","size":222,"stargazers_count":134,"open_issues_count":10,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-28T03:25:59.536Z","etag":null,"topics":["assertion-library","assertions","bdd","bdd-style","behavior-driven-development","declarative","expressive","python","testing"],"latest_commit_sha":null,"homepage":"http://grappa.rtfd.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grappa-py.png","metadata":{"files":{"readme":"README.rst","changelog":"History.rst","contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-07T11:04:41.000Z","updated_at":"2024-09-05T11:56:24.000Z","dependencies_parsed_at":"2022-08-15T13:40:46.278Z","dependency_job_id":null,"html_url":"https://github.com/grappa-py/grappa","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/grappa-py/grappa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grappa-py%2Fgrappa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grappa-py%2Fgrappa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grappa-py%2Fgrappa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grappa-py%2Fgrappa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grappa-py","download_url":"https://codeload.github.com/grappa-py/grappa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grappa-py%2Fgrappa/sbom","scorecard":{"id":443942,"data":{"date":"2025-08-11","repo":{"name":"github.com/grappa-py/grappa","commit":"f1861e1572e68f031977e86a5d9eba1957bd164e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":3,"reason":"Found 3/9 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-package.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/grappa-py/grappa/python-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/grappa-py/grappa/python-package.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/python-package.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/grappa-py/grappa/python-package.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:50","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:51","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T06:14:11.727Z","repository_id":56152869,"created_at":"2025-08-19T06:14:11.727Z","updated_at":"2025-08-19T06:14:11.727Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertion-library","assertions","bdd","bdd-style","behavior-driven-development","declarative","expressive","python","testing"],"created_at":"2024-08-07T23:02:47.529Z","updated_at":"2026-01-14T09:36:28.915Z","avatar_url":"https://github.com/grappa-py.png","language":"Python","readme":".. image:: http://i.imgur.com/kKZPYut.jpg\n   :width: 100%\n   :alt: grappa logo\n   :align: center\n\n\n|Build Status| |PyPI| |Coverage Status| |Documentation Status| |Stability| |Quality| |Versions| |SayThanks|\n\nAbout\n-----\n\n``grappa`` is a behavior-oriented, self-declarative, expressive and developer-friendly\nlightweight assertion library for Python_ that aims to make testing more productive and frictionless for humans.\n\n``grappa`` comes with two declarative `assertion styles`_: ``expect`` and ``should``.\n\nIt also comes with a detailed, human-friendly `error reporting`_ system that aims to reduce friction,\nprovide better feedback and improve human speed and agility while identifying and fixing errors.\n\nTo get started, take a look to the `showcase`_ code, `getting started`_, available `plugins`_ and operators documentation (`accessors`_, `attributes`_, `matchers`_).\n\nFor HTTP protocol assertions, see `grappa-http`_.\n\nStatus\n------\n\n``grappa`` is considered **stable** software, however it's not mature, widely used software. \nNew features may be added from time to time or minor bugs may be experienced.\n\nCommunity contributions and bug reports are very welcome.\n\nShowcase\n--------\n\nA small example demonstrating some `grappa` features.\nSee `documentation`_ and `getting started`_ for more examples.\n\n.. code-block:: python\n\n    from grappa import should\n\n    True | should.be.true\n    False | should.be.false\n    None | should.be.none\n\n    '' | should.be.empty\n    [] | should.be.empty\n    'foo' | should.exists\n\n    3.14 | should.be.lower.than(4)\n    3.14 | should.be.higher.than(3)\n    3.14 | should.be.within(2, 4)\n\n    'bar' | should.be.equal.to('bar', msg='value is not \"bar\"')\n    [1, 2, 3] | should.be.equal.to([1, 2, 3])\n\n    'hello, grappa' | should.startswith('hello')\n    'hello, grappa' | should.endswith('grappa')\n    [1, 2, 3, 4] | should.startswith(1)\n    [1, 2, 3, 4] | should.endswith(4)\n\n    'Hello grappa' | should.match('(\\W)+ grappa$')\n    'Hello grappa' | should.contain('grappa') | should.contain('he')\n    ['foo', 'bar'] | should.contain('foo') | should.do_not.contain('baz')\n\n    'foo' | should.be.a('string')\n    {'foo': True} | should.be.a('dict')\n\n    iter([1, 2, 3]) | should.have.length.of(3)\n    [1, 2, 3] | should.be.a('list') \u003e should.have.length.of(3)\n\n    (lambda x: x) | should.be.callable\n    (lambda x: x) | should.not_have.type.of('generator')\n\n    'foo' | should.pass_test(lambda x: x in 'foo bar')\n    'foo' | should.pass_function(lambda x: len(x) \u003e 2)\n\n    (lambda: x) | should.raises(NameError)\n    (lambda: x) | should.does_not.raises(RuntimeError)\n\n    {'foo': 'bar'} | should.have.key('foo').that.should.be.equal('bar')\n    (1, 2, 3, 4) | should.be.a(tuple) \u003e should.have.index.at(3) \u003e should.be.equal.to(4)\n\n    an_object | should.have.properties('foo', 'bar', 'baz')\n    an_object | should.implement.methods('foo', 'bar', 'baz')\n\n    {'foo': True, 'bar': False} | should.all(should.have.key('foo'), should.have.key('bar'))\n    {'foo': True, 'bar': False} | should.any(should.have.key('foo'), should.have.key('baz'))\n\n    ({'bar': [1, 2, 3]}\n        | should.have.key('bar')\n        \u003e should.be.a('list')\n        \u003e should.have.length.of(3)\n        \u003e should.contain.item(3)\n        \u003e should.have.index.at(1)\n        \u003e should.be.equal.to(2))\n\n    with should('foo'):\n        should.be.a(str)\n        should.have.length.of(3)\n        should.be.equal.to('foo')\n\n\nLet's see how the error report looks like in ``grappa`` running in ``pytest``.\n\nSee `error reporting`_ documentation for more details about how ``grappa`` error report system works.\n\n.. code-block:: bash\n\n    ======================================================================\n    FAIL: tests.should_test.test_grappa_assert\n    ======================================================================\n    The following assertion was not satisfied\n      subject \"[1, 2, 3]\" should be have length of \"4\"\n\n    Message\n      subject list must have at least 4 items\n\n    Reasons\n      ▸ unexpected object length: 3\n\n    What we expected\n      an object that can be length measured and its length is equal to 4\n\n    What we got instead\n      an object of type \"list\" with length 3\n\n    Information\n      ▸ Object length is measured by using \"len()\" built-in\n        Python function or consuming an lazy iterable, such as a\n        generator. Most built-in types and objects in Python\n        can be tested that way, such as str, list, tuple, dict...\n        as well as any object that implements \"__len__()\" method.\n        — Reference: https://docs.python.org/3/library/functions.html#len\n\n    Where\n      File \"grappa/tests/should_test.py\", line 16, in test_grappa_assert\n\n     8|\n     9|  def test_native_assert():\n    10|      x = [1, 2, 3]\n    11|      assert len(x) == 4\n    12|\n    13|\n    14|  def test_grappa_assert():\n    15|      x = [1, 2, 3]\n    16| \u003e    x | should.be.have.length.of(4)\n    17|\n    18|\n    19|  def test_bool():\n    20|      True | should.be.true | should.be.present\n    21|      False | should.be.false | should.be.equal.to(False)\n    22|      False | should.be.false | should.not_be.equal.to(True)\n\n\nWhy grappa?\n-----------\n\n``grappa`` aims to assist humans while doing a very recurrent and not very fun task in software development: testing things.\n\nThe core idea behind ``grappa`` comes from the fact that human time is considerably more expensive than machine time,\nand therefore any machine assistance to optimize processes and close the gap is beneficial.\n\nWith ``grappa`` you can express almost in plain English what the test contract actually is, but in a way that's\nfun and easy to write but also more easy and pleasant to read or maintain by other developers.\n\n\nThe Zen of grappa\n-----------------\n\n- Testing is about feedback: detailed, easy to understand, human-friendly is always better.\n- Frictionless testing: introducing self-declarative behavior testing patterns can make testing more fun for test writers and more enjoyable for test readers.\n- Expressivity is paramount: humans should easily understand what the code is doing.\n- Human time is expensive: any modern software should assist people to identify and understand errors easily.\n- Make error reporting great again: feedback during testing is key, let's make it more handy and less frustrating.\n- Testing patterns consolidation: software expectations are limited to the boundaries of language data types and structures.\n- Hurt less feelings: seeing errors is not a nice thing, but it can be painless if details are showed you in a more gentle way.\n\n\nFeatures\n--------\n\n-  Behavior-oriented expressive fluent API.\n-  Built-in assertion DSL with English lexicon and semantics.\n-  Supports both ``expect`` and ``should`` assertion styles.\n-  Full-featured built-in `accessors`_, `attributes`_ and `matchers`_ operators.\n-  Human-friendly and detailed `error reporting`_.\n-  Built-in expectations difference comparison between subject and expected values.\n-  Extensible assertions supporting third-party `plugins`_.\n-  Assertion chaining and composition.\n-  Composable assertion via logical operators such as ``and`` \u0026 ``or``.\n-  Testing framework agnostic. Works with ``unittest``, ``nosetests``, ``pytest``, ``behave`` ...\n-  Easy to hack via programmatic API.\n-  Lightweight and (almost) dependency-free.\n-  Works with Python 2.7+, 3+, PyPy and potentially with other Python implementations.\n\n\nInstallation\n------------\n\nUsing ``pip`` package manager:\n\n.. code-block:: bash\n\n    pip install --upgrade grappa\n\nOr install the latest sources from Github:\n\n.. code-block:: bash\n\n    pip install -e git+git://github.com/grappa-py/grappa.git#egg=grappa\n\n\n.. _Python: http://python.org\n.. _`documentation`: http://grappa.readthedocs.io\n.. _`accessors`: http://grappa.readthedocs.io/en/latest/accessors-operators.html\n.. _`attributes`: http://grappa.readthedocs.io/en/latest/attributes-operators.html\n.. _`matchers`: http://grappa.readthedocs.io/en/latest/matchers-operators.html\n.. _`getting started`: http://grappa.readthedocs.io/en/latest/getting-started.html\n.. _`plugins`: http://grappa.readthedocs.io/en/latest/plugins.html\n.. _`error reporting`: http://grappa.readthedocs.io/en/latest/error-reporting.html\n.. _`assertion styles`: http://grappa.readthedocs.io/en/latest/style.html\n.. _`grappa-http`: https://github.com/grappa-py/http\n\n.. |Build Status| image:: https://travis-ci.org/grappa-py/grappa.svg?branch=master\n   :target: https://travis-ci.org/grappa-py/grappa\n.. |PyPI| image:: https://img.shields.io/pypi/v/grappa.svg?maxAge=2592000?style=flat-square\n   :target: https://pypi.python.org/pypi/grappa\n.. |Coverage Status| image:: https://coveralls.io/repos/github/grappa-py/grappa/badge.svg?branch=master\n   :target: https://coveralls.io/github/grappa-py/grappa?branch=master\n.. |Documentation Status| image:: https://readthedocs.org/projects/grappa/badge/?version=latest\n   :target: http://grappa.readthedocs.io/en/latest/?badge=latest\n.. |Quality| image:: https://codeclimate.com/github/grappa-py/grappa/badges/gpa.svg\n   :target: https://codeclimate.com/github/grappa-py/grappa\n   :alt: Code Climate\n.. |Stability| image:: https://img.shields.io/pypi/status/grappa.svg\n   :target: https://pypi.python.org/pypi/grappa\n   :alt: Stability\n.. |Versions| image:: https://img.shields.io/pypi/pyversions/grappa.svg\n   :target: https://pypi.python.org/pypi/grappa\n   :alt: Python Versions\n.. |SayThanks| image:: https://img.shields.io/badge/Say%20Thanks!-%F0%9F%A6%89-1EAEDB.svg\n   :target: https://saythanks.io/to/h2non\n   :alt: Say Thanks\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrappa-py%2Fgrappa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrappa-py%2Fgrappa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrappa-py%2Fgrappa/lists"}