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

[BUG] Entry points are missing when supplied as a string. #3103

Closed
judahrand opened this issue Feb 14, 2022 · 5 comments · Fixed by #3106
Closed

[BUG] Entry points are missing when supplied as a string. #3103

judahrand opened this issue Feb 14, 2022 · 5 comments · Fixed by #3106
Labels
bug Needs Implementation Issues that are ready to be implemented.

Comments

@judahrand
Copy link

judahrand commented Feb 14, 2022

setuptools version

setuptools==60.9.0

Python version

3.8.12

OS

Debian

Additional environment information

No response

Description

When installing a Python package which uses setuptools and has at least one entry_point directly from Git the entry_point script is not created with setuptools==60.9.0.

I have verified that this does work with setuptools=60.8.2 but not 60.9.0.

Expected behavior

The expected entry_point script tap-postgres is present in venv/bin/.

How to Reproduce

python -m venv venv
source venv/bin/activate
pip install git+https://github.com/thread/pipelinewise-tap-postgres.git@ee9bedb4711bb27c9660892f56c8fb27f3770d2a

Output

@judahrand judahrand added bug Needs Triage Issues that need to be evaluated for severity and status. labels Feb 14, 2022
judahrand added a commit to thread/pipelinewise that referenced this issue Feb 14, 2022
@bchopson
Copy link

bchopson commented Feb 14, 2022

I encountered something similar. My project used setup.py, but had a pyproject.toml for black config. Either removing pyproject.toml or running pip install --no-use-pep517 -e . worked for me. I suspect it's something packaging related.

@jaraco
Copy link
Member

jaraco commented Feb 14, 2022

It seems likely that the changes to how entry points are processed in Setuptools 60.9 have broken some assumption that wasn't captured by the tests. More investigation is needed.

@jaraco jaraco added Needs Investigation Issues which are likely in scope but need investigation to figure out the cause Needs Repro Issues that need a reproducible example. and removed Needs Triage Issues that need to be evaluated for severity and status. labels Feb 14, 2022
@jaraco
Copy link
Member

jaraco commented Feb 14, 2022

I have a clue as to what's going on. The thread/pipelinewise-tap-postgres project defines entry points as a string, and when I was debugging, I found that importlib_metadata.EntryPoints._from_text() doesn't return an EntryPoints instance as I'd expected, but instead returns an iterable... and when passed through validate(), the iterable will have been consumed, resulting in no entry points.

>>> entry_points='''
...           [console_scripts]
...           tap-postgres=tap_postgres:main
...       '''
>>> from importlib import metadata
>>> metadata.EntryPoints._from_text(entry_points)
<itertools.starmap object at 0x10e54c040>
>>> list(metadata.EntryPoints._from_text(entry_points))
[EntryPoint(name='tap-postgres', value='tap_postgres:main', group='console_scripts')]
>>> import setuptools._entry_points
>>> setuptools._entry_points.load(entry_points)
<itertools.starmap object at 0x10ed60e20>
>>> list(_)
[]

@jaraco jaraco added Needs Implementation Issues that are ready to be implemented. and removed Needs Repro Issues that need a reproducible example. Needs Investigation Issues which are likely in scope but need investigation to figure out the cause labels Feb 14, 2022
@jaraco jaraco changed the title [BUG] Installing from git does not put entry_points in bin [BUG] Entry points are missing when supplied as a string. Feb 14, 2022
@jaraco
Copy link
Member

jaraco commented Feb 14, 2022

Verified that the fix works:

draft $ env/bin/pip install -q git+https://github.com/pypa/setuptools@bugfix/3103-entry-points-from-string
draft $ env/bin/pip uninstall -q -y pipelinewise-tap-postgres
draft $ env/bin/pip install -q git+https://github.com/thread/pipelinewise-tap-draft
$ ls env/bin/tap*
env/bin/tap-postgres

@rsyring
Copy link
Contributor

rsyring commented Feb 14, 2022

I work with @bchopson and can confirm our entry points were defined as a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Implementation Issues that are ready to be implemented.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants