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

PyPI sdists are not self-contained #1267

Open
1 task done
astrojuanlu opened this issue Feb 26, 2023 · 5 comments · May be fixed by #1766
Open
1 task done

PyPI sdists are not self-contained #1267

astrojuanlu opened this issue Feb 26, 2023 · 5 comments · May be fixed by #1766

Comments

@astrojuanlu
Copy link
Member

astrojuanlu commented Feb 26, 2023

Description

As per title. The reason is that package.json and README.md are not included in the sdist.

Context

I was trying to add kedro-viz to conda-forge, picking up on conda-forge/staged-recipes#21441.

Steps to Reproduce

$ pip install "kedro-viz==5.3.0" --no-binary :all:
Collecting kedro-viz==5.3.0
  Downloading kedro-viz-5.3.0.tar.gz (5.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.1/5.1 MB 81.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-w73ekeu9/kedro-viz_74c1ed35d82c47aa8afa50b9d1762ce6/setup.py", line 20, in <module>
          with open(path.join(here, path.pardir, "package.json")) as data:
      FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-w73ekeu9/kedro-viz_74c1ed35d82c47aa8afa50b9d1762ce6/../package.json'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: You are using pip version 22.0.4; however, version 23.0.1 is available.
You should consider upgrading via the '/tmp/kedro-viz-5.3.0/.venv/bin/python3 -m pip install --upgrade pip' command.

Expected Result

Installing from a PyPI sdist should work.

Actual Result

Trying to install from a PyPI sdist gave an immediate error.

Your Environment

Include as many relevant details as possible about the environment you experienced the bug in:

  • Operating system and version: macOS Ventura and Linux

Checklist

  • Include labels so that we can categorise your issue
@astrojuanlu
Copy link
Member Author

Essentially a continuation of gh-1028.

@astrojuanlu
Copy link
Member Author

This also means that installing a development version from GitHub doesn't work:

pip install "kedro-viz @ git+https://github.com/kedro-org/kedro-viz@test-s3-on-exp#subdirectory=package"

this will properly install the Python files, but not perform a make build and hence not create the static HTML directory.

@astrojuanlu
Copy link
Member Author

Recommendations from the Python Packaging forum https://discuss.python.org/t/best-practices-for-packaging-python-javascript-projects/27047?u=astrojuanlu

  • Bundle the JS files in the sdist (this issue). Examples: Bokeh, Jupyter
  • Adopt a more sophisticated build backend (either Hatch or a custom subclass of Flit) that allows git installations. Examples: hatch-jupyter-builder

The former can be done without the latter, I'd say (although it would be nice to do both).

@astrojuanlu
Copy link
Member Author

Given that the workflow is designed with NodeJS 16 in mind, which is a bit old, it would be easier (both on the kedro-viz side and downstream) to go for the first option and bundle the JS files with the sdist.

@rxm7706
Copy link

rxm7706 commented Aug 17, 2023

This open issue here, could be the master to address all pypi distribution related fixes needed.

Linking Relevant comments & threads.
conda-forge/staged-recipes#21441 (comment)
conda-forge/staged-recipes#21441 (comment)
Solution for conda packaging.
conda-forge/staged-recipes#21441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants