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

Autosetuptools #1069

Closed
wants to merge 9 commits into from
Closed

Autosetuptools #1069

wants to merge 9 commits into from

Conversation

dholth
Copy link
Member

@dholth dholth commented Jul 20, 2013

The autosetuptools branch fixes wheel installs compared to the previous PR.

This is a rough PR for discussion.

This version of pip uses its own copy of pkg_resources and installs setuptools when it needs it. It doesn't necessarily remove enough options from install command so the re-run only fetches setuptools (maybe add a special "only setuptools" flag) and it probably fetches the first package that needed setuptools twice.

If the install needs setuptools, NeedSetuptools() is raised. The runner catches it, runs the command with the same options, then retries with the original arguments to the install command.

We can't just add setuptools to the requirements in the same install loop because everything is installed at once or not installed at all; packages in the build/ directory are not added to sys.path when we're getting the egg-info. However when you're running setuptools' own setup.py then setuptools is available on sys.path by virtue of being the cwd.

Even without all the automatic rigamorole, being able to install setuptools without having a (working) version is nice. Just expect to need to run "python -m pip ..." if the wrapper script is trying to import a missing pkg_resources.

I think some of the bdist_wheel "needs setuptools to --use-wheel" checks (no longer the case after this patch) were mixed up with the "needs setuptools to build wheels" check that will be necessary.

I tried the distlib pkg_resources emulation but my virtualenvs tend to use enough pkg_resources features that I need the setuptools version.

@qwcode
Copy link
Contributor

qwcode commented Jul 20, 2013

can we just have one pull?

@qwcode
Copy link
Contributor

qwcode commented Jul 20, 2013

ok, I see, you started off in your develop branch, in the original one.

except NeedSetuptools:
# XXX assume we are in the install command
self.run(options, ['setuptools'])
return self.run(options, args)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think each pip version should set a setuptools requirement (based on our testing), not just "setuptools"
If setuptools is installed and doesn't meet the requirement, I think we should prompt them for what they want to do. "Proceed at risk, or Allow pip to re-install". they could set the permanent answer in their config or environment.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea and would help me; I'm always getting older versions of setuptools by accident.

Except -1 on the interactive prompt.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the case where we'd be upgrading, not sure we can just presume. they're just trying to install some package, and we go upgrade setuptools.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I prefer to exit with an error code and something like a "please upgrade setuptools or use --force" message if setuptools is installed but too old. We'll get there when we get there.

@dholth
Copy link
Member Author

dholth commented Jul 20, 2013

@qwcode said:

"any wheel for a setuptools-based setup.py that uses the "scripts" keyword or console entry points will need pkg_resources. most won't naturally add a dependency on setuptools for that. so, that is our problem, right?"

The next pip should generate the console_scripts style scripts at install time and will be able to determine whether that merits a pkg_resources dependency. We would be able to have more than one console_scripts implementation depending on the user's preference: compatible, fast, or nothing.

The distutils scripts= keyword is different and just copies the script. You can put non-Python scripts in there too. [TODO check if touches the .py extension]

@dholth
Copy link
Member Author

dholth commented Jul 20, 2013

Woot!

@qwcode
Copy link
Contributor

qwcode commented Jul 20, 2013

The first step here is for everyone to come to consensus on what solution to pick from #1049
Although this scenario ranks well based on the pros and cons IMO, this is one of multiple scenarios.

@qwcode
Copy link
Contributor

qwcode commented Jan 3, 2014

closing, vendoring will happen in another PR that is specifically about vendoring, and not the auto-install

@qwcode qwcode closed this Jan 3, 2014
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation project: setuptools Related to setuptools type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants