Skip to content

Commit

Permalink
Fix micro package pull from PyPI (#1848)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Gaudin-Delrieu <florian.gaudindelrieu@gmail.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
  • Loading branch information
FlorianGD authored and Ahdra Merali committed Oct 21, 2022
1 parent 10972d4 commit 57384cc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
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

0 comments on commit 57384cc

Please sign in to comment.