-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fixes for package creation and pip installs #781
Changes from all commits
9466af8
8478785
96de24c
e1968e9
2d7d2a0
0c0fecf
d628f82
5a5dcca
f9fe510
4db4a36
184ab17
ad58610
ce0ab68
6de81a3
553a7fd
a78306a
63b81c5
0568766
8758573
303d686
2cd4957
9643779
e364798
3f12e90
d04a4af
e6e8734
b913bd8
ffee145
fac040e
6eacdb9
4473db3
5a30415
e3f6196
2911571
5809275
3cd0016
4c6c737
b9afc2a
44ebaa1
9dd57b7
54221b0
24f2135
8a9d663
28ba4ee
abcd0fd
346f7eb
420f037
dd05ba7
024435e
7ba5714
50efec9
27d1d0c
8df3710
852a4dd
01a0ae0
21521b7
2578038
cc8023a
27aba75
10bfcc9
d9b999d
1654c57
6689b91
f57aad5
cd7ba59
4f610c8
654d54f
f767a18
d95501f
2277f88
9ba815c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ | |
* Added `create` command for `image-repository`. | ||
* Added `status`, `set (property)`, `unset (property)`, `suspend` and `resume` commands for `compute-pool`. | ||
* Added `set (property)`, `unset (property)`,`upgrade` and `list-endpoints` commands for `service`. | ||
* You can now use github repo link in `snow snowpark package create` to prepare your code for upload | ||
* Added `allow-native-libraries` option to `snow snowpark package create` command | ||
* Added alias `--install-from-pip` for `-y` option in `snow snowpark package create` command | ||
* Connections parameters are also supported by generic environment variables: | ||
* `SNOWFLAKE_ACCOUNT` | ||
* `SNOWFLAKE_USER` | ||
|
@@ -49,6 +52,7 @@ | |
## Fixes and improvements | ||
* Restricted permissions of automatically created files | ||
* Fixed bug where `spcs service create` would not throw error if service with specified name already exists. | ||
* Improved package lookup, to avoid unnecessary uploads | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add more info? |
||
* Logging into the file by default (INFO level) | ||
* Added validation that service, compute pool, and image repository names are unqualified identifiers. | ||
* `spcs service` commands now accept qualified names. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,16 @@ | |
from functools import wraps | ||
from pathlib import Path | ||
|
||
from requirements.requirement import Requirement | ||
from snowflake.cli.api.constants import PACKAGES_DIR | ||
from snowflake.cli.api.secure_path import SecurePath | ||
from snowflake.cli.plugins.object.stage.manager import StageManager | ||
from snowflake.cli.plugins.snowpark import package_utils | ||
from snowflake.cli.plugins.snowpark.models import SplitRequirements | ||
from snowflake.cli.plugins.snowpark.models import ( | ||
PypiOption, | ||
Requirement, | ||
SplitRequirements, | ||
get_package_name, | ||
) | ||
from snowflake.cli.plugins.snowpark.package.utils import ( | ||
CreatedSuccessfully, | ||
InAnaconda, | ||
|
@@ -25,15 +29,20 @@ | |
log = logging.getLogger(__name__) | ||
|
||
|
||
def lookup(name: str, install_packages: bool) -> LookupResult: | ||
def lookup( | ||
name: str, install_packages: bool, allow_native_libraries: PypiOption | ||
) -> LookupResult: | ||
|
||
package_response = package_utils.parse_anaconda_packages([Requirement.parse(name)]) | ||
|
||
if package_response.snowflake and not package_response.other: | ||
return InAnaconda(package_response, name) | ||
elif install_packages: | ||
status, result = package_utils.install_packages( | ||
perform_anaconda_check=True, package_name=name, file_name=None | ||
perform_anaconda_check=True, | ||
package_name=name, | ||
file_name=None, | ||
allow_native_libraries=allow_native_libraries, | ||
) | ||
|
||
if status: | ||
|
@@ -65,7 +74,7 @@ def upload(file: Path, stage: str, overwrite: bool): | |
|
||
|
||
def create(zip_name: str): | ||
file_name = zip_name if zip_name.endswith(".zip") else f"{zip_name}.zip" | ||
file_name = f"{get_package_name(zip_name)}.zip" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we moved the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
zip_dir(dest_zip=Path(file_name), source=Path.cwd() / ".packages") | ||
|
||
if os.path.exists(file_name): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make
-y
deprecated, I think this will be a nice exercise in how to do this (two different flags? callback?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently they are two different flags - fixed in #811