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

Abort installation immediately #2

Merged
merged 1 commit into from
Apr 27, 2016
Merged

Conversation

aanand
Copy link
Contributor

@aanand aanand commented Apr 26, 2016

After reading #1, I think the best solution (without involving changes to PyPi or pip) is to abort the installation immediately with a helpful message. This has the advantage (over just deleting the package) of making it impossible for someone else to put something malicious there.

Forgive my code - I don't know much about setuptools/distutils. I did the simplest thing that seemed to work.

@swistakm
Copy link
Member

Yeah, we could head this direction. For sure user should be notified somehow that what he typed that is not exactly the same as he intended to type. Right now the effect is close to the expected one but let's ignore this fact.

But I think we could do a bit more here. Something fun. pip goes a very long way to hide the output of package installation. Why not to take the opportunity and show that this can be easily bypassed? Or maybe think about something similar to {{sl}} command. Thing that will be reasonably harmless but can make the user to think more about his actions.

Of course your PR falls into category of such things but honestly I would prefer to remove it from PyPI (and leave the name for other trickster to take), than to distribute a package with only import error inside.

And also one formal question: Why did you remove read_md() function from the setup.py script? This keeped consistency between description on PyPI and README.md in sources.

@aanand
Copy link
Contributor Author

aanand commented Apr 26, 2016

(Sorry about read_md - I removed it while I was stripping things down and forgot to put it back. I've done so now.)

If you want to make it display something more fun than just an error message, that's cool, but this PR is at least a step in the right direction. As raised in #1, the current behaviour is unhelpful, because it leads to difficult-to-track-down errors - accordingly, I'd strongly advocate merging/publishing this change and worrying about how fun it is later.

Whatever this package's behaviour, I'd also argue for keeping it free of snark. When people realise they've made a simple typing error, they're not going to appreciate being mocked for it. It's great that you want to use this as an opportunity to highlight the insecurity of a distribution tool like pip, but the Python community has long had a culture of being nice to programmers, and it's one of the reasons I like it here.

It's of course completely up to you whether or not to take on this responsibility in the first place. If you'd rather not, then by all means unpublish - but know that the next person might have malicious intent. For example, it's not hard to imagine that there might be people watching PyPi for recently-removed packages, hoping to inject malicious replacements to take advantage of people who haven't updated their dependencies yet. A better approach might be to first lobby the pip and/or PyPi teams to better address this issue, before taking the package down.

In any case, as I say, right now I think merging this PR is a win-win.

@swistakm swistakm merged commit b002121 into pylola:master Apr 27, 2016
@swistakm
Copy link
Member

I have merged this manually, updated README.md, bumped major version, streamlined distribution and distributed on PyPI as 1.0.0

@aanand
Copy link
Contributor Author

aanand commented Apr 27, 2016

🍰

@aanand aanand deleted the abort-installation branch April 27, 2016 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants