Metadata-Version: 2.1
Name: auto-blueprints
Version: 0.1.0
Summary: Flask blueprints auto discovery
Author-email: David <c0d3@gpobox.net>
Maintainer-email: David <c0d3@gpobox.net>
License: Copyright © 2024 David <c0d3@gpobox.net>
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
        associated documentation files (the “Software”), to deal in the Software without restriction,
        including without limitation the rights to use, copy, modify, merge, publish, distribute,
        sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or
        substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
        BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
        DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/bbc6502/blueprints
Project-URL: Bug Tracker, https://github.com/bbc6502/blueprints/issues
Keywords: flask,blueprints
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: Flask >=3.0.0
Provides-Extra: waitress
Requires-Dist: waitress >=3.0.0 ; extra == 'waitress'

# Blueprints

Blueprints is a library to perform auto-discovery of Flask blueprints
by scanning the installed packages for blueprints.txt files.

## Discovery

Discovery of blueprints is performed by the register_blueprints method.
All discovered blueprints are stored in a blueprints attribute of the blueprints package.
The attribute is a dictionary containing the blueprint name and associated meta data.

If a blueprint has the url_prefix specified then it is used.
Otherwise, the package name containing the blueprint is used as the url_prefix.

## Running

Blueprints can be run as a module.

    python -m blueprints

If waitress is installed then a server using waitress is started.
If waitress is not installed then the flask development server is started.

## Embedding

Blueprints can be embedded in an existing program very simply.

    from flask import Flask
    from blueprints import register_blueprints
    app = Flask(__name__)
    register_blueprints('blueprints.txt', app)
    app.run()

## blueprints.txt format

The blueprints.txt file is a multi-line file containing one line per blueprint to import.
The structure of the line is <package>.<module>.<blueprint>.

    hello.entry.bp  => imports hello.entry and retrieves the bp attribute containing a flask blueprint

## License

MIT Licensed
