copier icon indicating copy to clipboard operation
copier copied to clipboard

feat: self-contained copier executable with Python in it

Open heitorlessa opened this issue 4 years ago • 6 comments

Is your feature request related to a problem? Please describe.

I've started using copier today (great work!!!) and one problem I anticipate is helping other developers install it from Windows and Mac -- they'll have to install/upgrade Python, install pipx, then copier.

Perhaps one of these solutions: https://docs.python-guide.org/shipping/freezing/

Describe the solution you'd like

A self-contained executable for Mac and Windows under GitHub Releases page

Describe alternatives you've considered

Have instructions on how to install Python, pipx, update PATH, and then install copier.

Additional context

heitorlessa avatar Oct 13 '21 16:10 heitorlessa

I guess by your comment that they are not python developers (because otherwise they'd have those tools anyways).

I see this is a valid point, mostly thinking that copier should work for people from other languages/frameworks. However, I don't think I'm currently gonna put this in the roadmap, so I'll leave it open for community contributions.

yajo avatar Oct 14 '21 07:10 yajo

Depending on how widely adopted Docker is within the target audience publishing a (official) docker image to run copier could also be an option.

m-vellinga avatar Oct 14 '21 08:10 m-vellinga

Depending on how widely adopted Docker is within the target audience publishing a (official) docker image to run copier could also be an option.

That would solve it, since freezing is always tricky!

heitorlessa avatar Oct 14 '21 10:10 heitorlessa

Do you think installing docker will be easier than installing python for Mac and windows users?

yajo avatar Oct 15 '21 03:10 yajo

They already have Docker installed across the company :)

This means they could run Docker CLI to run Copier using a Python:slim image for example.

On Fri, 15 Oct 2021 at 05:55, Jairo Llopis @.***> wrote:

Do you think installing docker will be easier than installing python for Mac and windows users?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/copier-org/copier/issues/457#issuecomment-943964553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPQBGXYWRYBFC27QSUVSDUG6Q4JANCNFSM5F5S6DOA .

heitorlessa avatar Oct 15 '21 05:10 heitorlessa

I've been able to bundle Python programs thanks to pyinstaller: https://github.com/pawamoy/aria2p/blob/3497d2b219bea4017644d384c1df08298f364689/duties.py#L90-L94

This could be used in CI on tags, to create a GitHub release and add an artifact to it.

There are other projects that allow to do the same thing or similar.

pawamoy avatar Oct 15 '21 09:10 pawamoy

A docker or/and pyinstaller solution would be greater! I see this is tagged as help wanted. I don't think I'd be able to shepard the feature as a whole, but I could potentially provider a PoC w/ a sample GitHub Action to build and dist

RichiCoder1 avatar Mar 06 '23 18:03 RichiCoder1

Black might serve as inspiration: https://github.com/psf/black/blob/23.1.0/.github/workflows/upload_binary.yml

sisp avatar Mar 06 '23 20:03 sisp

Since this got asked, we now support nix. Examples:

To enter a shell where copier is installed temporarily:

nix shell github:copier-org/copier

To run copier without installing:

nix run github:copier-org/copier copy gh:whatever/template ./there

To install it:

nix profile install github:copier-org/copier

To convert it to a docker image (not working because it lacks git, but you get the point):

nix bundle --bundler github:NixOS/bundlers#toDockerImage github:copier-org/copier#packages.x86_64-linux.default
docker load < python*copier*.tar.gz

It works for Linux, MacOS and WSL.

If I were to provide a self-contained legacy format, I'd provide a docker image, as it is very easy to generate it from nix. But is it still worth it? 🤔

yajo avatar Mar 21 '23 20:03 yajo

Apologies for not being able to get around to this myself!

If I were to provide a self-contained legacy format, I'd provide a docker image, as it is very easy to generate it from nix. But is it still worth it? 🤔

Either bare install or, in a stretch, docker would be preferred. I'm a big fan of nix, but I'd still consider it relatively esoteric and having its own constraints to get setup.

RichiCoder1 avatar Mar 21 '23 22:03 RichiCoder1

Giving it a second thought, this is probably not needed. This works out of the box already:

podman container run --rm -it docker.io/nixos/nix nix --extra-experimental-features 'nix-command flakes' --accept-flake-config run github:copier-org/copier -- --help

yajo avatar Apr 07 '23 08:04 yajo