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

Drop use of setuptools extension #1327

Merged

Conversation

stephenfin
Copy link
Contributor

@stephenfin stephenfin commented Aug 3, 2023

We were wrapping easy_install's install_scripts and develop methods to generate a custom WSGI script. This was a replacement of functionality previously provided by PBR. Unfortunately easy_install is deprecated for removal at a future date and we don't yet have a modern equivalent in pip [1]. As such, we need a migration plan for this and it seems like the old school scripts option is probably it. The main downside of this is that the shebang isn't updated accordingly, which means this won't work very well in virtualenvs, but I'm hoping that the use of /usr/bin/env will allow us to work around this. At least in local testing, it seems like this is the case:

❯ virtualenv .venv
❯ pip install .
❯ cat .venv/bin/gnocchi-api | head -1
#!/gnocchi/.venv/bin/python

EDIT: this also seems to work just fine with wheels:

❯ python -m build -w .
❯ pushd dist
❯ unzip gnocchi-*.whl
❯ cat gnocchi-*.data/scripts/gnocchi-api | head -1
#!python
❯ popd
❯ virtualenv .venv
❯ pip install dist/gnocchi-*.whl
❯ cat .venv/bin/gnocchi-api | head -1
#!/gnocchi/.venv/bin/python

[1] https://discuss.python.org/t/adding-support-for-wsgi-scripts-entrypoint/30905

Signed-off-by: Stephen Finucane [email protected]

@tobias-urdin
Copy link
Contributor

I like this approach, more elegant than trying to integrate pbr or pip. We could perhaps nuke the two lines to setuptools.setup() function as well right?

We were wrapping easy_install's 'install_scripts' and 'develop' methods
to generate a custom WSGI script. This was a replacement of
functionality previously provided by PBR. Unfortunately easy_install is
deprecated for removal at a future date and we don't yet have a modern
equivalent in pip [1]. As such, we need a migration plan for this and it
seems like the old school 'scripts' option is probably it. The main
downside of this is that the shebang isn't updated accordingly, which
means this won't work very well in virtualenvs, but I'm hoping that the
use of '/usr/bin/env' will allow us to work around this. At least in
local testing, it seems like this is the case:

  ❯ virtualenv .venv
  ❯ pip install .
  ❯ cat .venv/bin/gnocchi-api | head -1
  #!/gnocchi/.venv/bin/python

[1] https://discuss.python.org/t/adding-support-for-wsgi-scripts-entrypoint/30905

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin stephenfin force-pushed the remove-easy_install-dependency branch from 80fc4d1 to 3f45e24 Compare August 4, 2023 09:47
@stephenfin
Copy link
Contributor Author

We could perhaps nuke the two lines to setuptools.setup() function as well right?

Yeah, I've done that in #1325

@mrunge
Copy link
Contributor

mrunge commented Aug 10, 2023

oooohhh, sweet!

@tobias-urdin tobias-urdin merged commit 79e7cf8 into gnocchixyz:master Sep 5, 2023
@stephenfin stephenfin deleted the remove-easy_install-dependency branch September 5, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants