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

Create a .exe file using Default Installer #3534

Closed
2 tasks done
naveen521kk opened this issue Jan 3, 2021 · 6 comments · Fixed by #3706
Closed
2 tasks done

Create a .exe file using Default Installer #3534

naveen521kk opened this issue Jan 3, 2021 · 6 comments · Fixed by #3706
Labels
kind/feature Feature requests/implementations

Comments

@naveen521kk
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

First, using the default installer as specified in the documentation, https://python-poetry.org/docs/#windows-powershell-install-instructions, it creates a .bat file in %USERPROFILE%\.poetry\bin folder. I want it to create an exe file instead of a batch file.

It can be done using the way setuptools does it. Essentially, it would be to find cli.exe or cli-64.exe and rename it to poetry.exe and create a file called poetry-script.py instead of the currently present, poetry(without any extension) file.
Usually, setuptools is installed by default. If it not, the .tar.gz for windows, can include a copy of cli.exe and cli-64.exe which can be easily compiled using, https://github.com/pypa/setuptools/blob/main/launcher.c

Note: poetry-script.py needs to have proper shebang with full paths.

@naveen521kk naveen521kk added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jan 3, 2021
@TBBle
Copy link
Contributor

TBBle commented Jan 4, 2021

The distlib.scripts package is what Pip uses to generate executables for this use-case. Rather than bundling a stock executable that runs a script by the same name, it generates an executable with the script text appeneded, taking advantage of a Python 3 feature (I think).

This is a bit tricky because distlib isn't part of the standard Python environment (it's vendored into pip) which get-poetry.py assumes, so using setuptools as you mentioned is a good option, i.e. like their unit test does, rather than providing our own cli.exe.

Is setuptools assumable by get-poetry.py?

Alternatively, if-and-when Poetry is using distlib.scripts (or setuptools) for generating executables for packages, perhaps expose a command from Poetry that will create the relevant executable, and call it from the end of the get-poetry.py install script.

Fixing this would also resolve #2030.

@naveen521kk
Copy link
Author

Well, sorry for this late response. I think it would be better to use distlib because it provides some API. but still unsure how to...

@abn
Copy link
Member

abn commented Mar 20, 2021

@naveen521kk happy to look at clearer proposal on how we might do this. If using pip or pipx to install poetry does this anyway, I would be inclined to rather make a note in the documentation and move on.

Since the bootstrap script is intended to work with no or limited dependencies, I would be hesitent to even require distlib. As this is not necessarily always available and there are known issues inconsistencies with distro vendored installations of the package (eg: ubuntu).

However, if we indeed proceed to making changes, they will need to be on top of #3706 as that will be the new bootstrap mechanism. It might also be a good idea to verify if the problem goes away by virtue of the new changes, specifically how poetry installed into the virtual environment. Test this out and let us know.

Note: I am not recommending either of the following options, but simply identifying a way forward in the discussion.

Option 1

If the new bootstrap mechanism does nto solve the issue, a draft PR to that branch or mainline (once merged) might be a good way to consider any changes required.

Option 2

Another option (more effort) is to setup a windows installer for poetry (this might require a new issue and proper discussion). I am not even sure if this is an option that the community wants, and I do not develop on windows myself to comment qualitatively. I am also unsure how much effort this would be to maintain going forward either. If we go down this path, an outline of steps required would be:

  1. Proof of concept source in an isolated repository building a windows installer from a Poetry release. There seems to be a few frameworks one can choose from for this.
  2. A github action pipeline that produces the release artifacts for testing.
  3. Once we have a working-good solution, we bring this repo into the poetry org and run this as part of the poetry release pipelines.

@sdispater
Copy link
Member

The new bootstrapping method (see #3706) will solve this. Basically, the new method uses pip which in turn creates the poetry.exe script which is then symlinked (or copied if symlinks are not available) to the destination directory.

@naveen521kk
Copy link
Author

If using pip or pipx to install poetry does this anyway, I would be inclined to rather make a not int he documentation and move on.

Yes, pipx or pip creates a .exe file and I have seen pipx and pip both using distlib.

Since the bootstrap script is intended to work with no or limited dependencies, I would be hesitent to even require distlib. As this is not necessarily always available and there are known issues inconsistencies with distro vendored installations of the package (eg: ubuntu).

I would say doing this only on Windows is fine actually because that's the place where an exe is required.

@abn abn closed this as completed in #3706 Mar 30, 2021
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants