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 entrypoints installation by limiting setuptools compatiblity #25

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

alexrashed
Copy link
Member

@alexrashed alexrashed commented Oct 21, 2024

Motivation

With setuptools==75.2.0, plux has issues when restoring the entrypoints on the installation of source distributions.
This is caused by pypa/setuptools#4647, it might be specifically relate to this comment. It definitely is caused by the fact that the egg_info command and the egg2dist is not called anymore.

I also tried to dive into this with a hack implemented in ffb1ad9 which will be taken over by @thrau.

In LocalStack, we are mitigating this issue by introducing a limit in the build-system.requires: localstack/localstack#11715

However, this only fixes the issue in upcoming releases, the source distributions out there won't be affected by this change.
This is why plux itself should declare that it is not compatible with the latest release of setuptools.

Changes

This PR introduces setuptools as an install dependency (which it is and always was) and limits the version to <=75.1.0 (which is the latest compatible version).
This change can be reverted as soon as plux is compatible with the latest version of setuptools again.

Testing

I verified that this fix by executing the following steps / scripts:

  • Use the local version of plux in one of the test projects:
    diff --git a/tests/cli/projects/pyproject/pyproject.toml b/tests/cli/projects/pyproject/pyproject.toml
    index 54c5728..9f69017 100644
    --- a/tests/cli/projects/pyproject/pyproject.toml
    +++ b/tests/cli/projects/pyproject/pyproject.toml
    @@ -1,5 +1,5 @@
     [build-system]
    -requires = ["setuptools", "wheel", "plux"]
    +requires = ["setuptools", "wheel", "plux@file:///home/localstack/Repos/plux"]
     build-backend = "setuptools.build_meta"
     
     [project]
  • Apply the change in this PR
  • Run the following script to verify that the entrypoints are correctly available after installing the source distribution:
    #!/bin/bash
    set -e
    
    # make sure setuptools on the system and in the venv is up to date.
    pip install --upgrade setuptools
    
    # create a test-venv and also ugprade setuptools
    cd tests/cli/projects/pyproject/
    rm -rf setuptools-test-venv
    python3 -m venv setuptools-test-venv
    source setuptools-test-venv/bin/activate
    pip install --upgrade setuptools
    
    # build the project
    rm -rf dist
    pip install build
    python3 -m build
    
    # install the source distribution with the local plux reference
    pip install --no-cache dist/test_project-0.1.0.tar.gz
    
    # check if the entryponts have been created / print the output:
    cat setuptools-test-venv/lib/python3.11/site-packages/test_project-0.1.0.dist-info/entry_points.txt
    The path in the last line might need to be adjusted based on the Python version.

@alexrashed alexrashed added the bug Something isn't working label Oct 21, 2024
@alexrashed alexrashed requested a review from thrau October 21, 2024 14:31
@alexrashed alexrashed self-assigned this Oct 21, 2024
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

as discussed we will merge this as a stop-gap solution, and i'll try to follow up with a proper fix ASAP.

the issue adding this dependency in this way is that actually setuptools isn't even a runtime dependency of plux, and therefore shouldn't be part of install_requires. secondly, i'm not sure what the exact implications of this constraints are for certain build environments. it's very hard for me to predict the impact of it, so just want to make sure we move away from it quickly.

@thrau thrau merged commit 5b71926 into main Oct 21, 2024
5 checks passed
thrau pushed a commit that referenced this pull request Oct 21, 2024
@alexrashed alexrashed deleted the limit-setuptools branch October 22, 2024 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants