Commit 8648982
authored
SNOW-2665953: Make Streamlit Deployment with Versioned Stages as Default in Snow CLI (#2685)
* Make versioned Streamlit deployment the default behavior
## Changes
### CLI Behavior
- `snow streamlit deploy` now uses versioned deployment (FROM syntax) by default
- Added `--legacy` flag to use old ROOT_LOCATION deployment
- `--experimental` flag is now deprecated but still works (shows warning)
### Code Changes
- Added `--legacy` flag to streamlit deploy command
- Inverted deployment logic: `if experimental` → `if not legacy`
- Renamed `_deploy_experimental()` → `_deploy_versioned()`
- Removed `ENABLE_STREAMLIT_VERSIONED_STAGE` feature flag
- Updated `_is_spcs_runtime_v2_mode()` to not require experimental flag
- SPCS runtime v2 (compute pools) only available in versioned mode
### Test Updates
- Added `--legacy` flag to 12 unit tests expecting ROOT_LOCATION behavior
- Removed `--experimental` flag from tests now using default behavior
- Removed `with_feature_flags` wrapper and parametrization
- Updated integration tests to reflect new default
## Breaking Change
The default deployment mode changes from ROOT_LOCATION to versioned deployment.
Users who want the old behavior must use `--legacy` flag.
* Update --legacy flag help text: deployment → stages
* Refactor: Extract legacy deployment logic into _deploy_legacy() method
For consistency with _deploy_versioned(), extracted the else block's
deployment logic into a dedicated _deploy_legacy() method. This improves
code organization and makes the deploy() method cleaner.
* Use positive condition for legacy flag check
Changed from 'if not legacy' to 'if legacy' for better readability.
The positive condition directly maps to the flag name and avoids mental negation.
* Fix lint: Break long lines to comply with 88 char limit
- Split long comment in _deploy_legacy() method
- Break deprecation warning string across multiple lines
- Format long test invocation call
- Fix typo: elswhere → elsewhere
* Fix black formatting
* Add validation to prevent SPCS runtime v2 usage with --legacy flag
* Add documentation for deprecated --experimental flag and parameter naming
* Fix test_artifacts.py tests to use --legacy flag for artifact tests
* Fix integration tests for versioned Streamlit deployment
Update test_streamlit_flow and test_streamlit_deploy_prune_flag to work with
versioned Streamlit deployment (now the default behavior).
Changes:
- test_streamlit_flow: Update stage paths from legacy app_1_stage to versioned
snow://streamlit/{DB}.{SCHEMA}.app_1/versions/live/
- test_streamlit_deploy_prune_flag: Rewrite to use managed versioned stages
instead of user-created stages
Files are now uploaded to managed stages at versions/live/ path instead of
user-specified ROOT_LOCATION stages.
* Fix unit tests for versioned Streamlit deployment
- Add mock for describe() method to return versioned stage path
- Update test_deploy to use legacy=True for testing old behavior
- Replace experimental parameter with legacy parameter in SPCS runtime v2 tests
- Fix test_deploy_with_spcs_runtime_v2_and_legacy_flag_raises_error invalid parameters
Changes reflect that versioned deployment is now the default, and the
experimental flag has been replaced with a legacy flag to opt into old behavior.
* Update help message snapshots for streamlit deploy
- Add --legacy flag to streamlit deploy help text
- Remove oauth-token-request-url parameter (deprecated)
These changes reflect the new default versioned deployment behavior.
* Fix help message snapshots - restore oauth-token-request-url for all commands except streamlit
The previous commit incorrectly removed oauth-token-request-url from ALL commands.
This parameter should only be excluded from streamlit.deploy command, but remain
in all other commands' help text.
* Restore oauth-token-request-url to streamlit.deploy help message
This parameter is a standard connection option that applies to all commands
including streamlit. Cannot be removed from just streamlit.deploy.
* Fix test_streamlit_deploy_prune_flag: add --overwrite flag for streamlit stage
Snowflake requires overwrite=true when uploading to streamlit versioned stages.
The test was failing because stage copy needs --overwrite flag when uploading
to snow://streamlit/ managed stages.
* Fix test_streamlit_deploy_prune_flag: test with --legacy flag
Versioned stages are managed by Snowflake's FBE and have different file
lifecycle behavior. The prune flag functionality is primarily for legacy
ROOT_LOCATION stages where the CLI has full control over file management.
Changed the test to use --legacy flag to properly test the prune
functionality on legacy stages instead of versioned stages.
* Address PR review comments: simplify help text, use CliError, and reduce comment bloat
* Fix test_streamlit_deploy_prune_flag database context mismatch
* Fix unit test: update exception type to CliError and mock bundle to avoid file errors
* Update help message snapshot for --legacy flag text change
* Add gitattributes to ensure snapshot files use consistent encoding across platforms
* Fix Unicode smart quotes in snapshot file - replace with ASCII apostrophes
* Address PR review comments: add RELEASE-NOTES entry, move test imports to top, add deployment style change warnings
* Fix integration test: use fully qualified stage name to match deployment database context
* Fix integration test: explicitly set database and schema for streamlit deploy commands
* Fix integration test: remove explicit database/schema flags, rely on test_database fixture env var
* Fix integration test
* Update RELEASE-NOTES to reflect deprecations and new additions for `snow streamlit deploy` and `snow dbt` commands, including versioned deployment and legacy support. Enhance clarity by formatting entries as bullet points.1 parent 465a2a3 commit 8648982
File tree
13 files changed
+402
-181
lines changed- src/snowflake/cli
- _plugins/streamlit
- api
- tests_integration
- tests_using_container_services
- tests
- __snapshots__
- streamlit
13 files changed
+402
-181
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
58 | | - | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | | - | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
93 | | - | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
104 | | - | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| 129 | + | |
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
128 | | - | |
129 | 135 | | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
138 | | - | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
147 | | - | |
148 | 154 | | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
| 162 | + | |
155 | 163 | | |
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
159 | | - | |
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
167 | | - | |
168 | 174 | | |
| 175 | + | |
169 | 176 | | |
170 | 177 | | |
171 | 178 | | |
| |||
174 | 181 | | |
175 | 182 | | |
176 | 183 | | |
| 184 | + | |
177 | 185 | | |
178 | 186 | | |
179 | 187 | | |
180 | | - | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
185 | 192 | | |
| 193 | + | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
| |||
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| 203 | + | |
195 | 204 | | |
196 | 205 | | |
197 | 206 | | |
198 | 207 | | |
199 | 208 | | |
200 | | - | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
208 | | - | |
209 | 216 | | |
| 217 | + | |
210 | 218 | | |
211 | 219 | | |
212 | 220 | | |
| |||
215 | 223 | | |
216 | 224 | | |
217 | 225 | | |
| 226 | + | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
221 | | - | |
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
| 235 | + | |
227 | 236 | | |
228 | 237 | | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
232 | 241 | | |
233 | | - | |
234 | 242 | | |
| 243 | + | |
235 | 244 | | |
236 | 245 | | |
237 | 246 | | |
238 | 247 | | |
239 | 248 | | |
240 | 249 | | |
| 250 | + | |
241 | 251 | | |
242 | 252 | | |
243 | 253 | | |
| 254 | + | |
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| |||
252 | 263 | | |
253 | 264 | | |
254 | 265 | | |
| 266 | + | |
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
| |||
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| 277 | + | |
265 | 278 | | |
266 | 279 | | |
267 | 280 | | |
| 281 | + | |
268 | 282 | | |
269 | 283 | | |
270 | 284 | | |
| |||
290 | 304 | | |
291 | 305 | | |
292 | 306 | | |
| 307 | + | |
293 | 308 | | |
294 | 309 | | |
295 | 310 | | |
296 | | - | |
297 | 311 | | |
298 | 312 | | |
299 | 313 | | |
| |||
446 | 460 | | |
447 | 461 | | |
448 | 462 | | |
449 | | - | |
| 463 | + | |
450 | 464 | | |
451 | 465 | | |
452 | 466 | | |
| |||
540 | 554 | | |
541 | 555 | | |
542 | 556 | | |
543 | | - | |
| 557 | + | |
544 | 558 | | |
545 | 559 | | |
546 | 560 | | |
| |||
594 | 608 | | |
595 | 609 | | |
596 | 610 | | |
597 | | - | |
598 | | - | |
599 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
600 | 614 | | |
601 | 615 | | |
602 | 616 | | |
| |||
666 | 680 | | |
667 | 681 | | |
668 | 682 | | |
669 | | - | |
| 683 | + | |
670 | 684 | | |
671 | | - | |
| 685 | + | |
672 | 686 | | |
673 | 687 | | |
674 | 688 | | |
675 | | - | |
| 689 | + | |
676 | 690 | | |
677 | | - | |
| 691 | + | |
678 | 692 | | |
679 | 693 | | |
680 | 694 | | |
681 | | - | |
| 695 | + | |
682 | 696 | | |
683 | 697 | | |
684 | 698 | | |
| |||
747 | 761 | | |
748 | 762 | | |
749 | 763 | | |
750 | | - | |
| 764 | + | |
751 | 765 | | |
752 | 766 | | |
753 | 767 | | |
| |||
846 | 860 | | |
847 | 861 | | |
848 | 862 | | |
| 863 | + | |
849 | 864 | | |
850 | 865 | | |
851 | 866 | | |
| |||
872 | 887 | | |
873 | 888 | | |
874 | 889 | | |
| 890 | + | |
875 | 891 | | |
876 | 892 | | |
877 | 893 | | |
878 | 894 | | |
| 895 | + | |
879 | 896 | | |
880 | 897 | | |
881 | 898 | | |
| |||
887 | 904 | | |
888 | 905 | | |
889 | 906 | | |
| 907 | + | |
890 | 908 | | |
891 | 909 | | |
892 | 910 | | |
| |||
0 commit comments