Deescovery
Deescovery is a Python package to find and initialize modules of your Python projects on startup.
- Find and register blueprints in a Flask project.
- Automatically initialize Flask extensions.
- Find all SQLAlchemy models to make alembic happy.
- Find all FastAPI endpoints.
- Collect all Celery tasks.
Initially designed to initialize Flask applications, it was made generic enough to work with any micro-framework or no framework at all.
Micro-framework initialization problem
Micro-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.
The Application Factory Pattern, proposed, for example, in the official Flask documentation, and the Flask Mega-Tutorial, legitimize this approach.
The nature of create_app() leaves no place for the open-closed principle. We update this module every time we add a new plug-in, a new blueprint, or a new package.
# myproject/__init__.py
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(config_class)
db.init_app(app)
migrate.init_app(app, db)
login.init_app(app)
mail.init_app(app)
bootstrap.init_app(app)
moment.init_app(app)
babel.init_app(app)
from myproject.errors import bp as errors_bp
app.register_blueprint(errors_bp)
from myproject.auth import bp as auth_bp
app.register_blueprint(auth_bp, url_prefix='/auth')
return app
A common Flask application. The code is based on the Flask Mega-Tutorial.
With deescovery, you can make the same code shorter, and remove the dependencies from implementation details.
# file: myproject/app.py
from flask import Flask
from deescovery import discover
from deescovery.flask import get_flask_rules
def create_app():
flask_app = Flask(__name__)
flask_app.config.from_object("myproject.config")
discover("myproject", get_flask_rules("myproject", flask_app))
return flask_app
Read more
Metadata
Release files for deescovery 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deescovery-1.1.0.tar.gz | 9.9 kB | Without provenance | Details for deescovery-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deescovery-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for deescovery-1.1.0-py3-none-any.whl |
Total release size: 18.9 kB
Release files / deescovery-1.1.0.tar.gz
| Download URL | deescovery-1.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7ff1ec18d3a99fd1629ee69827c9a2da113cba34e46b436f383fd76caea2037
|
|
BLAKE2b-256 checksum How to use checksums |
82efd39c5a8d5df61c71ef8eb83bcae23738bf9cae6f87933f9afdf9c951bbbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.0
|
Release files / deescovery-1.1.0-py3-none-any.whl
| Download URL | deescovery-1.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f5b9faea09fac816e40b5fbd72d24015b74325e9975e9a34e915e1fba325e22
|
|
BLAKE2b-256 checksum How to use checksums |
87b6f81abb0873dae7d871a43f8178cf2a952cb1bc1f61cc6d8d1f47d1b7f66a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.0
|
Security for deescovery 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.