Skip to content

Commit

Permalink
feat(flask): remove experimental flag for flask-framework extension (#…
Browse files Browse the repository at this point in the history
…522) (#560)

Co-authored-by: David Andersson <[email protected]>
  • Loading branch information
tigarmo and jdkandersson authored May 6, 2024
1 parent f03bda5 commit fba4f1c
Show file tree
Hide file tree
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
Expand Up @@ -259,7 +259,7 @@ Extensions to enable when building the ROCK.

Currently supported extensions:

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

Example
=======
Expand Down
8 changes: 7 additions & 1 deletion rockcraft/extensions/gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())]
Expand Down
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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/extensions/test_gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit fba4f1c

Please sign in to comment.