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 packaging #1766

Merged
merged 15 commits into from
Jul 18, 2024
Merged

Fix packaging #1766

merged 15 commits into from
Jul 18, 2024

Conversation

astrojuanlu
Copy link
Member

@astrojuanlu astrojuanlu commented Feb 26, 2024

Description

Make sdists self-contained, hence fix #1267

Development notes

Commits:

  1. cf73829 Remove direct invokations of setup.py, which have been deprecated for about 2 years https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
  2. 4453861 Migrate to pyproject.toml using @MehdiNV work in Migrate from '...requirements.txt' to 'pyproject.toml' #1584 as baseline with some updates, hence fix Move to pyproject.toml #1527
  3. 495a54b Migrate from setuptools to hatchling https://hatch.pypa.io/, same backend vizro uses (cc @antonymilne), as a preparation to eventually address Can the editable install come with package data? i.e. pip install -e . #1611 and also fix PyPI sdists are not self-contained #1267
  4. e22a6ba Move README.md to package/ and create root symlink to retain GitHub preview

QA notes

  1. Run make package in main and with this PR, save the resulting sdist and wheel in dist.old and dist respectively
  2. Unzip the resulting .tar.gz, and compare the PKG-INFO files of both sdists - there should be only lines out of order and other non consequential changes directories with main and with this PR.
  3. Compare the tree structure of both sdists - only metadata files should have changed.
--- old.tree	2024-02-27 00:41:59
+++ new.tree	2024-02-27 00:42:29
@@ -1,5 +1,6 @@
-dist.old/kedro-viz-7.1.0/
+dist/kedro_viz-7.1.0/
 ├── PKG-INFO
+├── README.md
 ├── kedro_viz
 │   ├── __init__.py
 │   ├── api
@@ -81,10 +82,7 @@
 │       ├── __init__.py
 │       ├── layers.py
 │       └── modular_pipelines.py
-├── setup.cfg
-├── setup.py
-└── tests
-    ├── test_import.py
-    └── test_server.py
+├── pyproject.toml
+└── requirements.txt
 
-19 directories, 69 files
+18 directories, 68 files
  1. Unzip both wheel files and compare the *.dist-info directories - there should be only lines out of order but the number of files in RECORD should be basically the same.
...
diff --color=auto -u dist.old/kedro_viz-7.1.0.dist-info/RECORD dist/kedro_viz-7.1.0.dist-info/RECORD
--- dist.old/kedro_viz-7.1.0.dist-info/RECORD   2024-02-26 23:37:50
+++ dist/kedro_viz-7.1.0.dist-info/RECORD       2020-02-02 00:00:00
@@ -62,8 +62,7 @@
 kedro_viz/services/__init__.py,sha256=-ZfXYz5XecClJZK-cjZsoRrCpQCThwc3TXvCyDs0Sek,186
 kedro_viz/services/layers.py,sha256=_JO8mbmA0ZzAMN2dcXVaDX89Gr_QtJDWtmDnUeX49gc,5263
 kedro_viz/services/modular_pipelines.py,sha256=Tx3ekpwjt981jmljezxgWlOVaWdxgVADKCY1QyIUC4Q,4064
-kedro_viz-7.1.0.dist-info/METADATA,sha256=j_RijhLdEdn3vEgHlpCUDyCGHq6u4Ho8zkVJ9VT_xwE,11619
-kedro_viz-7.1.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
+kedro_viz-7.1.0.dist-info/METADATA,sha256=tkqndzIrnu7hy0Pnj760FEOCApMYIBI9n0e2gxoo6vg,11759
+kedro_viz-7.1.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
 kedro_viz-7.1.0.dist-info/entry_points.txt,sha256=yCRpAmWDqux5fspKHZ03tRjHkmIjs8ypb1m3XuvWNMI,228
-kedro_viz-7.1.0.dist-info/top_level.txt,sha256=gWY-UrKtMq-3SUTv5Zww2hc6_ldAln47aYqCihTOyew,10
 kedro_viz-7.1.0.dist-info/RECORD,,
  1. Verify that pip install ./dist.old/...tar.gz doesn't work (hence PyPI sdists are not self-contained #1267) and pip install ./dist/...tar.gz fixes the issue
  2. Launch kedro viz run on a test project after installing the new sdist, verify that everything works as expected (the HTML files are included)

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

astrojuanlu and others added 3 commits February 27, 2024 00:21
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Fix gh-1527

Co-authored-by: Mehdi Naderi Varandi <mehdinv@hotmail.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
@astrojuanlu

This comment was marked as resolved.

@astrojuanlu

This comment was marked as resolved.

ravi-kumar-pilla and others added 2 commits February 27, 2024 07:10
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
@rashidakanchwala
Copy link
Contributor

This is amazing!!!! -- thanks @astrojuanlu ! liking the nerd-snipe you.

@antonymilne
Copy link
Contributor

Amazing PR! This is a HUGE improvement.

Just two things I'm curious about:

  1. What is the motivation for "e22a6ba Move README.md to package/ and create root symlink to retain GitHub preview"?
  2. What further steps would be needed to make pip install git+... on kedro-viz work?

@astrojuanlu
Copy link
Member Author

  1. setup.py had a open("../README.md"), that's not possible with static pyproject.toml (neither with setuptools nor with hatchling). I asked upstream Read `../README.md` pypa/hatch#1286 so far no response
  2. That's the topic of Can the editable install come with package data? i.e. pip install -e . #1611 and will require a custom hook that builds the assets upon installation, but that's for a separate PR 🙃

Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Signed-off-by: ravi-kumar-pilla <ravi_kumar_pilla@mckinsey.com>
Copy link
Contributor

@ravi-kumar-pilla ravi-kumar-pilla left a comment

Choose a reason for hiding this comment

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

This already looks great and I tried to resolve conflicts with main and fixed few issues. As per my understanding, this PR resolves -

  1. PyPI sdists are not self-contained #1267
  2. Migrate from '...requirements.txt' to 'pyproject.toml' #1584

There needs to be some work to resolve - #1611

Thank you for the PR @astrojuanlu . I followed the QA notes and it works as expected.

@astrojuanlu
Copy link
Member Author

Thanks @ravi-kumar-pilla ! I’ll double check the final state after you solved the conflicts

Copy link
Member Author

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

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

This looks good to me 👍🏼 Beware of the moving README.md as it will conflict with #1745

If folks still want an explanation of some of the concepts, I'll be happy to give an overview. The fun part comes when trying to solve #1611, this was just the beginning 😏

@astrojuanlu astrojuanlu removed their assignment Jul 10, 2024
@astrojuanlu astrojuanlu removed the request for review from NeroOkwa July 10, 2024 15:57
@ravi-kumar-pilla
Copy link
Contributor

This looks good to me 👍🏼 Beware of the moving README.md as it will conflict with #1745
@jitu5 fyi

Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

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

LGTM.

@ravi-kumar-pilla ravi-kumar-pilla merged commit faceed9 into main Jul 18, 2024
39 checks passed
@ravi-kumar-pilla ravi-kumar-pilla deleted the dev/fix-packaging branch July 18, 2024 03:16
@SajidAlamQB SajidAlamQB mentioned this pull request Jul 25, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Move to pyproject.toml PyPI sdists are not self-contained
4 participants