{"id":19774014,"url":"https://github.com/authomatic/liveandletdie","last_synced_at":"2025-12-18T01:23:08.958Z","repository":{"id":47968778,"uuid":"11795513","full_name":"authomatic/liveandletdie","owner":"authomatic","description":"Simple utility for running web framework development servers for BDD/functional testing purposes.","archived":false,"fork":false,"pushed_at":"2023-06-12T09:56:16.000Z","size":212,"stargazers_count":21,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T13:06:00.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/authomatic.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2013-07-31T16:30:48.000Z","updated_at":"2023-06-09T12:00:29.000Z","dependencies_parsed_at":"2022-08-12T15:31:10.604Z","dependency_job_id":null,"html_url":"https://github.com/authomatic/liveandletdie","commit_stats":{"total_commits":148,"total_committers":5,"mean_commits":29.6,"dds":0.2432432432432432,"last_synced_commit":"59fc72961cb29086d7e2195912f2516f4349b8f6"},"previous_names":["peterhudec/liveandletdie","peterhudec/testliveserver"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/authomatic/liveandletdie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authomatic%2Fliveandletdie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authomatic%2Fliveandletdie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authomatic%2Fliveandletdie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authomatic%2Fliveandletdie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authomatic","download_url":"https://codeload.github.com/authomatic/liveandletdie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authomatic%2Fliveandletdie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272077715,"owners_count":24869294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-12T05:11:44.998Z","updated_at":"2025-12-18T01:23:03.901Z","avatar_url":"https://github.com/authomatic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"================\nLive and Let Die\n================\n\n.. image:: https://github.com/authomatic/liveandletdie/actions/workflows/main.yml/badge.svg\n    :target: https://github.com/authomatic/liveandletdie/actions/\n\n**Live and Let Die** simplifies launching and terminating of web development\nservers from **BDD** or **functional** tests. I have created it for functional\ntesting of the `Authomatic \u003cpeterhudec.github.io/authomatic/\u003e`_ package.\n\nThe package Currently supports **Google App engine**, **Django**,\n**Flask** and **wsgiref.simple_server**. Support for other frameworks will\nhopefully be added in future.\n\nUsage\n-----\n\nYou first need to make instance of one of the framework classes.\n\nDjango\n^^^^^^\n\n.. code-block:: python\n\n    import liveandletdie\n\n    # Django\n    app = liveandletdie.Django('path/to/django/project/',\n                               host='0.0.0.0',\n                               port=5555)\n\nGoogle App Engine\n^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    import liveandletdie\n\n    app = liveandletdie.GAE('path/to/dev_appserver.py',\n                            'path/to/gae/app/dir', # containing app.yaml file\n                            host='0.0.0.0',\n                            port=5555)\n\nFlask\n^^^^^\n\nBy **Flask** you must wrap the **WSGI application** in\n``liveandletdie.Flask.wrap(app)``.\n\nIf you set the ``ssl`` keyword argument to ``True``, the app will be run with\n``ssl_context=\"adhoc\"`` and the schema of the ``self.check_url``\nwill be ``\"https\"``.\n\n.. note::\n\n    If you are struggling with installation of\n    `pyOpenSSL \u003chttps://pypi.python.org/pypi/pyOpenSSL\u003e`__ on OSX due to\n    ``'ffi.h' file not found`` error during installation of the\n    `cryptography \u003chttps://pypi.python.org/pypi/cryptography/0.7.2\u003e`__\n    dependency, try the solution from this\n    `Stackoverflow question \u003chttp://stackoverflow.com/questions/22875270/error-installing-bcrypt-with-pip-on-os-x-cant-find-ffi-h-libffi-is-installed\u003e`__:\n\n    .. code-block:: bash\n\n        $ brew install pkg-config libffi\n        $ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/\n        $ pip install pyopenssl\n\n.. code-block:: python\n\n    # flask/app/main.py\n    from flask import Flask\n\n    DEBUG = True\n    SECRET_KEY = 'development key'\n    USERNAME = 'admin'\n    PASSWORD = 'default'\n\n    app = Flask(__name__)\n    app.config.from_object(__name__)\n\n    @app.route('/')\n    def home():\n        return 'Hello World!'\n\n    if __name__ == '__main__':\n\n        # This does nothing unless you run this module with --liveandletdie flag.\n        import liveandletdie\n        liveandletdie.Flask.wrap(app)\n\n        app.run()\n\n\n.. code-block:: python\n\n    import liveandletdie\n\n    app = liveandletdie.Flask('path/to/flask/app/main.py',\n                              host='0.0.0.0',\n                              port=5555)\n\nPyramid (wsgiref.simple_server)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nBy ``wsgiref.simple_server`` you must wrap the **WSGI application** in\n``liveandletdie.WsgirefSimpleServer.wrap(app)``.\n\nIf you set the ``ssl`` keyword argument to ``True``, the app will be run with\na self-signed certificate, and the schema of the ``self.check_url``\nwill be ``\"https\"``.\n\n.. code-block:: python\n\n    # pyramid/app/main.py\n    from wsgiref.simple_server import make_server\n\n    from pyramid.config import Configurator\n    from pyramid.response import Response\n\n\n    def home(request):\n        return Response('Hello World!')\n\n\n    if __name__ == '__main__':\n\n        config = Configurator()\n        config.add_route('home', '/')\n        config.add_view(home, route_name='home')\n        app = config.make_wsgi_app()\n\n        # This does nothing unless you run this module with --liveandletdie flag.\n        import liveandletdie\n        liveandletdie.WsgirefSimpleServer.wrap(app)\n\n        server = make_server('127.0.0.1', 8080, app)\n        server.serve_forever()\n\n\n.. code-block:: python\n\n    import liveandletdie\n\n    app = liveandletdie.Flask('path/to/pyramid/app/main.py',\n                              host='0.0.0.0',\n                              port=5555)\n\nUsing the App instance\n^^^^^^^^^^^^^^^^^^^^^^\n\nThe interface is the same for all of the supported frameworks.\n\n.. code-block:: python\n\n    # Start the app.\n    # If kill_port is True,\n    # it will kill any process listening on port 5555\n    process = app.live(kill_port=True)\n\n    # You can check whether it is running\n    is_running = app.check()\n\n    # Stop it\n    app.die()\n\nSimple UnitTest example:\nhttps://github.com/peterhudec/liveandletdie/blob/master/test_examples/unittest_example/tests.py\n\nSimple PyTest example:\nhttps://github.com/peterhudec/liveandletdie/blob/master/test_examples/pytest_example/tests.py\n\nSimple Lettuce example:\nhttps://github.com/peterhudec/liveandletdie/blob/master/test_examples/lettuce_example/tests.py\n\nDebugging\n---------\n\nIf an app refuses to start on the ``app.live()`` call, it throws a\n``LiveAndLetDieError`` with a message::\n\n    Flask server https://127.0.0.1:5555 didn't start in specified timeout 10.0 seconds!\n    command: python sample_apps/flask/main.py --liveandletdie 127.0.0.1:5555\n\nTo find out more about why the app didn't start run the command provided in the\nerror message manually:\n\n.. code-block:: bash\n\n    $ python sample_apps/flask/main.py --liveandletdie 127.0.0.1:5555\n\nDevelopers\n----------\n\nClone:\n\n::\n\n    $ git clone https://github.com/peterhudec/liveandletdie.git\n\nBootstrap the development environment.\nThis will create the ``./venv`` virtual environment in the project root.\n\n::\n\n    $ sh bootstrap.sh\n\nRun tests:\n\n::\n\n    $ sh run-all.sh\n\nOr bootstrap and run tests in one step:\n\n::\n\n    $ sh bootstrap-and-test.sh\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthomatic%2Fliveandletdie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthomatic%2Fliveandletdie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthomatic%2Fliveandletdie/lists"}