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

Fix micro package pull from PyPI #1848

Merged
merged 9 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
## Major features and improvements

## Bug fixes and other changes
* Fixed `kedro micropkg pull` for packages on PyPI.
* Fixed `format` in `save_args` for `SparkHiveDataSet`, previously it didn't allow you to save it as delta format.

## Upcoming deprecations for Kedro 0.19.0
## Minor breaking changes to the API

## Upcoming deprecations for Kedro 0.19.0
* `kedro test` and `kedro lint` will be deprecated.
* Fixed `format` in `save_args` for `SparkHiveDataSet`, previously it didn't allow you to save it as delta format.


# Release 0.18.3

Expand Down
13 changes: 6 additions & 7 deletions kedro/framework/cli/micropkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,17 @@ def _pull_package(
):
with tempfile.TemporaryDirectory() as temp_dir:
temp_dir_path = Path(temp_dir).resolve()

_unpack_sdist(package_path, temp_dir_path, fs_args)

sdist_file_name = Path(package_path).name.rstrip(".tar.gz")
egg_info_file = list((temp_dir_path / sdist_file_name).glob("*.egg-info"))
if len(egg_info_file) != 1:
egg_info_files = list((temp_dir_path).rglob("*.egg-info"))
if len(egg_info_files) != 1:
raise KedroCliError(
f"More than 1 or no egg-info files found from {package_path}. "
f"There has to be exactly one egg-info directory."
)
package_name = egg_info_file[0].stem
package_requirements = temp_dir_path / sdist_file_name / "setup.py"
egg_info_file = egg_info_files[0]
package_name = egg_info_file.stem
package_requirements = egg_info_file.parent / "setup.py"

# Finds a string representation of 'install_requires' list from setup.py
reqs_list_pattern = r"install_requires\=(.*?)\,\n"
Expand All @@ -172,7 +171,7 @@ def _pull_package(
_install_files(
metadata,
package_name,
temp_dir_path / sdist_file_name,
egg_info_file.parent,
env,
alias,
destination,
Expand Down
7 changes: 5 additions & 2 deletions tests/framework/cli/micropkg/test_micropkg_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,12 @@ def test_pull_from_pypi(

options = ["-e", env] if env else []
options += ["--alias", alias] if alias else []

package_name = "my-pipeline"

result = CliRunner().invoke(
fake_project_cli,
["micropkg", "pull", f"{PIPELINE_NAME}-{version}", *options],
["micropkg", "pull", package_name, *options],
obj=fake_metadata,
)
assert result.exit_code == 0
Expand All @@ -642,7 +645,7 @@ def test_pull_from_pypi(
"--no-deps",
"--dest",
str(tmp_path),
f"{PIPELINE_NAME}-{version}",
package_name,
],
)

Expand Down