Skip to content

Commit

Permalink
fixup! Bring back glob support in streamlit
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-turbaszek authored and sfc-gh-astus committed Sep 20, 2024
1 parent bc5cbe0 commit 93871e1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
11 changes: 0 additions & 11 deletions src/snowflake/cli/_plugins/streamlit/streamlit_entity_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ class StreamlitEntityModel(EntityModelBase, ExternalAccessBaseModel, ImportsBase
default=None,
)

@model_validator(mode="after")
def main_file_must_be_in_artifacts(self):
if not self.artifacts:
return self

if Path(self.main_file) not in self.artifacts:
raise ValueError(
f"Specified main file {self.main_file} is not included in artifacts."
)
return self

@model_validator(mode="after")
def artifacts_must_exists(self):
if not self.artifacts:
Expand Down
15 changes: 0 additions & 15 deletions tests/streamlit/__snapshots__/test_commands.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@

'''
# ---
# name: test_main_file_must_be_in_artifacts
'''
+- Error ----------------------------------------------------------------------+
| During evaluation of DefinitionV20 in project definition following errors |
| were encountered: |
| For field entities.my_streamlit.streamlit you provided '{'artifacts': |
| ['streamlit_app.py', 'utils/utils.py', 'pages/', 'environment.yml'], |
| 'identifier': 'test_streamlit_deploy_snowcli', 'main_file': 'foo_bar.py', |
| 'query_warehouse': 'xsmall', 'stage': 'streamlit', 'title': 'My Fancy |
| Streamlit', 'type': 'streamlit'}'. This caused: Value error, Specified main |
| file foo_bar.py is not included in artifacts. |
+------------------------------------------------------------------------------+

'''
# ---
# name: test_multiple_streamlit_raise_error_if_multiple_entities
'''
Usage: default streamlit deploy [OPTIONS] [ENTITY_ID]
Expand Down
17 changes: 0 additions & 17 deletions tests/streamlit/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,23 +266,6 @@ def test_deploy_only_streamlit_file_replace(
mock_typer.launch.assert_not_called()


def test_main_file_must_be_in_artifacts(
runner, mock_ctx, project_directory, alter_snowflake_yml, snapshot
):
with project_directory("example_streamlit_v2") as pdir:
alter_snowflake_yml(
pdir / "snowflake.yml",
parameter_path="entities.my_streamlit.main_file",
value="foo_bar.py",
)

result = runner.invoke(
["streamlit", "deploy"],
)
assert result.exit_code == 1
assert result.output == snapshot


def test_artifacts_must_exists(
runner, mock_ctx, project_directory, alter_snowflake_yml, snapshot
):
Expand Down

0 comments on commit 93871e1

Please sign in to comment.