Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flask): remove experimental flag for flask-framework extension (#…
Browse files Browse the repository at this point in the history
…522)

Co-authored-by: Tiago Nobrega <[email protected]>
jdkandersson and tigarmo committed May 3, 2024

Verified

This commit was signed with the committer’s verified signature.
tigarmo Tiago Nobrega
1 parent f03bda5 commit 15d45a3
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/reference/rockcraft.yaml.rst
Original file line number Diff line number Diff line change
@@ -259,7 +259,7 @@ Extensions to enable when building the ROCK.

Currently supported extensions:

- ``flask`` (experimental)
- ``flask-framework``

Example
=======
8 changes: 7 additions & 1 deletion rockcraft/extensions/gunicorn.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""An experimental extension for the Gunicorn based Python WSGI application extensions."""
"""An extension for the Gunicorn based Python WSGI application extensions."""
import abc
import ast
import fnmatch
@@ -188,6 +188,12 @@ def framework(self) -> str:
"""Return the wsgi framework name, e.g. flask, django."""
return "flask"

@staticmethod
@override
def is_experimental(base: str | None) -> bool:
"""Check if the extension is in an experimental state."""
return False

@override
def gen_install_app_part(self) -> Dict[str, Any]:
source_files = [f.name for f in sorted(self.project_root.iterdir())]
8 changes: 3 additions & 5 deletions tests/spread/rockcraft/extension-flask/task.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
summary: flask extension test

execute: |
export ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS=true
run_rockcraft init --name flask-extension --profile flask-framework
run_rockcraft pack
@@ -15,15 +13,15 @@ execute: |
sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy oci-archive:flask-extension_0.1_amd64.rock docker-daemon:flask-extension:latest
# Ensure container exists
docker images flask-extension | MATCH "flask-extension"
# ensure container doesn't exist
docker rm -f flask-extension-container
# test the flask project is ready to run inside the container
docker run --rm --entrypoint /bin/python3 flask-extension -m gunicorn --chdir /flask/app --check-config app:app
docker run --rm --entrypoint /bin/python3 flask-extension -c "import pathlib;assert pathlib.Path('/flask/app/static/js/test.js').is_file()"
docker run --rm --entrypoint /bin/python3 flask-extension -c "import pathlib;assert not pathlib.Path('/flask/app/node_modules').exists()"
# test the default flask service
docker run --name flask-extension-container -d -p 8137:8000 flask-extension
retry -n 5 --wait 2 curl localhost:8137
3 changes: 1 addition & 2 deletions tests/unit/extensions/test_gunicorn.py
Original file line number Diff line number Diff line change
@@ -21,8 +21,7 @@


@pytest.fixture
def flask_extension(mock_extensions, monkeypatch):
monkeypatch.setenv("ROCKCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS", "1")
def flask_extension(mock_extensions):
extensions.register("flask-framework", extensions.FlaskFramework)


0 comments on commit 15d45a3

Please sign in to comment.