<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup(sphinx):
 """Setup Sphinx object."""

    from flask import has_app_context
    from invenio_base.factory import create_app
    PACKAGES = ['invenio_base', 'invenio.modules.accounts',
                'invenio.modules.records', 'invenio_knowledge']

    if not has_app_context():
        app = create_app(PACKAGES=PACKAGES)
        ctx = app.test_request_context('/')
        ctx.push()