Replies: 2 comments 5 replies
-
Very personal opinion based on past experiences: I'm sick of having to go to such lengths to support Windows 😂 More seriously now. We should keep in mind that Windows users can install Git-for-Windows without admin rights which comes bundled with a Bash port for Windows. There's also WSL2, and other virtualization solutions. Template writers who want to support Windows can ask their users to use one of these solutions, or they can write their tasks in Python (or Ruby, JS, or any other language). Bundling a Python binding of a Go binary inside the Copier package seems a bit far fetched when these solutions are already available to template writers and users IMO. But don't let me deter you from working towards a bundled cross-platform sh interpreter, that would still be a very cool feature. |
Beta Was this translation helpful? Give feedback.
-
There exists invoke. It is a task manager that is written in Python and lets you supply tasks written in that same language. In Doodba, I solved the problem long ago by just asking users to install it before using the template. You can do the same with Task if that's what you prefer. There is plumbum too. With it, you write pure python, but can use handy shell-like syntax if needed. Plumbum is one of Copier dependencies, so it's always available for your tasks. Finally, you can just use commands instead of tasks. Commands don't use a shell and thus work on any os. So it seems to me like this problem has a lot of possible solutions without much work on your side! |
Beta Was this translation helpful? Give feedback.
-
Creating a Copier template with tasks/migrations that shall be compatible with Linux, macOS, and Windows is a bit cumbersome because there are numerous shells (especially Windows' CMD and PowerShell with completely different syntaxes and tools than Unix shells). Currently, there are two ways to handle this problem:
Unless there are semantic differences in the task commands between the operating systems, I think those two approaches introduce unnecessary complexity because a template creator needs to deal explicitly with the different shells.
So, how about using a cross-platform shell instead? Then, template creators could write tasks independent of the template consumer's operating system and shell. I've drawn some inspiration from Task which uses mvdan.cc/sh as a shell interpreter:
mvdan.cc/sh
is written in Go and I haven't found an equivalent library for Python, but it might be possible to create a Python binding usinggopy
.WDYT?
Beta Was this translation helpful? Give feedback.
All reactions