Skip to content
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

Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9466af8
Added dependencies check to venv
sfc-gh-jsikorski Feb 14, 2024
8478785
Problem
sfc-gh-jsikorski Feb 14, 2024
96de24c
Problem2
sfc-gh-jsikorski Feb 14, 2024
e1968e9
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 14, 2024
2d7d2a0
Fixed problem
sfc-gh-jsikorski Feb 15, 2024
0c0fecf
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 15, 2024
d628f82
Cleanup
sfc-gh-jsikorski Feb 15, 2024
5a5dcca
Corrected github installs
sfc-gh-jsikorski Feb 16, 2024
f9fe510
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 16, 2024
4db4a36
Corrected lib path
sfc-gh-jsikorski Feb 16, 2024
184ab17
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 16, 2024
ad58610
added release notes
sfc-gh-jsikorski Feb 19, 2024
ce0ab68
fixes
sfc-gh-jsikorski Feb 19, 2024
6de81a3
fixes
sfc-gh-jsikorski Feb 19, 2024
553a7fd
fixes
sfc-gh-jsikorski Feb 19, 2024
a78306a
fixes
sfc-gh-jsikorski Feb 19, 2024
63b81c5
Added native libraries option
sfc-gh-jsikorski Feb 19, 2024
0568766
Added native libraries option
sfc-gh-jsikorski Feb 19, 2024
8758573
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 19, 2024
303d686
Snapshot update
sfc-gh-jsikorski Feb 19, 2024
2cd4957
Snapshot update
sfc-gh-jsikorski Feb 19, 2024
9643779
Fixes
sfc-gh-jsikorski Feb 20, 2024
e364798
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 20, 2024
3f12e90
After merge fixes
sfc-gh-jsikorski Feb 20, 2024
d04a4af
Minor
sfc-gh-jsikorski Feb 20, 2024
e6e8734
fixes
sfc-gh-jsikorski Feb 21, 2024
b913bd8
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 21, 2024
ffee145
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 21, 2024
fac040e
Updates
sfc-gh-jsikorski Feb 21, 2024
6eacdb9
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 23, 2024
4473db3
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 27, 2024
5a30415
Performance update
sfc-gh-jsikorski Feb 28, 2024
e3f6196
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Feb 28, 2024
2911571
Test fix
sfc-gh-jsikorski Feb 28, 2024
5809275
windows fix
sfc-gh-jsikorski Feb 28, 2024
3cd0016
windows fix
sfc-gh-jsikorski Feb 28, 2024
4c6c737
windows fix
sfc-gh-jsikorski Feb 28, 2024
b9afc2a
windows fix
sfc-gh-jsikorski Feb 29, 2024
44ebaa1
windows fix
sfc-gh-jsikorski Feb 29, 2024
9dd57b7
windows fix
sfc-gh-jsikorski Feb 29, 2024
54221b0
windows fix
sfc-gh-jsikorski Feb 29, 2024
24f2135
windows fix
sfc-gh-jsikorski Mar 1, 2024
8a9d663
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 1, 2024
28ba4ee
fixed tests
sfc-gh-jsikorski Mar 1, 2024
abcd0fd
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 1, 2024
346f7eb
fixed tests
sfc-gh-jsikorski Mar 1, 2024
420f037
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 7, 2024
dd05ba7
Fixes after review
sfc-gh-jsikorski Mar 7, 2024
024435e
Fixes after review
sfc-gh-jsikorski Mar 8, 2024
7ba5714
Fixes
sfc-gh-jsikorski Mar 8, 2024
50efec9
Fixes
sfc-gh-jsikorski Mar 8, 2024
27d1d0c
Fixes
sfc-gh-jsikorski Mar 8, 2024
8df3710
Fixes
sfc-gh-jsikorski Mar 8, 2024
852a4dd
Fixes
sfc-gh-jsikorski Mar 8, 2024
01a0ae0
Fixes
sfc-gh-jsikorski Mar 8, 2024
21521b7
Fixes
sfc-gh-jsikorski Mar 8, 2024
2578038
Fixes
sfc-gh-jsikorski Mar 11, 2024
cc8023a
Replaced deprecated flags
sfc-gh-jsikorski Mar 11, 2024
27aba75
Replaced deprecated flags
sfc-gh-jsikorski Mar 11, 2024
10bfcc9
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 11, 2024
d9b999d
Replaced deprecated flags
sfc-gh-jsikorski Mar 11, 2024
1654c57
Replaced deprecated flags
sfc-gh-jsikorski Mar 11, 2024
6689b91
Fix for encoding
sfc-gh-jsikorski Mar 11, 2024
f57aad5
Fix for encoding
sfc-gh-jsikorski Mar 11, 2024
cd7ba59
Fix for encoding
sfc-gh-jsikorski Mar 11, 2024
4f610c8
Fix for encoding
sfc-gh-jsikorski Mar 11, 2024
654d54f
Fix for encoding
sfc-gh-jsikorski Mar 11, 2024
f767a18
Started cleaning
sfc-gh-jsikorski Mar 11, 2024
d95501f
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 11, 2024
2277f88
Cleanup
sfc-gh-jsikorski Mar 11, 2024
9ba815c
Merge branch 'main' into jsikorski/SNOW-1053803-fix-anaconda-check-in…
sfc-gh-jsikorski Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
* Added `create` command for `image-repository`.
* Added `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

## 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add more info?



# v2.0.0
Expand Down
30 changes: 29 additions & 1 deletion src/snowflake/cli/plugins/snowpark/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from enum import Enum
from typing import List

from requirements.requirement import Requirement
from requirements import requirement


class PypiOption(Enum):
Expand All @@ -13,6 +13,17 @@ class PypiOption(Enum):
ASK = "ask"


class Requirement(requirement.Requirement):
@classmethod
def parse_line(cls, line: str) -> Requirement:
result = super().parse_line(line)

if result.uri and not result.name:
result.name = result.uri

return result


@dataclass
class SplitRequirements:
"""A dataclass to hold the results of parsing requirements files and dividing them into
Expand All @@ -30,3 +41,20 @@ class RequirementWithFiles:

requirement: Requirement
files: List[str]


@dataclass
class RequirementWithFilesAndDeps(RequirementWithFiles):
dependencies: List[str]

def to_requirement_with_files(self):
return RequirementWithFiles(self.requirement, self.files)


pip_failed_msg = """pip failed with return code {}.
If pip is installed correctly, this may mean you`re trying to install a package
that isn't compatible with the host architecture -
and generally means it has native libraries."""
second_chance_msg = """Good news! The following package dependencies can be
imported directly from Anaconda, and will be excluded from
the zip: {}"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do those messages look like in cli? Ain't there too many blank lines on the lef?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

6 changes: 3 additions & 3 deletions src/snowflake/cli/plugins/snowpark/package/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
from pathlib import Path
from shutil import rmtree

from requirements.requirement import Requirement
from snowflake.cli.api.constants import PACKAGES_DIR
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 Requirement, SplitRequirements
from snowflake.cli.plugins.snowpark.package.utils import (
CreatedSuccessfully,
InAnaconda,
Expand All @@ -20,6 +19,7 @@
RequiresPackages,
prepare_app_zip,
)
from snowflake.cli.plugins.snowpark.package_utils import create_zip_name
from snowflake.cli.plugins.snowpark.zipper import zip_dir

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -62,7 +62,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 = create_zip_name(zip_name)
zip_dir(dest_zip=Path(file_name), source=Path.cwd() / ".packages")

if os.path.exists(file_name):
Expand Down
3 changes: 1 addition & 2 deletions src/snowflake/cli/plugins/snowpark/package/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pathlib import Path
from typing import List

from requirements.requirement import Requirement
from snowflake.cli.plugins.snowpark.models import SplitRequirements
from snowflake.cli.plugins.snowpark.models import Requirement, SplitRequirements


@dataclass
Expand Down
Loading
Loading