{"id":15024947,"url":"https://github.com/imankulov/deescovery","last_synced_at":"2025-04-12T12:52:19.500Z","repository":{"id":57418051,"uuid":"364273037","full_name":"imankulov/deescovery","owner":"imankulov","description":"Initialize modules of your Python projects on startup. Discover Flask blueprints, FastAPI endpoints, SQLAlchemy models, etc.","archived":false,"fork":false,"pushed_at":"2022-05-26T20:39:30.000Z","size":429,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T23:15:42.276Z","etag":null,"topics":["autodiscovery","configuration","fastapi","flask","python","settings","sqlalchemy"],"latest_commit_sha":null,"homepage":"https://imankulov.github.io/deescovery/","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/imankulov.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-04T13:54:20.000Z","updated_at":"2025-01-26T14:54:38.000Z","dependencies_parsed_at":"2022-09-03T09:50:38.403Z","dependency_job_id":null,"html_url":"https://github.com/imankulov/deescovery","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankulov%2Fdeescovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankulov%2Fdeescovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankulov%2Fdeescovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankulov%2Fdeescovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imankulov","download_url":"https://codeload.github.com/imankulov/deescovery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571583,"owners_count":21126519,"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","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":["autodiscovery","configuration","fastapi","flask","python","settings","sqlalchemy"],"created_at":"2024-09-24T20:01:15.617Z","updated_at":"2025-04-12T12:52:19.478Z","avatar_url":"https://github.com/imankulov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--intro-start--\u003e\n# Deescovery\n\n**Deescovery** is a Python package to find and initialize modules of your Python projects on startup.\n\n- Find and register blueprints in a Flask project.\n- Automatically initialize Flask extensions.\n- Find all SQLAlchemy models to make alembic happy.\n- Find all FastAPI endpoints.\n- Collect all Celery tasks.\n\nInitially designed to initialize Flask applications, it was made generic enough to work with any micro-framework or no framework at all.\n\n## Micro-framework initialization problem\n\nMicro-framework-based projects are clean while they're small. Every micro-framework codebase I've seen, has a mess in the project initialization. With time, `create_app()` becomes filled with ad-hoc settings, imports-within-functions, and plug-in initializations.\n\nThe Application Factory Pattern, proposed, for example, in the [official Flask documentation](https://flask.palletsprojects.com/en/2.0.x/patterns/appfactories/), and the [Flask Mega-Tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xv-a-better-application-structure), legitimize this approach.\n\nThe nature of `create_app()` leaves no place for the [open-closed principle](https://blog.cleancoder.com/uncle-bob/2014/05/12/TheOpenClosedPrinciple.html). We update this module every time we add a new plug-in, a new blueprint, or a new package.\n\n```python\n# myproject/__init__.py\n\ndef create_app(config_class=Config):\n    app = Flask(__name__)\n    app.config.from_object(config_class)\n\n    db.init_app(app)\n    migrate.init_app(app, db)\n    login.init_app(app)\n    mail.init_app(app)\n    bootstrap.init_app(app)\n    moment.init_app(app)\n    babel.init_app(app)\n\n    from myproject.errors import bp as errors_bp\n    app.register_blueprint(errors_bp)\n\n    from myproject.auth import bp as auth_bp\n    app.register_blueprint(auth_bp, url_prefix='/auth')\n\n    return app\n```\n\n_A common Flask application. The code is based on the Flask Mega-Tutorial._\n\nWith `deescovery`, you can make the same code shorter, and remove the dependencies from implementation details.\n\n```python\n# file: myproject/app.py\nfrom flask import Flask\nfrom deescovery import discover\nfrom deescovery.flask import get_flask_rules\n\n\ndef create_app():\n    flask_app = Flask(__name__)\n    flask_app.config.from_object(\"myproject.config\")\n    discover(\"myproject\", get_flask_rules(\"myproject\", flask_app))\n    return flask_app\n```\n\n\n\u003c!--intro-end--\u003e\n\n## Read more\n\n- [Usage with Flask](https://imankulov.github.io/deescovery/flask/)\n- [Usage with anything else](https://imankulov.github.io/deescovery/anything_else/)\n- [API](https://imankulov.github.io/deescovery/api/deescovery/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimankulov%2Fdeescovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimankulov%2Fdeescovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimankulov%2Fdeescovery/lists"}