Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use YAML to store extension info #3

Merged
merged 4 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bootstrap-flask.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: test helloflask/bootstrap-flask
name: build

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flask-ckeditor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: test helloflask/flask-ckeditor
name: build

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flask-debugtoolbar.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: test pallets-eco/flask-debugtoolbar
name: build

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flask-login.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: test maxcountryman/flask-login
name: build

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flask-mailman.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: test waynerv/flask-mailman
name: build

on:
push:
Expand Down
52 changes: 42 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,53 @@
# Flask Extension Status

## Extension health dashboard
*Let's hope the CI of this repository will pass someday.*

It's a status dashboard for Flask extension. In the [Extension status](#extension-status) table, each extension has a build badge to show whether it can be built with the latest Flask version. Feel free to add new extensions or update the info of existing extensions (see [How to add an extension?](#how-to-add-an-extension) for details)

For a project that is not maintained anymore, we will list them in the [Unmaintained extension and alternatives](#unmaintained-extension-and-alternatives) section and provide some alternatives. If you have a extension but don't have time to maintain it, you can consider donating it to the [pallets-eco organzation](https://github.com/pallets-eco).

Want to help a Flask extension? Check the [What can I do to help?](#what-can-i-do-to-help) section. Let's make Flask ecosystem better together!

## Extension status

<!-- TABLE_START -->

| Extension | Latest PyPI version | PyPI downloads/month | Build with Flask 3.x |
| --------- | -------------------- | -------------------- | -------------------- |
| [helloflask/bootstrap-flask](https://github.com/helloflask/bootstrap-flask) | ![PyPI - Version](https://img.shields.io/pypi/v/bootstrap-flask) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/bootstrap-flask?color=black) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/bootstrap-flask.yml/badge.svg) |
| [helloflask/flask-ckeditor](https://github.com/helloflask/flask-ckeditor) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-ckeditor) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-ckeditor?color=black) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-ckeditor.yml/badge.svg) |
| [pallets-eco/flask-debugtoolbar](https://github.com/pallets-eco/flask-debugtoolbar) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-debugtoolbar) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-debugtoolbar?color=black) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-debugtoolbar.yml/badge.svg) |
| [maxcountryman/flask-login](https://github.com/maxcountryman/flask-login) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-login) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-login?color=black) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-login.yml/badge.svg) |
| [waynerv/flask-mailman](https://github.com/waynerv/flask-mailman) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-mailman) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-mailman?color=black) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-mailman.yml/badge.svg) |
| Extension Repository | Latest version | Downloads | Build with latest Flask (3.x) |
| -------------------- | --------------- | ---------- | ----------------------------- |
| [helloflask/bootstrap-flask](https://github.com/helloflask/bootstrap-flask) | ![PyPI - Version](https://img.shields.io/pypi/v/bootstrap-flask) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/bootstrap-flask?color=darkgrey) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/bootstrap-flask.yml/badge.svg) |
| [helloflask/flask-ckeditor](https://github.com/helloflask/flask-ckeditor) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-ckeditor) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-ckeditor?color=darkgrey) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-ckeditor.yml/badge.svg) |
| [pallets-eco/flask-debugtoolbar](https://github.com/pallets-eco/flask-debugtoolbar) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-debugtoolbar) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-debugtoolbar?color=darkgrey) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-debugtoolbar.yml/badge.svg) |
| [maxcountryman/flask-login](https://github.com/maxcountryman/flask-login) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-login) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-login?color=darkgrey) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-login.yml/badge.svg) |
| [waynerv/flask-mailman](https://github.com/waynerv/flask-mailman) | ![PyPI - Version](https://img.shields.io/pypi/v/flask-mailman) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/flask-mailman?color=darkgrey) | ![build](https://github.com/greyli/flask-extension-status/actions/workflows/flask-mailman.yml/badge.svg) |

<!-- TABLE_END -->

## About this project
## How to add an extension?

Clone the repo and install dependencies:

```bash
git clone https://github.com/greyli/flask-extension-status
cd flask-extension-status
pip install -r requirements.txt
```

Add the extension info to `extensions.yml`:

```yaml
flask-foo:
repo: github_username/repo_name
import_string: 'the import string of your extension'
```

Then run:

```bash
python gen.py
```

Commit and push the changes, then create a pull request.

## What can we do?
## What can I do to help?

## Unmaintained extension and alternatives
16 changes: 16 additions & 0 deletions extensions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# sort by name alphabetically
bootstrap-flask:
repo: helloflask/bootstrap-flask
import_string: 'from flask_bootstrap import Bootstrap5'
flask-ckeditor:
repo: helloflask/flask-ckeditor
import_string: 'from flask_ckeditor import CKEditor'
flask-debugtoolbar:
repo: pallets-eco/flask-debugtoolbar
import_string: 'from flask_debugtoolbar import DebugToolbarExtension'
flask-login:
repo: maxcountryman/flask-login
import_string: 'from flask_login import LoginManager'
flask-mailman:
repo: waynerv/flask-mailman
import_string: 'from flask_mailman import Mail'
27 changes: 13 additions & 14 deletions gen.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
from pathlib import Path

from jinja2 import Template
import yaml

basedir = Path(__file__).parent

extensions = {
'bootstrap-flask': { 'repo': 'helloflask/bootstrap-flask', 'import_string': 'from flask_bootstrap import Bootstrap5'},
'flask-ckeditor': { 'repo': 'helloflask/flask-ckeditor', 'import_string': 'from flask_ckeditor import CKEditor'},
'flask-debugtoolbar': { 'repo': 'pallets-eco/flask-debugtoolbar', 'import_string': 'from flask_debugtoolbar import DebugToolbarExtension'},
'flask-login': {'repo': 'maxcountryman/flask-login', 'import_string': 'from flask_login import LoginManager'},
'flask-mailman': { 'repo': 'waynerv/flask-mailman', 'import_string': 'from flask_mailman import Mail'},
}

workflow_template = """
name: test {{ repo }}
name: build

on:
push:
Expand Down Expand Up @@ -49,15 +42,21 @@
"""

table_header = """
| Extension | Latest PyPI version | PyPI downloads/month | Build with Flask 3.x |
| --------- | -------------------- | -------------------- | -------------------- |"""
| Extension Repository | Latest version | Downloads | Build with latest Flask (3.x) |
| -------------------- | --------------- | ---------- | ----------------------------- |"""

table_row_template = "| [{{ repo }}](https://github.com/{{ repo }}) " \
"| ![PyPI - Version](https://img.shields.io/pypi/v/{{ package_name }}) " \
"| ![PyPI - Downloads](https://img.shields.io/pypi/dm/{{ package_name }}?color=black) " \
"| ![PyPI - Downloads](https://img.shields.io/pypi/dm/{{ package_name }}?color=darkgrey) " \
"| ![build](https://github.com/greyli/flask-extension-status/actions/workflows/{{ package_name }}.yml/badge.svg) |"


def get_extensions():
"""get extensions info from extensions.yml"""
with open(basedir / 'extensions.yml') as f:
return yaml.safe_load(f)


def gen_workflow(package_name, repo, import_string):
template = Template(workflow_template)
return template.render(
Expand All @@ -71,7 +70,7 @@ def update_readme_table():
readme_file = basedir / 'README.md'

new_table = ''
for package_name, info in extensions.items():
for package_name, info in get_extensions().items():
repo = info['repo']
new_table += Template(table_row_template).render(
package_name=package_name,
Expand Down Expand Up @@ -100,7 +99,7 @@ def update_readme_table():


if __name__ == '__main__':
for package_name, info in extensions.items():
for package_name, info in get_extensions().items():
repo = info['repo']
import_string = info['import_string']
workflow = gen_workflow(package_name, repo, import_string)
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
jinja2
pyyaml
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile
Expand All @@ -8,3 +8,5 @@ jinja2==3.1.2
# via -r requirements.in
markupsafe==2.1.3
# via jinja2
pyyaml==6.0.1
# via -r requirements.in
Loading