This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add pysetup script for Windows
Type: Stage: resolved
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: closed Resolution: postponed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, brian.curtin, eric.araujo, lygstate, paul.moore, pitrou, tarek, vinay.sajip
Priority: normal Keywords:

Created on 2012-02-16 06:32 by lygstate, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pysetup.bat lygstate, 2012-02-16 06:32
Messages (8)
msg153460 - (view) Author: 勇刚 罗 (lygstate) * Date: 2012-02-16 06:32
Patch attaced.
msg153633 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-18 05:28
Hi, and thanks for your interest in improving distutils2.

I am not a Windows user, much less developer, so I have many questions about your proposed pysetup.bat:
- Will “@%~dp0\..\python.exe” get the proper path for people who do not install Python to C:\?
- Aren’t there issues with .bat scripts (or maybe it’s with .com scripts, I never remember)?
- Shouldn’t we install a pysetup.py script instead?
- Shouldn’t we generate an .exe file instead (see #12394)?

In other words, I need more info from Windows experts about what works best for Python developers :)
msg153636 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2012-02-18 10:00
> - Will “@%~dp0\..\python.exe” get the proper path for people who do not install Python to C:\?

%~dp0\..\python.exe locates python relative to the batch file (one
directory up) so will work as long as the bat file is in Scripts. The
@ just suppresses echo of the command.

> - Aren’t there issues with .bat scripts (or maybe it’s with .com scripts, I never remember)?

Yes. They don't nest, so to invoke pysetup in a batch file, you need
to write "call pysetup.bat". If you just use "pysetup", the command
never returns causing silent failures. Personally, I hate bat files
for this reason alone, but others seem happy to put up with them.

> - Shouldn’t we install a pysetup.py script instead?

That would be better, in my view.

> - Shouldn’t we generate an .exe file instead (see #12394)?

exe files probably give the best user experience, but are opaque which
is mildly annoying. Also, test very carefully on Win7. I have a vague
recollection that exes with setup and/or install in the names invoke
UAC, which is a complete pain. easy_install suffers from this, I
believe.

> In other words, I need more info from Windows experts about what works best for Python developers :)

Personally, "python -m packaging.run" works fine for me. I'd prefer
not to have a pysetup command at all, and change the documentation to
refer to the python -m form throughout. Second best would be an exe,
third would be pysetup.py (but again, the docs need changing), and
finally a bat file.

Another option would be a runnable pysetup module, so that python -m
pysetup (or maybe an install.py so python -m install) would work.
Paul.
msg153639 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-02-18 11:39
Also, we normally set ".py", and ".pyw" into the PATHEXT environment variable, so that a script "pysetup.py" can be invoked from the command-line as just "pysetup" without the suffix. This gives the same experience as using a "pysetup.bat".

I would say that pysetup seems a little more polished (and shorter) than the -m form, especially for users new to packaging. After that, I agree with Paul's ordering of .exe, with the setup script having to be named pysetup-script.py if we use the "standard" mechanism, or else if we use a custom .exe, it can of course be called whatever we want.
msg153751 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-20 01:22
[Paul]
> %~dp0\..\python.exe locates python relative to the batch file (one directory up) so will work as long
> as the bat file is in Scripts. The @ just suppresses echo of the command.

Okay, so a pysetup.bat script installed by pythonX.Y.exe will be put in that Python’s Scripts directory and will call that Python when invoked.  Sounds good.

>> - Aren’t there issues with .bat scripts (or maybe it’s with .com scripts, I never remember)?
> Yes. They don't nest, so to invoke pysetup in a batch file, you need to write "call pysetup.bat". If
> you just use "pysetup", the command never returns causing silent failures. Personally, I hate bat files
> for this reason alone, but others seem happy to put up with them.

Noted.  (I’ve been reading old mailing list archives and found this sort of criticism in bat vs. com discussions.)

>> - Shouldn’t we install a pysetup.py script instead?
> That would be better, in my view.

Okay, I can do this for the short term.  勇刚.罗 (sorry if that does not read right, I seem to have font problems), would that satisfy you?

>> - Shouldn’t we generate an .exe file instead (see #12394)?
> exe files probably give the best user experience, but are opaque which is mildly annoying. Also, test
> very carefully on Win7. I have a vague recollection that exes with setup and/or install in the names
> invoke UAC, which is a complete pain. easy_install suffers from this, I believe.

Oh dear, what an horror story.  I really wish we won’t have to rename pysetup, it’s the only generic and available name we could agree on.

> Personally, "python -m packaging.run" works fine for me. I'd prefer not to have a pysetup command at
> all, and change the documentation to refer to the python -m form throughout. Second best would be an exe,
> third would be pysetup.py (but again, the docs need changing), and finally a bat file.

Thanks for the feedback.  I don’t think we’re going to move away from a main script; we’re making packaging more useful and more robust, and having a script is IMO a message as well as a convenience.


[Vinay]
> After that, I agree with Paul's ordering of .exe, with the setup script having to be named
> pysetup-script.py if we use the "standard" mechanism, or else if we use a custom .exe, it can of course
> be called whatever we want.

I don’t understand the notions of standard vs. custom.  Does standard mean setuptools?  #12394 is not quite ready yet, so nothing is set in stone, but if possible I’d prefer to generate pysetup.exe.  Let’s move the sub-discussion there.
msg153752 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-02-20 01:27
I'd rather we not add a batch file and choose one of the other options outlined above. I haven't used this new pysetup thing so I'm not familiar with which would be the best experience, but in other cases all of the ones listed are better than batch files.
msg153772 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-02-20 10:06
> I don’t understand the notions of standard vs. custom.
> Does standard mean setuptools?  #12394 is not quite ready yet, so
> nothing is set in stone, but if possible I’d prefer to generate
> pysetup.exe.  Let’s move the sub-discussion there.

Okay, we'll continue on #12394, but I'll comment here on "standard vs. custom" - by "standard", I meant the setuptools way of doing it, but not necessarily using the setuptools code - see my comment in #12394 on an alternative. The basic method is that used by setuptools, but the specific implementation is different - somescript.exe opens somescript-script.py, reads a shebang line to find which Python to invoke, then invokes it with the script. By "custom" I meant "something else" without anything specific in mind - and I'm not sure it's worth the bother and extra work of a customised pysetup.exe.

Perhaps all or at least some of this could be simplified in 3.3 if the PEP 397 launcher is included in Python. Mark Hammond has re-started discussions about this on Python-dev, and hopefully we'll have a consensus to get it in.
msg201146 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-24 15:04
distutils2 is dead, closing.
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58235
2013-10-24 15:04:08pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg201146

resolution: postponed
stage: resolved
2013-10-24 14:40:03tim.goldensetnosy: - tim.golden
2012-02-20 10:06:32vinay.sajipsetmessages: + msg153772
2012-02-20 01:27:17brian.curtinsetmessages: + msg153752
2012-02-20 01:22:50eric.araujosetassignee: tarek -> eric.araujo
title: distutils2 lack of pysetup.bat -> Add pysetup script for Windows
2012-02-20 01:22:06eric.araujosetmessages: + msg153751
2012-02-18 11:39:44vinay.sajipsetmessages: + msg153639
2012-02-18 10:00:02paul.mooresetmessages: + msg153636
2012-02-18 05:28:15eric.araujosetnosy: + paul.moore, vinay.sajip, tim.golden, brian.curtin

messages: + msg153633
versions: + 3rd party, - Python 2.6, Python 3.1, Python 2.7, Python 3.2
2012-02-16 06:32:19lygstatecreate